HOWTO install debian on 128 mb usb stick
install debian on a usb stick
Setup good firmware
I used phedny's custom firmware (1.9.2.7-3b) with ipv6 support, you can download it here. Howto install new firmware is described in other howto's on the wl500g forums.
If you don't want ipv6, you can skip setting it up. But hey, why not use ipv6 when I included all kinds of neat ipv6 things like radvd, iproute2, ping6 and traceroute6! Well, read howto setup your wl500g as a ipv6 router
I disabled the stupid-ftp server, because it's .. to simple. Why not use a cool ftpd server when you have a working debian installation? :-) If you have disabled the ftp server on the admin webpages, the usb-storage modules won't be loaded into the kernel. Make sure you have loaded the required modules into the kernel:
Code:
insmod /lib/modules/2.4.20/kernel/drivers/scsi/scsi_mod.o
insmod /lib/modules/2.4.20/kernel/drivers/scsi/sd_mod.o
insmod /lib/modules/2.4.20/kernel/drivers/usb/storage/usb-storage.o
Download the image and store it on the usb memory stick:
Code:
wget -O /dev/scsi/host0/bus0/target0/lun0/disc http://masteen2.iiivx.net/wl500g/debian/debian-sarge-128mb-mipsel.image
this image includes a partition table and stuff, because the ipv6 firmware doesn't have e2fsprogs out of the box. Mount the crazy thing so you can start messing around.
Code:
mount /dev/scsi/host0/bus0/target0/lun0/part1 /tmp/harddisk
Get into your debian installation.
Code:
chroot /tmp/harddisk/debian-distro /bin/bash
mount -t proc none /proc
mount -t devfs devfs /dev
swapon /dev/scsi/host0/bus0/target0/lun0/part2
Generate your own key's and start dropbear
Code:
rm /etc/dropbear/dropbear_rsa_host_key && rm /etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
/etc/init.d/dropbear start
Use your fresh debian installation
Now the second part, using your debian installation!
Ssh to your router using the account 'normaluser' and the default password 'userpasswd'. Change your password and type 'su', the default root password is 'rootpasswd'.
Do something kinky like
Code:
apt-get update; apt-get dist-upgrade
And enjoy! Don't forget to regulary clean up the useless stuff I mentioned before.
Additional information
Example of how things can look when everything goes okay
Code:
Feanor:~ iiivx$ ssh normaluser@192.168.1.1
normaluser@192.168.1.1's password:
Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
normaluser@wl500g-router:~$ su
Password:
wl500g-router:/home/normaluser# uptime
21:08:10 up 2 days, 8:38, 1 user, load average: 0.29, 0.36, 0.69
wl500g-router:/home/normaluser# uname -a
Linux wl500g-router 2.4.20 #57 Thu Feb 10 14:29:29 CET 2005 mips GNU/Linux
wl500g-router:/home/normaluser# cat /etc/debian_version
3.1
wl500g-router:/home/normaluser#
How did I make this? How can this work?
Indeed, "cdebootstrap -amipsel sarge debian-distro http://ftp.de.debian.org/debian" creates a 100 megabyte filetree, and if you unpack the stuff it gets even worse. So I decided to delete all the 'useless' crap.
The first reduction technique is to remove the documentation from the root filesystem. They include the Perl .pod files and everything under the following directories:
Code:
/usr/doc
/usr/info
/usr/man
/usr/share/doc
/usr/share/info
/usr/share/man
Two others that should either be trimmed or eliminated are . . .
Code:
/usr/share/locale
/usr/share/zoneinfo
/usr/share/locale provides locale information, so that users can see the system in their own languages, currency formats, etc. /usr/share/zoneinfo provides timezone definitions, so that users can see local time and perform timezone conversions. Both of these could certainly be trimmed down -- a server which is going to be administered by a single person does not need locale information for languages that person does not speak; and a server which will be used in one place, and does not do complex time-related applications (e.g. calendaring) will never use more than one timezone definitions.
However, removing all of the documentation, the locale, and timezone information only reduces the size of the Debian root filesystem that much, so I also deleted a bunch of not-required libraries and packages. If you miss them, you can install them using apt-get(8).
I ended up using this packages list: debian-sarge-128mb-mipsel-packages.txt
output of my df -h & free -m
Code:
root@wl500g-router:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/scsi/host0/bus0/target0/lun0/part1
112M 78M 29M 74% /
root@wl500g-router:/# free -m
total used free shared buffers cached
Mem: 13 12 1 0 0 5
-/+ buffers/cache: 6 7
Swap: 10 1 9
root@wl500g-router:/#
Need help booting Debian from USB-Stick
Sorry for my bad english...
Im trying to boot from a Debian Sarge installation on an external memory-stick.
I installed debian and it works great when I use chroot.
I set the memory-stick as boot-device:
Code:
nvram set boot_dev="/dev/scsi/host0/bus0/target0/lun0/part1"
nvram commit
When I reboot the system boots from memory-stick. The light on the stick is flashing and the system is not reachable.
I'm pretty sure the debian-configuration is incomplete. This is what I configured:
/etc/fstab
Code:
/proc /proc proc defaults
devfs /dev devfs rw 0 0
/dev/scsi/host0/bus0/target0/lun0/part1 / ext3 rw 0 0
/dev/scsi/host0/bus0/target0/lun0/part2 none swap sw 0 0
/etc/network/interfaces
Code:
auto lo
iface lo inet loopback
auto vlan0
iface vlan0 inet static
pre-up ifconfig eth0 up
pre-up vconfig add eth0 0
address 10.1.1.12
netmask 255.255.255.0
gateway 10.1.1.10
I have not yet added an ssh-server to the init-scripts since not even ping to 10.1.1.12 works.
Is there a kernel-module missing? If yes, can I copy the modules from flash and add a line to /etc/modules?
I have no serial-console available. So it's very hard to find the problem. Please help me!
Many thanks
still plagued by "bus error"
Thanks for the link - I tried the firmware and base system that was provided there, but STILL got a ton of bus errors! I'm starting to think that my router is just broken. :(
I think if I didn't get the bus errors than everything would be working fine because the router did manage to boot up, but it's certainly not usable with all the bus error's that it got.
What firmware are you using to chroot to debian?
Have you ever gotten any of these "Bus error" warnings?
Are you using the asus premium or deluxe model?
If you're trying to use an external USB harddrive instead of a USB stick that may be the reason why you aren't able to boot with that openwrt firmware given in the link - when I tried that firmware with my external usb harddrive it wouldn't detect it (oleg's firmware does), but it would detect my usb flash drive.
Below is a paste of what I got from my serial console while booting the router with the firmware and base system provided in the link.
Code:
Waiting 10sec before mounting root device...
Vendor: 3SYSTEM Model: USB FLASH DISK Rev: 1.00
Type: Direct-Access ANSI SCSI revision: 02
SCSI device sda: 512000 512-byte hdwr sectors (262 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
SCSI device sda: 512000 512-byte hdwr sectors (262 MB)
sda: Write Protect is off
sda: assuming drive cache: write through
sda: sda1 sda2
sd 0:0:0:0: Attached scsi removable disk sda
kjournald starting. Commit interval 5 seconds
EXT3-fs: mounted filesystem with ordered data mode.
VFS: Mounted root (ext3 filesystem) readonly.
Freeing unused kernel memory: 132k freed
Algorithmics/MIPS FPU Emulator v1.5
INIT: version 2.86 booting
/etc/init.d/rc: line 77: 118 Bus error $@
Setting hostname to 'asus-debian'...done.
/etc/init.d/rc: line 77: 129 Bus error $@
/etc/init.d/rc: line 77: 132 Bus error $@
* Files under mount point '/dev/shm' will be hidden.
/etc/init.d/rc: line 77: 151 Bus error $@
/etc/init.d/rc: line 77: 168 Bus error $@
/etc/rcS.d/S10checkroot.sh: line 22: 175 Bus error ( [ "$PASS" != 0 ] && [ "$PASS" != ""
/etc/rcS.d/S10checkroot.sh: line 22: 176 Bus error ( [ "$FSTYPE" = "nfs" ] || [ "$FSTYPE
4" ] )
Activating swap:swapon on /dev/sda2
Adding 11584k swap on /dev/sda2. Priority:-1 extents:1 across:11584k
.
/etc/rcS.d/S10checkroot.sh: line 22: 182 Bus error which on_ac_power >/dev/null 2>&1
EXT3 (no)acl options not supported
EXT3 (no)user_xattr options not supported
EXT3 FS on sda1, internal journal
* Cannot initialize /etc/mtab.
/etc/init.d/rc: line 77: 172 Bus error $@
/etc/rcS.d/S12mtab.sh: line 143: 195 Bus error /etc/init.d/mountdevsubfs.sh start
* Cannot initialize /etc/mtab.
/lib/init/mount-functions.sh: line 23: 209 Bus error which selinuxenabled >/dev/null 2>&
/etc/init.d/rc: line 77: 193 Bus error $@
Setting the system clock..
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
System Clock set. Local time: Sat Jan 1 00:00:20 UTC 2000.
/etc/init.d/rc: line 77: 236 Bus error $@
Cleaning up ifupdown....
/etc/init.d/rc: line 77: 242 Bus error $@
Loading modules...
/etc/rcS.d/S20module-init-tools: line 52: 255 Done(1) grep '^[^#]' $MODULES_FILE
256 Bus error | while read module args; do
[ "$module" ] || continue; if [ "$VERBOSE" != no ]; then
echo " $module"; modprobe $module $args || true;
else
modprobe $module $args >/dev/null 2>&1 || true;
fi;
done
All modules loaded.
/etc/init.d/rc: line 77: 253 Bus error $@
/etc/init.d/rc: line 77: 258 Bus error $@
Setting the system clock again..
Cannot access the Hardware Clock via any known method.
Use the --debug option to see the details of our search for an access method.
System Clock set. Local time: Sat Jan 1 00:00:22 UTC 2000.
/etc/init.d/rc: line 77: 265 Bus error $@
/etc/rcS.d/S30checkfs.sh: line 60: 272 Bus error which on_ac_power >/dev/null 2>&1
Will now check all file systems.
fsck 1.39-WIP (31-Dec-2005)
Checking all file systems.
Done checking file systems.
A log is being saved in /var/log/fsck/checkfs if that location is writable.
/etc/init.d/rc: line 77: 271 Bus error $@
/etc/rcS.d/S30procps.sh: line 22: 278 Bus error which sysctl >/dev/null
/etc/init.d/rc: line 77: 277 Bus error $@
Will now mount local filesystems:.
Will now activate swapfile swap:done.
/etc/init.d/rc: line 77: 285 Bus error $@
/etc/init.d/bootclean: line 161: 299 Bus error which find >/dev/null 2>&1
/etc/rcS.d/S36mountall-bootclean.sh: line 13: 298 Bus error /etc/init.d/bootclean
/etc/init.d/rc: line 77: 297 Bus error $@
Setting up networking.../etc/init.d/rc: line 77: 303 Bus error $@
Configuring network interfaces...ifup: failed to open statefile /etc/network/run/ifstate: No such file o
ory
/etc/rcS.d/S40networking: line 72: 311 Bus error ifup -a
failed.
/etc/init.d/rc: line 77: 310 Bus error $@
/etc/init.d/rc: line 77: 320 Bus error $@
/etc/init.d/bootclean: line 161: 326 Bus error which find >/dev/null 2>&1
/etc/rcS.d/S46mountnfs-bootclean.sh: line 13: 325 Bus error /etc/init.d/bootclean
/etc/init.d/rc: line 77: 324 Bus error $@
/etc/init.d/rc: line 77: 330 Bus error $@
sed: can't read /etc/ntp.conf: No such file or directory
Running ntpdate to synchronize clockError : Temporary failure in name resolution
Error : Temporary failure in name resolution
Error : Temporary failure in name resolution
Error : Temporary failure in name resolution
/etc/rcS.d/S51ntpdate: line 15: 340 Bus error /usr/sbin/ntpdate -b -s $NTPOPTIONS $NTPSE
.
/etc/init.d/rc: line 77: 336 Bus error $@
/etc/rcS.d/S55bootmisc.sh: line 16: 347 Bus error chgrp utmp /var/run/utmp
/etc/rcS.d/S55bootmisc.sh: line 16: 350 Bus error which dmesg >/dev/null 2>&1
/etc/init.d/rc: line 77: 344 Bus error $@
Initializing random number generator...done.
/etc/init.d/rc: line 77: 352 Bus error $@
/etc/init.d/rc: line 77: 364 Bus error $@
/etc/init.d/rc: line 77: 368 Bus error $@
INIT: Entering runlevel: 2
Starting system log daemon: syslogd/etc/rc2.d/S10sysklogd: line 14: 378 Bus error chown
/dev/xconsole
/etc/rc2.d/S10sysklogd: line 58: 379 Segmentation fault start-stop-daemon --start --quiet --exec
-- $SYSLOGD
.
/etc/init.d/rc: line 77: 376 Bus error $@
Starting kernel log daemon: klogd.
/etc/init.d/rc: line 77: 384 Bus error $@
/etc/init.d/rc: line 77: 390 Bus error $@
/etc/rc2.d/S20ssh: line 7: 392 Bus error ( /usr/sbin/sshd -\? 2>&1 | grep -q OpenSSH ) 2
ll
/etc/init.d/rc: line 77: 391 Bus error $@
Starting periodic command scheduler....
/etc/init.d/rc: line 77: 401 Bus error $@
Running local boot scripts (/etc/rc.local)/etc/rc2.d/S99rc.local: line 16: 412 Bus error
.local
.
/etc/init.d/rc: line 77: 411 Bus error $@
/etc/init.d/rc: line 77: 417 Bus error $@
/etc/rc2.d/S99stop-bootlogd: line 17: 419 Bus error /etc/init.d/bootlogd stop
/etc/init.d/rc: line 77: 418 Bus error $@
Debian GNU/Linux testing/unstable asus-debian ttyS0
asus-debian login: