install openwrt 8.09 on asus WL-500g deluxe with usb media for extra space

Installing openwrt on your router is already well explained on the openwrt wiki This guide describes my experience with installing kamikaze 8.09 on my  router but it should work on other hardware too . I have the Asus WL-500g Deluxe and installed the latest openwrt image kamikaze 8.09
After installation make sure you setup your network and enable ssh access. Just login to your router with telnet

telnet 192.168.1.1

and type passwd

passwd

this will set a password for the root user, disables telnet and enables ssh. After this you should always use ssh to access your router.

- add usb stick

The next step is to add some extra storage because my router only has 4 Mb flash on board. I use an USB memory stick for this, an USB hard drive also works but uses more power. The first thing I do after logging in (with ssh this time)

ssh 192.168.1.1

is updating the packages list with the package management tool ‘opkg’.

opkg update

If the update fails your network is most likely not yet configured. You can point your browser to http://192.168.1.1 and fill in the settings under the network link or you can do it command line. With the command

uci show network

you can check your settings. And with the following commands

uci set network.lan.ipaddr=192.168.1.1
uci set network.lan.netmask=255.255.255.0
uci set network.lan.gateway=192.168.1.254
uci set network.lan.dns=192.168.1.254

you can change your settings. Don’t forget

uci commit

to activate your changes and to save them so they survive a reboot.

When your packages list is updated you are ready to start installing the packages needed to mount an USB memory stick or hard drive. On my asus WL-500g deluxe i installed the following packages :

opkg install kmod-usb-storage kmod-usb2 kmod-fs-ext2

with the ‘dmesg’ command you should now see your hardware in the kernel log.

From here I followed the Packages on external media guide from the openwrt wiki to use my usb stick for extra package space. Below is a summary of my command line commands.

mkdir -p /mnt/usb
mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt/usb
echo ‘mount /dev/scsi/host0/bus0/target0/lun0/part1 /mnt/usb’ > /etc/init.d/externalmount
chmod +x /etc/init.d/externalmount
ln -s /etc/init.d/externalmount /etc/rc.d/S60externalmount

Also the following lines are added to /etc/opkg.conf and /etc/profile :
Add

dest usb /mnt/usb

to /etc/opkg.conf and

export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/mnt/usb/bin:/mnt/usb/sbin:/mnt/usb/usr/bin:/mnt/usb/usr/sbin
export LD_LIBRARY_PATH=/lib:/usr/lib:/mnt/usb/lib:/mnt/usb/usr/lib

to /etc/profile.

Reboot your router and check if your media is mounted under /mnt/usb .

If all went well you can start installing packages

opkg -d usb install packagename

Important remark !
Depending on how much space you have left on your routers flash you may receive errors like : Only have 1016 available blocks on filesystem /mnt/usb/, pkg perl needs 1302 I believe this is because opkg looks at the needed disk space and checks your routers flash space and not the mounted usb media ! Even if you use the -force_space argument to the opkg command the package still fails to install. I found a dirty hack for this. Open the  /var/opkg-lists/snapshots file and search for the package you want to install. The next line that reads Installed-Size: 1117718 for example describes how much space the package needs once installed. If you make this number smaller than the available space on your routers flash memory, the opkg program no longer complains and installs your package.

You now have a base system that you can use for hundreds of purposes.
I will explain how i run misterhouse home automation software on my router in my next post.

6 Responses to “install openwrt 8.09 on asus WL-500g deluxe with usb media for extra space”

  1. How to install misterhouse on openwrt kamikaze 8.09 › bits4life Says:

    [...] Misterhouse is home automation software written in perl. Because it is written in perl it can run on any OS that has perl binaries so even on a small router that runs openwrt. If you don’t have openwrt already running on your hardware first follow my guide to install openwrt with USB media for extra space. [...]

  2. Vince Says:

    Thanks for this guide. You’re a lifesaver!

  3. Play With Free » OpenWrt: installation de packages sur un disque USB externe Says:

    [...] point de départ de ce tutorial vient du guide install openwrt 8.09 on asus WL-500g deluxe with usb media for extra space, complété de Ticket #4354 (closed defect: worksforme) qui donne le moyen de corriger le problème [...]

  4. Erik S Says:

    O have a small problem. I installed OpenWRT – works fine.
    I followed your steps above but i cannot mount the device.

    root@PA0ESH-2:~# mount: mounting /dev/scsi/host0/bus0/target0/lun0/part1 on /mnt
    /usb failed: No such file or directory

  5. Olivier Says:

    I use the script pivotroot describe in http://wiki.openwrt.org/oldwiki/usbstoragehowto
    With this script i can boot on flash, and after, I switch the root partition with my USB device
    It works really fine !

  6. san Says:

    thank you very much for this wonderful guide

Leave a Reply

*