Walltop: Difference between revisions

From Wildsong
Jump to navigationJump to search
Brian Wilson (talk | contribs)
mNo edit summary
Brian Wilson (talk | contribs)
mNo edit summary
 
(34 intermediate revisions by the same user not shown)
Line 1: Line 1:
WallTop computers... recycle an old laptop by removing all the extraneous parts such as the cdrom drive, floppy drive, (dead) battery and then hanging it on the wall.
WallTop computers... the concept is to recycle an old laptop by removing all the extraneous parts such as the cdrom drive, floppy drive, (dead) battery and then hanging it on the wall.


I am building one from an old Dell Inspiron 3700.
= Available hardware =


== Operating system ==
My first attempt is based on a Dell Inspiron 3700 C466GT.


I looked at using Debian, Damn Small Linux, Puppy Linux (which immediately panics on boot), and Movix. I decided I might as well stick with Ubuntu so I am building a custom Live CD. I will then transfer it to a Compact Flash card, which will be plugged into an IDE adapter and replace the incredibly noisy stock 4200 rpm hard drive.
* 466 MHz Celeron processor
* 256 MB PC100 SODIMM memory
* one PATA slot
* two broken PC card slots
* one USB port


See http://www.debuntu.org/how-to-customize-your-ubuntu-live-cd
Removed: case, 4200 RPM hard drive, dead battery


'''Oh! This was a bad idea. Much stuff about Ubuntu live cd's has been deleted from this page!'''
Added: a shadow box frame from Michaels, a power supply from OSUsed, a CF to 44pin PATA adapter, a 1GB CF card, and an ASUS 802.11g WiFi USB adapter


=== Debian Live! ===
I had to modify the frame to add cooling slots.


The way to do this is [http://live.debian.net/ Debian Live!]
This laptop will only boot when you touch its power on button. To make the button accessible I mounted the motherboard upside down (what used to be the top is towards the wall when it's hanging up.
I drilled a hole in the back about 3/8" diameter. You can poke the button with a pencil eraser to boot it up. Yes.. its a pain.
 
== More hardware available for future projects ==
 
Micron TransPort GX2: Pentium III 1.2Ghz
* 15-inch LCD at 1,280-by-1,024
 
http://www.pcmag.com/article2/0,2817,7733,00.asp
 
Micron TransPort XT Notebook Computers CPU: Intel Pentium III 750 ~ 850MHz
* Standard Memory: 64MB~256MB
* Maximum Memory: 512MB
14" screen
 
http://www.pcworld.com/article/54784/micronpc_launches_transport_xt_notebook.html
 
= The software =
 
== Which distribution to use? ==
 
After much research and experimentation I settled on
[http://live.debian.net/ Debian Live!]
 
This allows me to build an image on a big fancy Ubuntu desktop system ([[Raven]]) and test it in qemu.
 
Once the image is built I transfer it to a Compact Flash card, which will be plugged into an IDE adapter and replace the incredibly noisy stock 4200 rpm hard drive.
 
I am also now using Debian Live! to build [[Asterisk]] phone systems.
 
Some other options that I investigated:
*Debian
*Damn Small Linux
*Puppy Linux (which immediately panics on boot)
*Movix
*Ubuntu, building a [http://www.debuntu.org/how-to-customize-your-ubuntu-live-cd custom Live CD]
 
== Debian Live! installation ==


[http://wiki.debian.org/DebianLive Debian Live wiki]
[http://wiki.debian.org/DebianLive Debian Live wiki]
Line 52: Line 93:
I add the autofs.* files that I use to mount nfs servers.
I add the autofs.* files that I use to mount nfs servers.
   
   
Doing customizations, do this
Doing customizations, do this (as root)
lh_clean --binary
  lh_config
  lh_config
  lh_bootstrap
  lh_bootstrap
# Prepare for a chroot system so you can do hacks
  lh_chroot
  lh_chroot
  lh_chroot_hosts install
  lh_chroot_hosts install
Line 60: Line 103:
  lh_chroot_proc install
  lh_chroot_proc install
  chroot chroot
  chroot chroot
  #do the hacks here
#do the hacks here, for example "apt-get install asterisk".
exit
# Now remove the changes make to do chroot
  lh_chroot_hosts remove
  lh_chroot_hosts remove
  lh_chroot_resolv remove
  lh_chroot_resolv remove
  lh_chroot_proc remove
  lh_chroot_proc remove
# I wonder what this does
  lh_binary
  lh_binary
instead of
# Build the image
  lh_build
  lh_build


Line 89: Line 135:
http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html
http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html


== Debian Live operating system ==
=== Building a working image ===
 
[http://live.debian.net/ Debian Live!]
is designed to run from read only media such as a CD,
I am trying to install it on a USB flash device for ease of use.


=== The basic principles ===
To make (large) changes, you build a new, complete image from scratch.
 
You copy the new image to CF, put it in the computer, and boot.
To make (large) changes to the phone server, you build a new, complete USB image from scratch.
You copy the new image to a stick, test on a spare machine, then when you are ready to switch over, you shut down the phone server, swap sticks, and reboot. If the new system fails, fall back to the old stick and try again.
 
The build process described below includes all configuration settings. There should not be any tweaking of the finished USB stick required. If you tweak it in the test phase, then make the changes permanent by updating the build settings and building a new stick before releasing it on the phone server.
 
Don't fiddle with the server while it's running. It's behind a firewall and it has no writable hard drive, so it is not too too prone to being hacked and if it is hacked they can't do much that can't be undone with a reboot.
 
'''The exception''' to this (of course there is always an exception) is the phone system settings in /etc/asterisk.
These files change frequently, so you have to be able to edit them.
'''TODO - make them "COW" files or save them in MySQL.'''
 
=== Useful links ===
 
* For my personal notes on using Debian Live on a laptop see http://www.wildsong.biz/index.php?title=Walltop
* [http://wiki.debian.org/DebianLive Debian Live wiki]
* [http://live.debian.net/manual/html/ch03s03.html Building an USB/HDD image]
 
=== Developer notes ===
 
I want a minimal server, with just the addition of packages that make life with Asterisk bearable. The server handles phones and faxes. It keeps its call log files on Kilchis via mysql. There are no modems, just a 4 port "Wildcard" to connect to the phone company. It needs to be able to send email notices.
 
Currently voicemail messages get stored on this server. I might change that by using an NFS filesystem on Kilchis. It would be nice to get Apache off of the phone server.
 
Hylafax has not been completely set up, we can receive faxes but there is no fancy Windows client to send faxes. There was some reason I had to build it from sources. See the [[Fax]] page. I think I should run the server portion on the phone server and the client(s) on Kilchis.
 
I included flite ("festival lite") to allow text-to-speech but have not used it yet. Should remove it if we're not going to use it.
 
==== Asterisk MySQL integration ====
 
The DebianLive setup uses all the Debian Asterisk packages, so for MySQL
the package is called asterisk-mysql. See /usr/share/doc/asterisk-mysql, especially the examples directory which contains setup files.
 
==== TODO LIST ====
 
I copied the /usr/local stuff from (the old) Roaring and need to make sure I can build it from scratch on the development server.
 
=== Build procedure ===
 
First time around, install the live-cd packages the build host, "apt-get install live-cd"
 
* This list does not include the hylafax support yet. I currently only included the generic hylafax package for testing.
* I use [[Dev]] as the build host.
* I work in a subdirectory on the RAID array, /mnt/stripe/DebianLive
* I work su'ed to root, because the build stage requires it.
* I might be building on a 64 bit machine so I have to say '''-k 686''' to get the 32 bit kernel.
* I used to include the '''minimal''' keyword but it left out things like networking and vi.
 
Clean out the build area.
lh_clean --binary
 
I used a script to configure and copy appropriate files around. See Configure.sh
 
Configure.sh has code something like this
 
lh_config -b usb-hdd -k 686 --bootstrap-flavour \
  --packages-lists "stripped" --binary-indices disabled\
  --memtest "none"\
  --packages "asterisk mysql-client libsox-fmt-mp3\
  hylafax-server iaxmodem\
  festival festvox-kallpc16k \
  apache2-mpm-prefork php5-mysql php-pear\
  openssh-server portmap nfs-common autofs\
  debconf-english"\
  --bootappend-live "nolocales" --syslinux-timeout 50
 
Next it copies files and scripts.


I add scripts to config/chroot_local-hooks. I keep backup copies of the scripts at the top level so that I can wipe the config/ directory and rebuild it from scratch.
I add scripts to config/chroot_local-hooks. I keep backup copies of the scripts at the top level so that I can wipe the config/ directory and rebuild it from scratch.
Line 171: Line 147:
'''''nn-name''.sh''' where 'nn' is a number to control execution order, and 'name' is a meaningful name, for example '''01-password.sh''' would be used to install local user accounts and set user and root passwords.
'''''nn-name''.sh''' where 'nn' is a number to control execution order, and 'name' is a meaningful name, for example '''01-password.sh''' would be used to install local user accounts and set user and root passwords.


The simple next step, the build.
== Networking ==
A complete build takes about 15 minutes on Dev.


lh_build
Depending on how I deploy things, wired or wifi might be easier.
From my notes below I have concluded wired is easier!
 
=== Wired network ===


If the build succeeds there will be a file called binary.img in the top directory.
I ended up pulling a USB-to-ethernet adapter out of my junkbox. It's a 3COM 3C19250 from a 3COM [[Audrey]]. I hooked it up to my VirtualBox simulated walltop and it started right up. Now I have to do the DHCP set up in Debian Live and see if it works on the Dell hardware.


=== Testing ===
=== WiFi Network ===


To test the image in a virtual machine, you can either start it in qemu or convert the img file to a vmdk and use vmware.  
These are WiFi cards I ''was'' considering using. They are still in my junk box but when I actually went to plug one in, I found that this Dell's PC card slots are messed up, so instead I plugged in an ASUS USB adapter.


Of course, you can also the virtual machine to boot from the USB stick but testing the img file first means you don't have to keep copying the image to the stick.)
D-Link DW650M
http://sourceforge.net/apps/mediawiki/ndiswrapper/index.php?title=D-Link_DWL-G650M


"Qemu" is installed on 'dev' already. You need to set up an X11 connection back to your desktop to use it, if you are burdened with a Windows machine see the [[Cygwin]] page. When you have an xterm window open on your desktop, type 'qemu binary.img' and wonder at the marvels of modern technology.
Microsoft MN-720


Once the Qemu window captures your mouse you can escape with Ctl-Alt.
I have not completed testing of ndiswrapper since I switched to using the ASUS USB adapter. Here are my notes for the NEXT walltop. I have several more laptops...
Thought you might want to know that.


=== Test plan ===
To use these I need to use the manufacturer's drivers + ndiswrapper.
http://wiki.debian.org/NdisWrapper


# Test the image in an emulator.
In chroot environment
# Test the usb stick in the backup computer.
m-a prepare
# Test on real hardware. (When ready to go live.)
m-a a-i ndiswrapper
echo ndiswrapper >> /etc/modules


==== Testing image in Qemu ====
==== WiFi Security settings ====


There are clever ways to set up Qemu networking. It requires setting up a TAP interface on the host. Not sure if I am up to that. I think [http://compsoc.dur.ac.uk/~djw/qemu.html this is the proper way to do it] but I don't want to accidentally shut down [[Dev]] right now.
With this device it's just a matter of plugging it in and then getting the correct security settings for the network. I was able to turn off security on my Linksys and get a connection. Since my ultimate goal is to take this to work and hang it on the wall there, turning security at the WAP off is not an option.


Here is the command to start the image in [http://www.nongnu.org/qemu/ qemu]. This MAC number is one digit off from the real thing. (24 vs 25) ([http://www.gnome.org/~markmc/qemu-networking.html qemu networking hints])
I first I spent a couple hours wrestling with getting it to work with wpa_supplicant on an Ubuntu desktop. I tried all sorts of combinations of security settings to no avail. Very frustrating.


qemu -net nic,model=rtl8139,vlan=1,macaddr=00:e0:29:93:3a:25 binary.img
Then I found [http://wicd.sourceforge.net/ wicd]. I installed it (apt-get install wicd), started the daemon (sudo wicd) and the client (wicd-client -n) and had a link up in about 60 seconds. Conclusion: '''USE WICD'''!!


These things are created automatically but just in case...
What I actually ended up doing was installing wicd, using it to set up wpa_supplicant, and then removing it from my installation. The wpa_supplicant configuration that worked that I created with wicd-curses looks like this
* Are there accounts present for 'asterisk' and 'faxmaster'?
* Are there groups (in /etc/group) for asterisk and faxmaster
* Is 'user' in the asterisk group?
* Are 'asterisk' and 'user' in the dialout group?


Check these things every time
ap_scan=1
* Is networking up? (there is a ping command, also check /sbin/ifconfig)
ctrl_interface=/var/run/wpa_supplicant
* Is syslog to Kilchis working? (After booting 'tail /var/log/kern.log' on kilchis)
network={
* Is the system timezone set correctly? ('date' shows PDT or PST) (files: /etc/timezone, /etc/localtime)
      ssid="wildsong"
* Can you get root access via 'su' and login?
      scan_ssid=0
* Can you get an ssh connection to [[Dev]]?
      proto=WPA RSN
* Is Apache running? lynx http://localhost/ (Should give you a page with the config time.)
      key_mgmt=WPA-PSK
* Is Asterisk running? Use 'asterisk -r' as root.
      pairwise=CCMP TKIP
* Is Hylafax running? (Look for qmgr, pickup, faxq, hfaxd)
      group=CCMP TKIP
* Is faxgetty running? (If not, check /etc/inittab)
      psk=67c4e0a7ff7736641fdf9bc8094c45a8b7c60a33f45321f6c3d08f42ec0397af
* Is the apcupsd daemon running? (At least check if it starts in boot)
}
* Is postfix (mail daemon) running? (telnet localhost 25)


==== Tests for asterisk ====
Check the downloads page for more documentation


SSH in as root and start asterisk console -- "asterisk -r"
'''In Debian Lenny''', wicd is a [http://www.backports.org/dokuwiki/doku.php?id=instructions backport], so installing it requires additional work. Add this to /etc/apt/sources.list; like this


* Do a reload and look for error messages. Just type "reload". Notice that it finds and loads the iaxmodem firmware file, iaxy.bin.
echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free ' > config/chroot_sources/backports-wicd.chroot
* Check the mysql connection status with 'realtime mysql status'
wget -O - http://backports.org/debian/archive.key -O config/chroot_sources/backports-wicd.binary.gpg
* Make sure it returns live data, 'realtime load sipusers name brian' returns this


                            id  1
NOTE '''Backports is also required for the USB firmware'''
                          name  brian
                      callerid  104
                  canreinvite  no
                      context  agi_internal
                  fullcontact  Brian Wilson
                          host  dynamic
                      insecure  port,invite
                      mailbox  104
                          nat  no
                        secret  104
                          type  friend
                      disallow  all
                        allow  all
                    regseconds  0
                cancallforward  yes


* Even when running in test mode, the system will register with [http://gizmo5.com Gizmo5], so you can do "sip show registry" to see if it registered. Should look like this.
Then in the chroot environment I do this
apt-get update
apt-get install debian-backports-keyring
apt-get -t lenny-backports install wicd


Host                            Username      Refresh State                Reg.Time
...which installs about a zillion more dependent packages! All just to get my  wireless link going!
proxy01.sipphone.com:5060      alseageo          105 Registered          Tue, 08 Sep 2009 19:32:24


* Likewise with iax: "iax2 show peers"
== SSH services ==


Name/Username    Host                Mask            Port          Status
The lsh-server is a small SSH server.
iaxmodem        127.0.0.1      (D)  255.255.255.255  4570          Unmonitored
pbx_wildsong    (Unspecified)  (D)  255.255.255.255  0            UNKNOWN
voipjet/15035    208.72.186.66  (S)  255.255.255.255  4569          Unmonitored
demo/asterisk    216.207.245.47  (S)  255.255.255.255  4569          Unmonitored
4 iax2 peers [0 online, 1 offline, 3 unmonitored]


The critical ones are iaxmodem, voipjet and demo, which should always show up. Wildsong is my PBX at home and might not be accessible at various times due to firewalls and routing and DHCP and things like that.
By default it generates keys on the first run, which alas is every time on a Debian Live system. So I generate keys on the development host and copy them into the config tree.


* In the following tests, stay logged in and watch messages on the asterisk console.
This is how I generate the seed file and keys.  
* NB The command "voicemail show users" '''DOES NOT WORK''' when using MySQL.
* Call voicemail (button or 85) and enter a mailbox number / password.
* You can take a spare phone and change its SIP server from sip.alseageo.com to the IP of the test machine, and restart it. You should see it register with the test PBX in a few seconds. Then you can do more tests with test phone.
* Call 100. This should connect to the auto-attendant on the test system.
* Dialing an extension should give you an error, the other phones are not registered here.
* 200 should give a message, do MOH, and dial out to my house. In test mode, the last step fails because the Qwest lines are not connected.
* 411 should work for dialing by name, passing you to voicemail.
* 600 reads back your extension number.
* 602 connects to a remote server at Digium, so it tests IAX2 protocol.
* Long distance calls go via VOIP. So try calling someone outside the state. You can call the White House at 1-202-456-1111 and leave comments. When I tried it was always BUSY! So I called the California Academy of Science information line, 1-415-379-8000 and got right through. If you are not antisocial you could call a friend. (By default calls in 541 and 503 area codes are directed out Qwest lines.)


==== Testing offline ====
mkdir ~/.lsh && cd ~/.lsh
lsh-make-seed --sloppy -o yarrow-seed-file
lsh-keygen | lsh-writekey


Repeat all image tests.
== Testing ==


* Send test email to yourself, eg type: "mail [email protected]" (Remember logging goes to kilchis so check there for messages in /var/log/syslog.)
To test the image in a virtual machine, you can either start it directly in qemu or convert the img file to a vdi and use [[VirtualBox]]
* Make sure system time is correct, should be getting it from ntp.alseageo.com
* Make sure you can connect to the mysql server. (settings are in /etc/asterisk/cdr_mysql.conf
mysql -u asteriskuser -p -h kilchis asterisk
password: mysupersecretpassword


==== Testing on the real hardware (with Wildcard in place) ====
I really don't like using Qemu so I deleted the instructions that I used to have here. I don't intend to use it again.


Repeat all image and offline tests.
Converting the IMG file to a VDI file


Test phone system.
VBoxManage convertfromraw -format VDI binary.img binary.vdi
* Interoffice - Place a call from one extension to another
* Place a test call to extension 100 to test the auto-attendant functions.
* Call out using a local number
* Call out using a long distance (VOIP call)
* Call into the office from a cellphone.
* Test the voicemail system (extension 85 or the voicemail button)
* Try each incoming phone number including the fax line. (See [[Phone_Book]])
* Make sure the calls are being logged in the MySQL server.


Test fax system.
Now you can create a virtual machien and mount the VDI as a virtual disk and boot from it. It boots about 10 times faster on the development system as on the real computer. Poor little obsolete laptop!
* Generate a fax and see if it arrives on the server. (See [[Fax]] page.)
* Make sure it forwarded the fax over to the email system. (Ask John or Brian)
* Send a fax from the command line and see if it went out (check email notices too.)


Test UPS daemon
You can also the virtual machine to boot from the USB stick but testing the img file first means you don't have to keep copying the image to the stick.)
* Does the apcupsd daemon work? (Should be able to ask it how the batteries are doing.)


=== Deployment ===
== Deployment ==


Copy the image to a USB stick, completely overwriting it: '''dd if=binary.img of=''<devicename>'''''. You can get the device name with '''dmesg''', it will be buried in the last few messages after you insert the stick. Something like /dev/sda. Don't use the first partition (which would be /dev/sda1), use the whole drive, you have to overwrite everything there including the boot block and the partition table.
Copy the image to a CF card, completely overwriting it: '''dd if=binary.img of=''<devicename>'''''. You can get the device name with '''dmesg''', it will be buried in the last few messages after you insert the stick. Something like /dev/sda. Don't use the first partition (which would be /dev/sda1), use the whole drive, you have to overwrite everything there including the boot block and the partition table.


'''Note: If you select the wrong device name you can make the host system unbootable in about 250 mS. If you do this, don't come whining to me about it. Fix it.'''
'''Note: If you select the wrong device name you can make the host system unbootable in about 250 mS. If you do this, don't come whining to me about it. Fix it.'''
To use in the target system, simply plug in the stick and reboot it. You have to set it to boot from USB in BIOS. If you can't set it, get a newer computer!
Incidentally installing Linux onto the USB stick makes it unusable in Windows. If you want to use it in Windows again ever you will need to partition it and create a FAT filesystem on it.

Latest revision as of 05:32, 6 July 2010

WallTop computers... the concept is to recycle an old laptop by removing all the extraneous parts such as the cdrom drive, floppy drive, (dead) battery and then hanging it on the wall.

Available hardware

My first attempt is based on a Dell Inspiron 3700 C466GT.

  • 466 MHz Celeron processor
  • 256 MB PC100 SODIMM memory
  • one PATA slot
  • two broken PC card slots
  • one USB port

Removed: case, 4200 RPM hard drive, dead battery

Added: a shadow box frame from Michaels, a power supply from OSUsed, a CF to 44pin PATA adapter, a 1GB CF card, and an ASUS 802.11g WiFi USB adapter

I had to modify the frame to add cooling slots.

This laptop will only boot when you touch its power on button. To make the button accessible I mounted the motherboard upside down (what used to be the top is towards the wall when it's hanging up. I drilled a hole in the back about 3/8" diameter. You can poke the button with a pencil eraser to boot it up. Yes.. its a pain.

More hardware available for future projects

Micron TransPort GX2: Pentium III 1.2Ghz

  • 15-inch LCD at 1,280-by-1,024

http://www.pcmag.com/article2/0,2817,7733,00.asp

Micron TransPort XT Notebook Computers CPU: Intel Pentium III 750 ~ 850MHz

  • Standard Memory: 64MB~256MB
  • Maximum Memory: 512MB

14" screen

http://www.pcworld.com/article/54784/micronpc_launches_transport_xt_notebook.html

The software

Which distribution to use?

After much research and experimentation I settled on Debian Live!

This allows me to build an image on a big fancy Ubuntu desktop system (Raven) and test it in qemu.

Once the image is built I transfer it to a Compact Flash card, which will be plugged into an IDE adapter and replace the incredibly noisy stock 4200 rpm hard drive.

I am also now using Debian Live! to build Asterisk phone systems.

Some other options that I investigated:

  • Debian
  • Damn Small Linux
  • Puppy Linux (which immediately panics on boot)
  • Movix
  • Ubuntu, building a custom Live CD

Debian Live! installation

Debian Live wiki

Building an USB/HDD image

FluxBox

Install the tools to build Debian Live! systems

apt-get install live-helper

Build an image.

lh_clean --binary
lh_config -b usb-hdd -k 686 --bootstrap-flavour minimal\
--packages-lists "stripped" --binary-indices disabled\
--memtest "disabled"\
--packages "x-window-system-core fluxbox\
openssh-server vlc gnash portmap nfs-common\
autofs debconf-english"\
--bootappend-live "nolocales" --syslinux-timeout 50

I build on a 64 bit machine so I have to say -k 686 to get the 32 bit kernel

Add scripts to config/chroot_local-hooks

02-fix_inittab.sh - changes runlevel to 5 and adds the tty7 login line so I have only one login running instead of default 5

40-bash_profile.sh - append or create a .bash_profile script that will run a script from nfs and then do a 'startx'.

50-windowmanager.sh - configures fluxbox startup files

99-make-export.sh - make the directories needed for autofs

Add files to config/chroot_local-includes I add the autofs.* files that I use to mount nfs servers.

Doing customizations, do this (as root)

lh_clean --binary
lh_config
lh_bootstrap
# Prepare for a chroot system so you can do hacks
lh_chroot
lh_chroot_hosts install
lh_chroot_resolv install
lh_chroot_proc install
chroot chroot
#do the hacks here, for example "apt-get install asterisk".
exit
# Now remove the changes make to do chroot
lh_chroot_hosts remove
lh_chroot_resolv remove
lh_chroot_proc remove
# I wonder what this does
lh_binary
# Build the image
lh_build

Copy image to CF: dd if=binary.img of=${USBSTICK}

To test image, start in qemu or convert img file to a vmdk and use vmware

To use in walltop, transfer CF to laptop and boot it

Customization that I might want to do

other codecs???
emacs21-nox
libcurl3
realplayer?
firefox - use iceweasel, unless like me your laptop is puny, then forget it!
flash - use gnash??

I need something to do a slide show of pictures, driven from command line. Image-magick supports this.

Starting X / fluxbox without a window manager http://www.debianadmin.com/how-to-auto-login-and-startx-without-a-display-manager-in-debian.html

Building a working image

To make (large) changes, you build a new, complete image from scratch. You copy the new image to CF, put it in the computer, and boot.

I add scripts to config/chroot_local-hooks. I keep backup copies of the scripts at the top level so that I can wipe the config/ directory and rebuild it from scratch. I keep copies of the files that will be included in MyConfigIncludes/

Create scripts to customize the images

nn-name.sh where 'nn' is a number to control execution order, and 'name' is a meaningful name, for example 01-password.sh would be used to install local user accounts and set user and root passwords.

Networking

Depending on how I deploy things, wired or wifi might be easier. From my notes below I have concluded wired is easier!

Wired network

I ended up pulling a USB-to-ethernet adapter out of my junkbox. It's a 3COM 3C19250 from a 3COM Audrey. I hooked it up to my VirtualBox simulated walltop and it started right up. Now I have to do the DHCP set up in Debian Live and see if it works on the Dell hardware.

WiFi Network

These are WiFi cards I was considering using. They are still in my junk box but when I actually went to plug one in, I found that this Dell's PC card slots are messed up, so instead I plugged in an ASUS USB adapter.

D-Link DW650M http://sourceforge.net/apps/mediawiki/ndiswrapper/index.php?title=D-Link_DWL-G650M

Microsoft MN-720

I have not completed testing of ndiswrapper since I switched to using the ASUS USB adapter. Here are my notes for the NEXT walltop. I have several more laptops...

To use these I need to use the manufacturer's drivers + ndiswrapper. http://wiki.debian.org/NdisWrapper

In chroot environment

m-a prepare
m-a a-i ndiswrapper
echo ndiswrapper >> /etc/modules

WiFi Security settings

With this device it's just a matter of plugging it in and then getting the correct security settings for the network. I was able to turn off security on my Linksys and get a connection. Since my ultimate goal is to take this to work and hang it on the wall there, turning security at the WAP off is not an option.

I first I spent a couple hours wrestling with getting it to work with wpa_supplicant on an Ubuntu desktop. I tried all sorts of combinations of security settings to no avail. Very frustrating.

Then I found wicd. I installed it (apt-get install wicd), started the daemon (sudo wicd) and the client (wicd-client -n) and had a link up in about 60 seconds. Conclusion: USE WICD!!

What I actually ended up doing was installing wicd, using it to set up wpa_supplicant, and then removing it from my installation. The wpa_supplicant configuration that worked that I created with wicd-curses looks like this

ap_scan=1
ctrl_interface=/var/run/wpa_supplicant
network={
      ssid="wildsong"
      scan_ssid=0
      proto=WPA RSN
      key_mgmt=WPA-PSK
      pairwise=CCMP TKIP
      group=CCMP TKIP
      psk=67c4e0a7ff7736641fdf9bc8094c45a8b7c60a33f45321f6c3d08f42ec0397af
}

Check the downloads page for more documentation

In Debian Lenny, wicd is a backport, so installing it requires additional work. Add this to /etc/apt/sources.list; like this

echo 'deb http://www.backports.org/debian lenny-backports main contrib non-free ' > config/chroot_sources/backports-wicd.chroot
wget -O - http://backports.org/debian/archive.key -O config/chroot_sources/backports-wicd.binary.gpg

NOTE Backports is also required for the USB firmware

Then in the chroot environment I do this

apt-get update
apt-get install debian-backports-keyring
apt-get -t lenny-backports install wicd

...which installs about a zillion more dependent packages! All just to get my wireless link going!

SSH services

The lsh-server is a small SSH server.

By default it generates keys on the first run, which alas is every time on a Debian Live system. So I generate keys on the development host and copy them into the config tree.

This is how I generate the seed file and keys.

mkdir ~/.lsh && cd ~/.lsh
lsh-make-seed --sloppy -o yarrow-seed-file
lsh-keygen | lsh-writekey

Testing

To test the image in a virtual machine, you can either start it directly in qemu or convert the img file to a vdi and use VirtualBox

I really don't like using Qemu so I deleted the instructions that I used to have here. I don't intend to use it again.

Converting the IMG file to a VDI file

VBoxManage convertfromraw -format VDI binary.img binary.vdi

Now you can create a virtual machien and mount the VDI as a virtual disk and boot from it. It boots about 10 times faster on the development system as on the real computer. Poor little obsolete laptop!

You can also the virtual machine to boot from the USB stick but testing the img file first means you don't have to keep copying the image to the stick.)

Deployment

Copy the image to a CF card, completely overwriting it: dd if=binary.img of=<devicename>. You can get the device name with dmesg, it will be buried in the last few messages after you insert the stick. Something like /dev/sda. Don't use the first partition (which would be /dev/sda1), use the whole drive, you have to overwrite everything there including the boot block and the partition table.

Note: If you select the wrong device name you can make the host system unbootable in about 250 mS. If you do this, don't come whining to me about it. Fix it.