Running Debian on ASUS WL-500G deluxe

From lxadm | Linux administration tips, tutorials, HOWTOs and articles
Jump to: navigation, search

You can run Debian (mipsel port) on ASUS WL-500g Deluxe, ASUS WL-500g Premium, ASUS WL-700gE, Linksys WRTSL54GS (and probably on similar, mipsel-based routers). See also a separate page for running Debian on ASUS WL-500W.

ASUS WL-500g Deluxe is a small router with 200 MHz CPU, 32 MB RAM, 5 ethernet ports, wireless.

Its newer version, ASUS WL-500g Premium has a 266 MHz CPU. With these specs, they are easily capable to run a small web or mail server. Being totally silent (no fan, no hard disk) is a clear advantage.

There is also a model with a HDD, and 64 MB RAM - ASUS WL-700gE. It will run Debian as well, however, a custom OpenWrt build is required since it has only 2MB Flash, and a small userspace is required to partition and format the HDD before Debian is installed. It has also only been tested with a hand created Debian image created by debootstrap.

A nice thing about this is that you don't need to open your device (and connect via serial cable etc.), but also that you can run "pure" Debian (not in a chroot jail as suggested on some other pages).

Note that you will need an external storage, like a USB-stick or a USB hard disk.

Nice read, I just passed this onto a friend who was doing some research on that. And he just bought me lunch since I found it for him smile So let me rephrase that Thank you for lunch! Whenever you have an efficient government you have a dictatorship. by Harry S Truman. edgeccdedcaaggae


After you flash the kernel, write Debian to your USB device and configure the network, you can boot your ASUS to a fully-working Debian.

It doesn't matter which USB port you choose (unless you connect more devices).

You can log in via SSH, or consoles: USB or serial (check /etc/inittab to see console settings). If you didn't change the network settings, SSH listens on and (available via LAN or WAN interfaces, so check both before reporting problems).
The default password for the "root" user is "toor", and of course you are encouraged to change it.

More information

The base system is about 170 MB (it contains some other tools like ssh-server, mc or iptraf, and that's why it's slightly bigger than the minimal system).

Kernel has ext3 support compiled, to be able to boot from ext3-formatted devices.

If you want to gain some memory, you may comment out these lines in /etc/inittab:

T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
T1:23:respawn:/sbin/getty -L ttyUSB0 115200 vt100

It's only necessary if you connect using a serial cable (first line; router's serial port), or a USB-serial cable (second line; router's USB port), and normally that's not needed after you configured your system.

Moreover, if you want to connect as root using a USB-serial cable, add ttyUSB0 line to /etc/securetty file:

echo ttyUSB0 >> /etc/securetty

If you want to ensure that your USB-stick will live longer:

  • make all logs to be written into tmpfs, like /tmp/log
  • make sure the system will use swap as little as possible (echo "0" > /proc/sys/vm/swappiness)

You can move swapfile periodically. This way you ensure that you won't over-use the swap part of your USB-stick.
NOTE: all USB-sticks do wear-leveling transparently, so normally, it's not needed to move swapfiles around. On the other hand, you never know how good/bad the wear-leveling in your USB-stick is.

1. create new swapfile (16MB in example)- dd if=/dev/zero of=newfile bs=1024 count=16384; mkswap newfile;

2. swapon newfile;

3. swapoff oldfile

4. ... edit fstab accordingly

Swap is not too large usually, so you can create several 16-32MB swapfiles at once and activate next of them according to your need (e.g. once a month/season). Keep the old swap-files; if you create new ones only when needed, you could create new swapfile where some of the previous files used to be...

How it works

The trx image was made with OpenWRT buildroot, contains the kernel only.

When you power on your device, it boots the kernel.

Then the kernel executes, and starts the system from /dev/sda1 (usually, your USB-stick, or USB-HDD), which would be Debian in this case, but you can also start any other Linux distribution capable of running on mipsel (like Gentoo).

As seen in our .config download, this is currently configured via CONFIG_CMDLINE="root=/dev/sda1 rootdelay=10 console=ttyS0,115200"

NOTE that rootdelay=10 can still be too short, especially in the case of netconsole and verbose logging. Also note that the console= statement above may prevent init from loading due to unavailable working initial console issues (serial IRQ problems or so). IOW, better use something like root=/dev/sda1 rootdelay=25 noinitrd init=/sbin/init netconsole=@,@ debug

Building your own kernel

If you want to build your own MIPS kernel compatible with ASUS, follow these steps:

1. Download openwrt build environment (revision 6850 is stable, later ones may not be stable):

svn checkout --revision 6850

At the time I built the kernel image available for download here, I used revision 6850 from 2007-Apr-03.

2. Go to trunk/ directory, and select all the required tools:

make menuconfig

Make sure "Target System (Broadcom BCM947xx/953xx [2.6])" is selected and "Target Images" is set to "jffs2". Also, deselect almost all packages. As we want to use Debian, we don't need any OpenWRT packages. This will make our .trx image build faster; it'll be also smaller.

Leave one package, "Base system -> base-files", as it will be needed to build the .trx firmware (otherwise, .trx image will be "empty", and won't build).

3. Now, build all the tools needed for cross-compilation, and a (not yet configured) kernel:

make V=99

4. Configure the kernel as you want:

make kernel_menuconfig

5. Load the .config file (download below) as an Alternate Configuration File, and save it as .config.

6. Make a new image - start this command in trunk/:

make V=99

7. You will have new images in trunk/bin/

Now we have to build modules for our new kernel:

8. Remove .image and .modules in build_mipsel/linux/

cd build_mipsel/linux/
rm .image .modules

9. Go back to trunk/ directory and run make again (now it compiles also the modules we want)

cd ../..

10. Put modules temporary somewhere (INSTALL_MOD_PATH is where we want to temporary put modules)

cd build_mipsel/linux/
INSTALL_MOD_PATH=/temporary/path/ make modules_install

11. Now we have in /temporary/path/lib/modules/$our_kernel_version our modules and we have to copy them on the router in /lib/modules/

# ls /temporary/path/lib/modules/
kernel         modules.ccwmap  modules.ieee1394map  modules.isapnpmap  modules.pcimap    modules.symbols
modules.alias  modules.dep     modules.inputmap     modules.ofmap      modules.seriomap  modules.usbmap
# scp -r /temporary/path/lib/modules/ router_ip:/lib/modules/

12. Log as root on the router and adjust permissions

# chown -R root:root /lib/modules/

13. Flash the image as explained before and that's it

For a more detailed explanation of what the above steps are doing, see (in particular, the "Building openwrt" section)

ASUS WL-500g Deluxe notes

By default, only four LAN ports are enabled. WAN port is disabled.
To enable WAN port, add this command to your startup scripts:

robocfg port 0 stp none

You need to have robocfg command, you can get it in the download section.

ASUS WL-500g Premium notes

By default, only the WAN port is enabled. The four LAN ports are disabled (note: it may differ on different models[on mine no ports were enabled till following the first item]).

To enable the LAN ports, add these commands to your startup scripts:

robocfg switch disable
robocfg vlans enable reset
robocfg vlan 0 ports "0 5u"
robocfg vlan 1 ports "1 2 3 4 5t"
robocfg switch enable

If it doesn't work, try:

robocfg switch disable
robocfg vlans enable reset
robocfg vlan 0 ports "0 1 2 3 4 5u"
robocfg switch enable

Different vlan for each port: To configure multiple networks on the switch.


robocfg switch disable
robocfg vlans enable reset
robocfg vlan 0 ports "0 5t"
robocfg vlan 1 ports "1 5t"
robocfg vlan 2 ports "2 5t"
robocfg vlan 3 ports "3 5t"
robocfg vlan 4 ports "4 5t"
robocfg switch enable


Intarface eth0 is used like fallback if is not run or configured properly. than you can access from WAN or LAN1 (I'm not sure which)

auto lo
iface lo inet loopback
auto eth0 eth0.0000 eth0.1 eth0.2 eth0.3 eth0.4
iface eth0 inet static
   post-up /root/
iface eth0.0000 inet static
# LAN 1
iface eth0.1 inet static
# LAN 2
iface eth0.2 inet static
# LAN 3
iface eth0.3 inet static
# LAN 4
iface eth0.4 inet static

For these configuration steps to work, you must have the robocfg command, which is available in the download section.

See architecture description:

ASUS WL-700gE notes

Once debian starts it uses the fourth LAN port, robocfg hasn't been tested.

A custom OpenWrt build must be used initially. This is required to partition and format the hard disk. Partitioning and formatting tools will probably not fit in the 2MB of flash memory, These can be build as packages by the OpenWrt make script and copied over using netcat which is built into busybox. Similarly the Debian base system can be copied over using netcat and extracted in place. Remember to set a root password in Debian, (use chroot). To complete installation create a directory such as /hdd where the hard disk can be mounted, create a directory such as /hdd/flash_root where the OpenWrt / can be pivot'ed to and use a custom /sbin/init inside OpenWrt to mount the hdd, pivot and exec /sbin/init.



for module in ide-core aec62xx ide-detect ide-disk jbd ext3 switch-core switch-robo switch-adm diag; do {
    insmod $module
}; done
sleep 5s
mount -o ro "$boot_dev" /hdd
if [ -x /hdd/sbin/init ]; then
        . /bin/firstboot
        pivot /hdd /flash_root

        exec /sbin/init
        exec /bin/busybox init

More detailed robocfg/vlan settings

Please see for more detailed robocfg/vlan settings.

Resetting NVRAM from Debian

After flashing with my router is no longer reachable when in the "recovery state" (i.e., ping times out); however, debian still boots fine. I have to reset nvram from the working debian system in order to flash a new image. Keep in mind that although it worked for me, it could nonetheless brick your router.

In order to reset nvram you have to:

1. Boot your router with debian and log in as root.

2. Check where nvram is

# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00040000 00010000 "cfe"
mtd1: 007b0000 00010000 "linux"
mtd2: 006d0000 00010000 "rootfs"
mtd3: 00010000 00010000 "nvram"

3. Install "mtd-tools"

# apt-get install mtd-tools

4. Reset nvram

# flash_erase /dev/mtdX (X == device number of the "nvram" mtd area as seen by _you_,
_locally_, when doing cat /proc/mtd as shown above)
Erase Total 1 Units
Performing Flash Erase of length 65536 at offset 0x0 done

Nvram is clear now and you can flash your new image.

Linksys WRTSL54GS notes

Download "all kernel images" archive (from the "Downloads" section).

Inside, you will find the image for Linksys WRTSL54GS: openwrt-wrtsl54gs-2.6-jffs2.bin.


Currently, wireless doesn't work for boards with Broadcom mini-PCI. An updated kernel will be uploaded once the wireless is working in Kamikaze/OpenWRT.

Additional hardware

Go to additional hardware to see the list of additional hardware these routers were running with.


Go to downloads page.


  • openwrt-brcm-2.6-jffs2-64k.trx and openwrt-brcm-2.6-jffs2-128k.trx are not the same images as available on or other sites. It's a custom build, needed to boot Debian from /dev/sda1. If you download openwrt-brcm-2.6-jffs2-64k.trx or openwrt-brcm-2.6-jffs2-128k.trx from somewhere else, it will not boot Debian...

  • Can't connect... Network problems etc.

Add a startup script *after* the network is initialized (ex: edit /etc/rc.local).
In it, start some simple commands like:

ifconfig eth0 &>/eth0.txt
ifconfig -a &> /ifconfig.txt

You will see if the device has an IP address at all - just see those files on another machine. Also, check the logs etc.

You might want to add something like ping, too:

ping -I eth0 -c 100

and see with a network sniffer (like tcpdump or ethereal/wireshark) on another machine if you see any packets.

  • Try to connect the network cable to a WAN port, and if it doesn't work (i.e., you still can't connect), to any of LAN ports.
  • Are you sure you're connecting from the same subnet?

  • Did you run tune2fs with proper options?

  • Did you really create an ext3-formatted partition, and not some other filesystem? The device won't boot from a USB stick with ext2, or any other filesystem.

  • A serial cable is the best way to troubleshoot all problems. If you don't feel like opening your device and using a serial cable, you can use a USB-serial cable to connect to your device (it will only have any use if the device actually boots; you won't see any kernel messages while it boots).

Or simply make use of Documentation/network/netconsole.txt

  • Wireless is currently not supported.

Contact and support

If you have any questions or want to be notified about news, please subscribe to the mailing list on This is a list with very low traffic.

For general debian-mipsel info, please ask at debian-mips mailing list.

I only have ASUS WL-500g Deluxe, but I received emails from other people who confirmed they run Debian on other models, like WL-500g Premium. On the other hand, from time to time, I receive emails from people who have problems running Debian on ASUS WL-500g Premium.

If you want Debian supported on your favourite device, you could either:

  • donate me some hardware
  • borrow me hardware for a couple of weeks

I would be very happy to accept ASUS WL-500g Premium.

To make sure Debian is well supported on mipsel architecture, please participate in Debian Popularity Contest. To do it, install popularity-contest package:

# apt-get install popularity-contest