Sunday, June 27, 2010

Upgrade DD-WRT and Keep Installed Applications

The DD-WRT support for these new 11N Gigabit routers are still in early stage with new builds rolling out every one to two weeks. The old good "if its not broken then don't fix it" rule might not apply here and I suggest to stay with latest release if you have the time(and guts).

Upgrading a DD-WRT firmware with loaded software is pretty easy, considering the extra work we've done. Take the trouble not to mess with important system folders like /lib /usr and /bin and now its the reward time.

  1. Stop installed software
    Log in the router, rename the /mnt/optware.enable
    mv /mnt/optware.enable /mnt/optware.disable

    Then reboot the router. After rebooting, the router is back to standard DD-WRT with no extra load and ready for flashing.

  2. Upgrade firmware
    Get the new DD-WRT build, the name should be wzr-hp-g300nh-dd-wrt-webupgrade-MULTI.bin. Some suggests a hard reset before and after upgrading but I usually just select "Reset to Default Settings" during flash.
    After flashing, all settings will be erased and then you have to start over again.

  3. Set the router
    Set the router as usual. Here is a quick list for additional setup, all are covered in other posts, I just put these together for easy reference.

    Enable SSH and USB Support. Details here, Step 2.
    Customized startup script. Details here, Step 10.
    Disable DD-WRT's NTP Client if you're about to use local time. Details here, Step 1.
    Disable built-in FTP server(should be off by default). Details here, Step 1.

    Then some nvram variables:

    #use local time. details here, step 3. Change it accordingly
    nvram set time_zone=PST8PDT,M3.2.0,M11.1.0
    move dd-wrt's web admin to another port. Details here, step 1
    nvram set http_lanport=88
    nvram commit

    After that, reboot the router.

  4. Update writable /etc and re-enable installed apps
    After reboot, login the router and run:

    cp -a /etc/* /mnt/etc/
    mv /mnt/optware.disable  /mnt/optware.enable

    The first line is very important. It's for synchronizing our the customized /etc folder with the new firmware's /etc folder. Forget to do so will break the web management interface!

    Somewhat modified, the files in /etc folder are only added(like /etc/TZ) or dynamically updated(the adduser script), so it's safe to overwrite the /etc folder with new contents and all our work is kept intact. After that, reboot the router, and you should have a new DD-WRT with all previously installed software running.

  5. Fix the broken web interface
    You'll get this error ONLY if you forget to update the /etc folder, see Step 4 above. If this ever happens:
    SSH or telnet login the router, run

    mv /mnt/optware.enable /mnt/optware.disable

    the web interface should be back after rebooting, then follow Step 4.

    If the web interface is messed and you can't login from PuTTY, unplug the USB disk and power cycle the router. Then manually mount the USB disk(details here, step 2 and 6) and update /etc folder following Step 4.


ccdoggy said...

Works perfect! thanks!

Ictinike said...

Lovely stuff.. Followed your guide earlier on 14896 and flashed 14929 and lost the web interface :(

Saddest part is I formatted the USB drive and re-did everything in the prior steps to re-install everything and all I had to do was this. Doh! :)

Micheal mark said...

Marvelous work.Just wanted to drop a comment and say I am new to your blog and really like what I am reading.
recover data from a formatted hard drive

Router Login said...

this is really useful to me
Router Login not working
Routerlogin admin page
Routerlogin Net

Post a Comment