Skip to content
This repository has been archived by the owner on Feb 21, 2019. It is now read-only.

Limitations on Routers with 16MB RAM

leitec edited this page Dec 13, 2014 · 13 revisions

In Attitude Adjustment, 16MB of RAM turns out to be the bare minimum for a functioning system and leaves very little room for anything extra. While basic routing, IPv6 and wireless support are possible, the LuCI web interface and pretty much any large application (like OpenVPN) are definitely not possible. The system first slows down and then crashes as it runs out of RAM.

Important: As of mid-June '14, a simple set of improvements backported from the main OpenWrt trunk allow changing the squashfs block size. Using a smaller block size gives the system a bit more room to breathe under low-memory situations and has made quite a difference. On a WRT100, I was able to run IPv6 and OpenVPN simultaneously with WiFi enabled without running out of RAM. LuCI is still not possible, though.

What to do if the system runs out of RAM

In case the system runs out of RAM and whatever change that pushed it over the line is committed, odds are the system will run out of RAM again after a reboot. Booting into failsafe mode is a way to recover. You can telnet in and either reset settings (run "firstboot") or mount the jffs2 partition and remove the problematic setting. See failsafe mode instructions on the OpenWrt wiki for more information.

Triggering failsafe mode: On the routers supported by this fork, the reset or WPS buttons trigger failsafe mode in the beginning of the boot process. This is just a few seconds after the router powers up. Repeatedly pressing the button should do the trick if desperate. The power LED will rapidly flash once failsafe is activated.

Flashing new firmware

Trying to flash a new firmware image while the system is running is likely to cause it to crash. Just copying the image into /tmp is enough to run out of RAM, before sysupgrade even comes into play. The easiest way around this is to set up an HTTP server on a machine on your LAN (and it must be on the LAN, not on the Internet) and use sysupgrade's built-in HTTP download. This is sort of backwards from the factory firmware upgrade experience, but it works well.

Something like sysupgrade -v http://192.168.1.100/openwrt-ramips-rt288x-wrt110-squashfs-sysupgrade.bin does the job (replacing the IP and filename with your values, of course). I use darkhttpd to quickly create an HTTP server for this.

There's also an elaborate way to do this without HTTP by booting into failsafe mode:

  1. Use sysupgrade -b to create an archive of your settings and transfer this to your PC
  2. Reboot into failsafe mode (see above)
  3. Telnet into the system
  4. Use sysupgrade to flash a new image and settings archive, either via HTTP from your PC or using netcat (nc)
  5. Reboot and allow the system to come back up (solid power LED)

Netcat is a very easy way to do this. You can create a listen socket on the PC, and use the limited BusyBox nc on the router to connect and transfer the files. A full process looks something like this, provided the PC's IP address is 192.168.1.100 and the system's firewall allows inbound TCP port 1234:

(terminal 1) user@pc:~$ ssh root@OpenWrt
(terminal 2) user@pc:~$ nc -l 1234 > settings.tar.gz
......
(terminal 1) root@OpenWrt:~# sysupgrade -b - | nc 192.168.1.100 1234
(terminal 1) root@OpenWrt:~# reboot
<trigger failsafe mode>
......
(terminal 1) user@pc:~$ telnet 192.168.1.1
(terminal 2) user@pc:~$ nc -l 1234 < openwrt-ramips-rt288x-wrt110-squashfs-sysupgrade.bin
(terminal 1) root@(none):~# nc 192.168.1.100 1234 > /tmp/firmware.bin
(terminal 2) user@pc:~$ nc -l 1234 < settings.tar.gz
(terminal 1) root@(none):~# nc 192.168.1.100 1234 > /tmp/settings.tar.gz
(terminal 1) root@(none):~# sysupgrade -v -f /tmp/settings.tar.gz /tmp/firmware.bin
<wait for flash, reboot and full startup>

I've used this method many times with success. It should also be possible to streamline slightly by mounting the JFFS2 while in failsafe, and I have used this a few times, too:

<reboot router into failsafe mode>
(terminal 1) user@pc:~$ telnet 192.168.1.1
(terminal 2) user@pc:~$ nc -l 1234 < openwrt-ramips-rt288x-wrt110-squashfs-sysupgrade.bin
(terminal 1) root@(none):~# mount_root
Switching to jffs2...
(terminal 1) root@(none):~# nc 192.168.1.100 1234 > /tmp/firmware.bin
(terminal 1) root@(none):~# sysupgrade -v /tmp/firmware.bin
<wait for flash, reboot and full startup>

This is slightly easier due to only transferring one file in one direction, but I tend to use the first to have a backup copy in case something goes wrong.