Debian Slug Notes
some more notes for my bad memory for when I have to do it all over again
I have come back from OpenWrt to Debian.
I wanted a silent slug and thought that OpenWrt might be good without a swap drive and thus I could use a USB Flash memory stick.
I soon found I had run out of memory.
So these are my notes aimed at running Debian on a Flash drive but with as few writes to swap as posssible.

I used QTParted on Fedora to create sda1 as swap and sda2 as ext3 on a 2GByte SanDisk memory stick

Many thanks to -

# /etc/fstab: static file system information.
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/sda2 / ext3 defaults,errors=remount-ro,noatime 0 1
/dev/sda1 none swap sw 0 0
/dev/sda1 /media/usb0 auto rw,user,noauto,noatime 0 0
/dev/sda2 /media/usb1 auto rw,user,noauto,noatime 0 0

touch /.ext3flash

echo "0" > /proc/sys/vm/swappiness

:Disable 'MARK' messages in /etc/default/syslogd options:
add -
SYSLOGD="-m 0"
- or "-m 1440" - for every 24 hours

Disable disk integrity checks.
Slug51local:~# /sbin/tune2fs -c 0 -i 0 /dev/sda2
tune2fs 1.40-WIP (14-Nov-2006)
Setting maximal mount count to -1
Setting interval between checks to 0 seconds

Speed Check
Slug51local:~# dd if=/dev/sda2 of=/dev/null bs=10000 count=10000
10000+0 records in
10000+0 records out
100000000 bytes (100 MB) copied, 9.12616 seconds, 11.0 MB/s

Save Memory Use

If you are not using IPv6, you can prevent the module from being automatically loaded by adding the line
blacklist ipv6
to /etc/modprobe.d/blacklist.
The same goes for any other kernel module which is automatically loaded which you know you won’t need

lsmod to see what is loaded
free to see memory use

apt-get remove NFS (and NetaTalk) - seems they were not present on mine

Using a high definition UVC Webcam with Debian

this link introduced me to the mjpg-streamer and the Quickcam Pro 9000.
That uses OpenWrt but I want to now use Debian - getting it to run was the biggest Linux challenge yet!

- also many thanks to the owner of for much advice

I took ages trying to find how to load "Video for Linux" or "V4L2" by "apt-get install"
- fear not ! - it is in the Kernel as installed.

When you plug the camera into the USB port the terminal (in ttyS0 by rs232) should report that a UVC camera has arrived.
So you need a driver

get the UVC driver for Quickcam pro 5000 and 9000
apt-get install subversion - so we can join the Linux Gods and work from the bleeding edge
svn checkout svn://
apt-get install debconf - it was already installed in mine - not sure why I need it....

BUT I eventually found lots of other things to do first before it would work

from -
apt-get install build-essential - that worked
apt-get install kernel-headers - OOPS! that one failed to so more Googling-
How to get kernel headers
from -
apt-get update - it did not work if I ignored this one
Install linux-header package -
apt-get install linux-headers-$(uname -r) - Oh I see!! - kernel-headers are really called linux-headers-$(uname -r) - obvious really......

So in the terminal I see -

Slug51local:~# modprobe usbvideo
Linux video capture interface: v2.00

But still no camera detected - Ahh! new magic word "insmod" needed -
You have to load the newly installed driver module uvcvideo.ko

cd /lib/modules/2.6.18-6-ixp4xx/usb/media
Slug51local:/lib/modules/2.6.18-6-ixp4xx/usb/media# insmod uvcvideo.ko

Now when you plug the camera in you see !!!-
usb 3-5: new high speed USB device using ehci_hcd and address 5
usb 3-5: configuration #1 chosen from 1 choice
uvcvideo: Found UVC 1.00 device <unnamed> (046d:08ce)
input: UVC Camera (046d:08ce) as /class/input/input3

Load and run mjpg-streamer - see the pictures in Firefox
This link helped a lot
so do -

svn co mjpg-streamer
(it says Checked out revision 69)

More preparation work needed!
apt-get install subversion build-essential libjpeg62-dev libjpeg62
try -
make clean all
OOPS!! - it needs the "convert" command
Google found
apt-get install imagemagick
make clean all
make DESTDIR=/usr install - now a very slow conversion of pictures (why?)- just wait!

now copy the contents of the www folder that come with the install to /webcam_www
and do -
mjpg_streamer -i " -r 960x720" -o " -p 8080 -w /webcam_www"
and in Firefox I then looked at

And there it was at last - a beautiful picture of an untidy pile of cables on my bench!!!!

make things happen after boot
Debian startup scripts are more complex than OpenWrt!

In /etc/init.d I added a script (with actions at boot up but none at closedown) -

#! /bin/sh
# My startup script - webcam etc
# note -
# update-rc.d -f defaults 99
# update-rc.d -f remove

# Some things that run always
# <commands here>

# Carry out specific functions when asked to by the system
case "$1" in
modprobe usbvideo
cd /lib/modules/2.6.18-6-ixp4xx/usb/media
insmod uvcvideo.ko
mjpg_streamer -i " -r 960x720" -o " -p 8080 -w /webcam_www"

echo "Usage: /etc/init.d/ {start|stop}"
exit 1

exit 0

and then, to make this the last script to run, did
update-rc.d -f defaults 99

modprobe usbvideo
cd /lib/modules/2.6.18-6-ixp4xx/usb/media
insmod uvcvideo.ko
loads the webcam driver


The problem I now have is that if I use -

mjpg_streamer -i " -r 960x720" -o " -p 8080 -w /webcam_www"

(either in the startup script above or in the command line of the ttyS0 terminal)
the terminal hangs even though I can see streaming pictures in Firefox and all other apps work OK.

Only if it was a manual command I can then issue a Control-C
and the mjpg-streamer stops and the terminal can be used again.

Thanks to NN for this -
"there is an option in mjpg-streamer to launch it in background, use it as a daemon:
[-b | --background]...: fork to the background, daemon mode"

So this lets me keep using the ttyS0 terminal -
mjpg_streamer -i " -r 960x720" -b -o " -p 8080 -w /webcam_www"

Note:- to make mjpg-streamer exit cleanly, use -
kill -9 `pidof mjpg_streamer`

Run two cameras
in above replace
mjpg_streamer -i " -r 960x720" -o " -p 8080 -w /webcam_www"
if [ -e /dev/video1 ]; then
mjpg_streamer -b -i " -d /dev/video0 -r 960x720" -o " -p 8088 -w /webcam_www"
mjpg_streamer -b -i " -d /dev/video1 -r 960x720" -o " -p 8089 -w /webcam_www"
mjpg_streamer -b -i " -d /dev/video0 -r 960x720" -o " -p 8088 -w /webcam_www"

Running "Motion" with a UVC Webcam with Debian (tested with Quickcam 5000)

I did apt-get install motion and loaded Motion and all the suggested sub packages
On the ttyS0 terminal I did -
motion -n
to run in terminal reporting mode


It ran with an old Quickcam 4000 that uses a built in driver that comes with Debian but it
gave errors if I used the Quickcam 5000 (even if that had a running UVC driver)

So I went to
and downloaded motion-3.2.11.tar.gz
In the download directory I did

make install

Now it runs with the Quickcam 5000 !!

NB the 5000 has a screen of 640x480 pixels and this needs to be set for the webserver
in /usr/local/etc/motion.conf (this is a copy of the default motion-dist.conf)

Now to adjust many things in motion.conf - especially where it saves pictures and how often (turn your back for a moment and the disk is full!)

Adding a WIFI dongle

Make the Slug mobile and with the lowest possible WIFI power use

From eBay I bought a
D-Link DWL-G122 IEEE 802.11b/g USB 2.0 High Speed 2.4GHz Wireless Adapter
Hardware Ver. : C1 Firmware Ver. : 3.0

And then I followed most of the instructions here to compile the driver -

Here is my backup copy of those instructions (in case the link dies) with my own mods (with many thanks)
1) Download and uncompress the driver's source code:
$ wget
$ tar zxvf rt73-cvs-daily.tar.gz

2) Edit the Module/rtmp_init.c file to change the RTMPMoveMemory function body to only { memcpy(pDest, pSrc, Length); }
$ cd rt73-cvs-AAAAMMDDHH
$ vi Module/rtmp_init.c
// RTMPMoveMemory must change to:
VOID RTMPMoveMemory(
IN ULONG Length)
memcpy(pDest, pSrc, Length);

3) Compile the driver:
$ cd Module
$ make arm

4) Copy the resulting rt73.ko module to an appropriate place under /lib:
$ su
# mkdir -p /lib/modules/`uname -r`/kernel\
# cp rt73.ko /lib/modules/`uname -r`/kernel\

5) Copy the rt73.bin firmware to /lib/firmware:
# cp rt73.bin /lib/firmware

6) Update module dependencies:
# depmod

Before losing the working Ethernet connection you must get some tools "iwconfig", "iwlist", etc.
(that is the bit no-one tells novices about !)
apt-get install wireless-tools

7) Edit the /etc/network/interfaces file according to the configuration of the wireless network.
The alias for the DWL-G122 interface will be wlan0.
--my version--

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# wifi D-Link DWL-G122
allow-hotplug wlan0
iface wlan0 inet static
pre-up ifconfig wlan0 up
pre-up iwconfig wlan0 mode Managed
pre-up iwconfig wlan0 essid "225"

# The primary network interface
# allow-hotplug eth0
# iface eth0 inet static

# dns-* options are implemented by the resolvconf package, if installed

use the tools

Slug51local:~# iwlist wlan0 scan
wlan0 Scan completed :
Cell 01 - Address: 00:0C:41:17:FE:4B
Encryption key:off
Bit Rates:130 Mb/s

now try to connect - - -

iwconfig wlan0 essid any
iwconfig wlan0 essid "225"

Slug51local:~# ping
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=64 time=18.5 ms


also see this

Adding a USB to rs232 converter serial port

It is not possible to use the second rs232 on the Slug CPU (it not fully wired and
there are no pins to solder to as on the Sweex router )
- so I bought a USB to serial converter from here

It uses a FTDI chip and Debian has the FTDI drivers built into the kernel.
It has blue diodes that flash on activity - useful to prove it is working.

When I plug it in I see

Slug51local:~# usb 1-2: new full speed USB device using ohci_hcd and address 5
usb 1-2: configuration #1 chosen from 1 choice
ftdi_sio 1-2:1.0: FTDI USB Serial Device converter detected
drivers/usb/serial/ftdi_sio.c: Detected FT232BM
usb 1-2: FTDI USB Serial Device converter now attached to ttyUSB0

So from the ttyS0 serial port or a ssh terminal you can write -

echo "hello slug">/dev/ttyUSB0

and see the output on the USB/rs232 converter output.
The default serial speed is 9600 Baud
but you can change it with stty -

Slug51local:~# stty -F /dev/ttyUSB0 115200

Confirm the setting -

Slug51local:~# stty -F /dev/ttyUSB0
speed 115200 baud; line = 0;
-brkint -imaxbel

For linking to an external device you need "raw" mode such that each character sent is immediately handled.
If you set "cooked" you only see the preceeding characters when a RETURN character is sent. In ttyS0 I set -

Slug51local:~# /dev/ttyUSB0 115200 raw
Slug51local:~# cat /dev/ttyUSB0

Where each of the characters above "ght5ew" that are entered into the USB/rs232 adapter on /dev/ttyUSB0
are processed by
the Slug one by one as they are typed.


Two GPIO lines for external equipment control?
Control two of the Slug LEDs - 1 for on, 0 for off - D9=disk2 - D10=disk1
echo 1 > /sys/class/leds/disk-1/brightness
echo 0 > /sys/class/leds/disk-1/brightness
echo 1 > /sys/class/leds/disk-2/brightness
echo 0 > /sys/class/leds/disk-2/brightness

Panic - My Debian Slug stopped booting at "Setting the system clock"
Fix - I removed the lithium battery cell for a few minutes - then when I typed "date" I saw the correct date and time - so it had restarted and reset OK.