Raspberry Pi KA Lite wireless deployment

Previous post in this series: How to install KA Lite on the Raspberry Pi

If you got to the end of the previous post, you would have a working install of the open source KA Lite system on the Raspberrry Pi.

This post will show you how to deploy this KA Lite setup without relying on any existing network infrastructure:


To share the setup without an existing network, we will configure the wireless adapter to provide its own network for computers to connect to. If you have an existing wireless network, you can skip this post.

Before you begin

This post is intended for the widely-used “WiPi” USB WiFi adapter, so you’ll need one of those.

I used the same Tenda USB WiFi adapter as previous setups, which has a Ralink chip from the same series:

USB WiFi Adapter

Set it up

See the official guide for these steps in compact form. These steps are the same, but expanded with extra output from my install.

Clone the raspberry pi scripts repo:

$ git clone https://github.com/learningequality/ka-lite-pi-scripts.git
Cloning into 'ka-lite-pi-scripts'...
remote: Counting objects: 66, done.
remote: Total 66 (delta 0), reused 0 (delta 0), pack-reused 66
Unpacking objects: 100% (66/66), done.

Open it up and run ./configure.sh as the root user. This requires Internet access, and will install and configure a few packages:

$ cd ka-lite-pi-scripts/
$ ls
README.md     configure_network_interfaces.py  use_wipi.sh
conf          redirect_port80_to_port8008.py
configure.sh  use_edimax.sh
$ sudo ./configure.sh
Get:1 http://mirrordirector.raspbian.org wheezy Release.gpg [490 B] 
Hit http://raspberrypi.collabora.com wheezy Release.gpg                        
Hit http://archive.raspberrypi.org wheezy Release.gpg
Get:2 http://mirrordirector.raspbian.org wheezy Release [14.4 kB]
Hit http://raspberrypi.collabora.com wheezy Release                      
Hit http://archive.raspberrypi.org wheezy Release                        
Hit http://raspberrypi.collabora.com wheezy/rpi armhf Packages           
Get:3 http://archive.raspberrypi.org wheezy/main armhf Packages [129 kB]       
Get:4 http://mirrordirector.raspbian.org wheezy/main armhf Packages [6903 kB]  
Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en                 
Ign http://archive.raspberrypi.org wheezy/main Translation-en                
Get:5 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.6 kB]
Get:6 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [49.3 kB]
Get:7 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [592 B]     
Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en           
Ign http://mirrordirector.raspbian.org wheezy/main Translation-en              
Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en          
Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en
Fetched 6992 kB in 35s (198 kB/s)             
Reading package lists... Done
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be upgraded:
  cups-bsd cups-client cups-common fuse libcups2 libcupsimage2 libfuse2 raspi-config
8 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 1708 kB of archives.
After this operation, 306 kB disk space will be freed.
Get:1 http://archive.raspberrypi.org/debian/ wheezy/main raspi-config all 20150131-4 [13.2 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libcupsimage2 armhf 1.5.3-5+deb7u6 [132 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main cups-common all 1.5.3-5+deb7u6 [904 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ wheezy/main cups-bsd armhf 1.5.3-5+deb7u6 [44.2 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ wheezy/main cups-client armhf 1.5.3-5+deb7u6 [174 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libcups2 armhf 1.5.3-5+deb7u6 [238 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ wheezy/main fuse armhf 2.9.0-2+deb7u2 [70.8 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libfuse2 armhf 2.9.0-2+deb7u2 [132 kB]
Fetched 1708 kB in 3s (447 kB/s)
Preconfiguring packages ...
(Reading database ... 83674 files and directories currently installed.)
Preparing to replace libcupsimage2:armhf 1.5.3-5+deb7u5 (using .../libcupsimage2_1.5.3-5+deb7u6_armhf.deb) ...
Unpacking replacement libcupsimage2:armhf ...
Preparing to replace cups-common 1.5.3-5+deb7u5 (using .../cups-common_1.5.3-5+deb7u6_all.deb) ...
Unpacking replacement cups-common ...
Preparing to replace cups-bsd 1.5.3-5+deb7u5 (using .../cups-bsd_1.5.3-5+deb7u6_armhf.deb) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Unpacking replacement cups-bsd ...
Preparing to replace cups-client 1.5.3-5+deb7u5 (using .../cups-client_1.5.3-5+deb7u6_armhf.deb) ...
Unpacking replacement cups-client ...
Preparing to replace libcups2:armhf 1.5.3-5+deb7u5 (using .../libcups2_1.5.3-5+deb7u6_armhf.deb) ...
Unpacking replacement libcups2:armhf ...
Preparing to replace fuse 2.9.0-2+deb7u1 (using .../fuse_2.9.0-2+deb7u2_armhf.deb) ...
Unpacking replacement fuse ...
Preparing to replace libfuse2:armhf 2.9.0-2+deb7u1 (using .../libfuse2_2.9.0-2+deb7u2_armhf.deb) ...
Unpacking replacement libfuse2:armhf ...
Preparing to replace raspi-config 20150131-3 (using .../raspi-config_20150131-4_all.deb) ...
Unpacking replacement raspi-config ...
Processing triggers for man-db ...
Processing triggers for initramfs-tools ...
Setting up libcups2:armhf (1.5.3-5+deb7u6) ...
Setting up libcupsimage2:armhf (1.5.3-5+deb7u6) ...
Setting up cups-common (1.5.3-5+deb7u6) ...
Setting up cups-client (1.5.3-5+deb7u6) ...
Setting up cups-bsd (1.5.3-5+deb7u6) ...
Setting up libfuse2:armhf (2.9.0-2+deb7u2) ...
Setting up fuse (2.9.0-2+deb7u2) ...
udev active, skipping device node creation.
update-initramfs: deferring update (trigger activated)
Setting up raspi-config (20150131-4) ...
update-rc.d: warning: default start runlevel arguments (2 3 4 5) do not match raspi-config Default-Start values (S)
update-rc.d: warning: default stop runlevel arguments (0 1 6) do not match raspi-config Default-Stop values (none)
Processing triggers for initramfs-tools ...
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  dnsmasq-base libnetfilter-conntrack3
The following NEW packages will be installed:
  dnsmasq dnsmasq-base hostapd libnetfilter-conntrack3
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 822 kB of archives.
After this operation, 1653 kB of additional disk space will be used.
Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main libnetfilter-conntrack3 armhf 1.0.1-1 [32.2 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main dnsmasq-base armhf 2.62-3+deb7u3 [356 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main dnsmasq all 2.62-3+deb7u3 [16.3 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ wheezy/main hostapd armhf 1:1.0-3+deb7u2 [418 kB]
Fetched 822 kB in 4s (168 kB/s)  
Selecting previously unselected package libnetfilter-conntrack3:armhf.
(Reading database ... 83674 files and directories currently installed.)
Unpacking libnetfilter-conntrack3:armhf (from .../libnetfilter-conntrack3_1.0.1-1_armhf.deb) ...
Selecting previously unselected package dnsmasq-base.
Unpacking dnsmasq-base (from .../dnsmasq-base_2.62-3+deb7u3_armhf.deb) ...
Selecting previously unselected package dnsmasq.
Unpacking dnsmasq (from .../dnsmasq_2.62-3+deb7u3_all.deb) ...
Selecting previously unselected package hostapd.
Unpacking hostapd (from .../hostapd_1%3a1.0-3+deb7u2_armhf.deb) ...
Processing triggers for man-db ...
Setting up libnetfilter-conntrack3:armhf (1.0.1-1) ...
Setting up dnsmasq-base (2.62-3+deb7u3) ...
Setting up dnsmasq (2.62-3+deb7u3) ...
[ ok ] Starting DNS forwarder and DHCP server: dnsmasq.
Setting up hostapd (1:1.0-3+deb7u2) ...
[ ok ] Starting advanced IEEE 802.11 management: hostapd.
[ ok ] Starting DNS forwarder and DHCP server: dnsmasq[....] (already running).
update-rc.d: using dependency based boot sequencing
update-rc.d: using dependency based boot sequencing

Next, run run the ./use_wipi.sh script:

$ ./use_wipi.sh 
[ ok ] Stopping advanced IEEE 802.11 management: hostapd.
[ ok ] Starting advanced IEEE 802.11 management: hostapd.

And then the ./configure_network_interfaces.py script as root:

sudo python ./configure_network_interfaces.py

After this ran, the /etc/network/interfaces file looked like:

$ sudo nano /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
#allow-hotplug eth0
iface eth0 inet manual

auto wlan0
#allow-hotplug wlan0
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
#allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

iface wlan0 inet static
  pre-up sudo iptables -t nat -A PREROUTING -i wlan0 -p tcp -j DNAT --to-destination
  pre-up sudo python /home/pi/ka-lite/ka-lite-pi-scripts/redirect_port80_to_port8008.py &

And I modified /etc/default/ifplugd to only include eth0, so that the pi does not attempt to join any wireless networks itself:

$ sudo nano /etc/default/ifplugd
ARGS="-q -f -u0 -d10 -w -I"

And then reboot:

$ sudo reboot

Broadcast message from root@raspberrypi (pts/0) (Thu Jun 11 11:05:46 2015):

The system is going down for reboot NOW!

See if its all working

Disregard the old addresses once you’ve done the above steps, and run ifconfig to find out about addresses after rebooting.

The pi broadcasts a passwordless wireless network called “kalite”, and all DNS lookups point to

This means in a web browser, you can just load a URL like:



On a laptop in range, the network appeared once the pi booted:


The network connected without a password:


And the connection info for the client computer is being checked in the background:


Once the computer gets a lease from DHCP, the URL loads, and the interface works as expected:


Tested on Android, the player and navigation worked in a similar way:


KA Lite’s media player doesn’t seem to require anything other than a web browser. Either Chrome or Firefox seem to be suitable choices.

Debug zone

Some useful commands for debugging are shown below.

List USB devices, for debugging the wireless adapter:


List recent errors, for debugging the same thing:


Restart networking, run when changing configuration:

service networking restart
Note on dnsmasq

Because of the way dnsmasq hijacks lookups to provide the wireless network, the Raspberry pi cannot access the Internet over Ethernet (eg, to download content) while dnsmasq is running:

sudo service dnsmasq stop

You can access the web interface at while this service is disabled.

And then start it again when done using the Internet, so that the user-friendly computer name works again:

sudo service dnsmasq start

One Reply to “Raspberry Pi KA Lite wireless deployment”

  1. Thanks for these two tutorials. With the built in wifi of the raspi 3, a solar powered headless KA Lite server makes tons of sense.

Leave a Reply

Your email address will not be published. Required fields are marked *