Asuswrt-Merlin Firmware Upgrade

Introduction

As of early March 2018, the current stable Asuswrt-Merlin firmware release is version 384.3.  My RT-AC88U is still on the Asuswrt-Merlin 380.69_2 firmware.  The 380 code base is gradually being phased out.  I am several versions behind.  This article will show you how to perform the firmware upgrade from one firmware code base to another.

I have the jffs partition enabled containing user scripts and settings, along with a 2.0 USB drive containing entware, AB-Solution, Skynet, and the NVRAM backup/restore utility.  Backing-up this information prior to the firmware upgrade is key to ensuring a successful upgrade.  Performing the back-up will allow for a faster update of key router settings and data after the upgrade while also providing the ability to restore to the previous settings if necessary.

Consult the Change log

As with all firmware upgrades, you need to first consult the Change Log before performing the upgrade.  A factory default reset is recommended for the upgrade from the 380 to the 384 code base.

It’s generally recommended to do a factory default reset when coming from 380 to 384/NG

If you are jumping more than 2-3 revisions, it’s recommended to perform a factory default reset.  You can always try without performing a factory default reset.  However, at the first sign of an issue, you should be prepared to perform a factory default reset followed by manually re-entering the configuration.  A factory reset will clear out any default nvram values left over from the prior firmware version.

Consult the Forum Posts

You should also read the Asuswrt-Merlin forum posts in the Small Net Builders forum site to learn of issues other people are reporting before deciding to upgrade.

Backing-up nvram values 

I like to perform a manual back-up of all nvram values and a back-up of static DHCP address assignments.

You have the option of saving the nvram values to a file on the jffs partition or USB drive.  If you save the file to the jffs partition, you will need to download the file to your PC or laptop as the jffs partition will get wiped clean when you perform a factory reset.  I recommend you use the Back-up existing router configuration and jffs partition instructions in the next section to backup the jffs partition after you have saved the DHCP static list.

Display Static DHCP list on the screen:
nvram get dhcp_staticlist

In the examples below, I am saving the nvram values to a file in the AC88U partition located on my USB drive.  Or, you can save the nvram values to a file in the jffs partition as previously mentioned.  To do so, replace the path examples below from /tmp/mnt/AC88U to /jffs (e.g. nvram show | sort > /jffs/nvram_settings.txt).

Store all nvram values to a file:
nvram show | sort > /tmp/mnt/AC88U/nvram_settings.txt

Store the dhcp_staticlist nvram value to a file:
nvram get dhcp_staticlist > /tmp/mnt/AC88U/dhcp_staticlist.txt

Re-enter an nvram setting:
In a text editor, open the file containing the DHCP nvram values.  Copy the text to the clipboard and close the editor.  Use the syntax below to restore the DHCP values by copying the text saved in the clipboard between the quotes.
nvram set dhcp_staticlist=”values_previously_saved”
nvram commit

If moving from the 380.x to 384.5 code base, you should also check the length of dhcp_staticlist using the command:

nvram get dhcp_staticlist | wc -m

The 384 code limits the total length of dhcp_staticlist to 2999 characters.  As a result, the update of dhcp_staticlist will fail if it exceeds the 2999 character limit.  A workaround is to manually configure these in dnsmasq instead of on the Web GUI.  Or, do that for just a few of them to reduce the 2999 character limit used by the Web GUI.   I recommend adding the leases to /jffs/configs/dnsmasq.conf.add.  The format is below.  The 1440 is the lease time.

dhcp-host=49:EF:0C:24:7F:16,D-Link-AP,192.168.2.10,1440
dhcp-host=11:20:AE:5E:86:63,Security-Camera-DVR,192.168.2.200,1440
dhcp-host=94:C9:B2:5D:F5:04,D-Link_Switch,192.168.2.201,1440

You can validate that dhcp_staticlist was updated properly by typing:

nvram show | grep dhcp_staticlist or nvram get dhcp_staticlist

If you use a SSH Server Public Key for SSH session, navigate to Administration > System and save the key to a text file so you can restore it after the firmware upgrade.  Otherwise, you will have to generate new key pairs.

Back-up existing router configuration and jffs partition

Before the 382 code base, I used the NVRAM backup/restore utility to back-up the jffs partition and router system configuration.  However, the utility has not been updated to support firmware migrations from the 380 to the 384 code base.  You can still use the utility to back-up the 380 code base system configuration and jffs partition.  You can also use the back-up and restore utility available in the firmware.

From the Advanced Settings navigation panel, go to Administration > Restore/Save/Upload Setting tab.

To back-up the current system settings, click Save, navigate to the folder where you intend to save the file and click Save.  The router configuration back-up file created using this method should only be used with the firmware version it was created from.  You should not use the back-up with another version of firmware.  Instead, you will need to enter the settings manually.

To back-up the jffs partition, click Save, navigate to the folder where you intend to save the file and click Save.

Another good practice is to take screen shots of any settings you may need to refer to when performing the configuration of the new firmware.  I use the snipping tool available in Windows 10 to save the screen shots to my hard drive.   You can also print the web page as a PDF document.

Back-up jffs partiton using SFTP

Even though I backed up the jffs partition using the Asus backup utility, I will also use an SFTP session in MobaXterm to download a copy of the jffs partition to my hard drive.   

Navigate to the top level of the directory structure.  Select the jffs directory and drag it to the desired location on your hard drive.

Upgrade the Firmware

Download the firmware from the Asuswrt-Merlin site.  After the download, unzip the file to a folder on your hard drive.  

Safetly remove any USB devices attached to the router 

It is highly recommended to remove any USB devices attached to the router before flashing firmware to free up system memory and prevent damage to the USB device.

Navigate to Network Map and click on the USB icon. 

Select the Remove button for the Safely Remove disk option:

After the USB device has been safely removed, go to Administration > Firmware Upgrade tab.

From the Firmware Upgrade page, click Browse to locate the firmware file.  Click Upload to upgrade the firmware.

Wait about 3 minutes for the firmware upload to complete.

Manually power cycle the router when the firmware upgrade has completed.

On your web browser, manually key in the wireless router’s default IP address or enter http://router.asus.com.

Navigate to Administration > Restore/Save/Upload settings tab.

Select Restore

Select OK to continue

After the router reboot has completed, on your web browser, manually key in the wireless router’s default IP address or enter http://router.asus.com.

Use the Configuration Wizard to configure the WAN connection, router administrator name and password, and the wireless SSID and password.

Navigate to the LAN > LAN IP tab and enter the IP address for the router if you want to change it from the default 192.168.1.1.  Select Apply. You will get logged off since the router’s IP address has changed.

On your web browser, manually key in the wireless router’s default IP address or enter http://router.asus.com.

Navigate to the LAN > DHCP Server tab.

Enter the IP Pool Starting and Ending address for the dynamic DHCP IP address assignments.  Select Apply.

Navigate to Administration > System

In the Persistent JFFS2 partition section, select Yes for Format JFFS partition at next boot and Enable JFFS custom scripts and configs

In the Service section, Enable SSH field, select LAN only

If you saved a copy of the SSH Server Public Key, paste it into the Authorized Keys text box.

Apply settings.  Then, reboot the router.

On your web browser, manually key in the wireless router’s default IP address or enter http://router.asus.com.

Navigate to Administration > Restore/Save/Upload Setting tab.

Select the Browse button and navigate to the location of the jffs backup file.  Select Upload.

Plug the USB drive containing entware, AB-Solution, Skynet and a back-up of the jffs partition and nvram values

Logon into an SSH session.

Restore the DHCP Static IP Address assignments using the nvram method documented in the Backing-up nvram values section.  Or, manually enter the assignments by navigating to LAN > DHCP Server tab.

Reboot the router.  After the reboot, you can use the Web GUI to configure other settings of your ASUS Wireless Router.

Open an SSH session to check that other services you may use, such as entware, AB-Solution and Skynet, are running in good order.

Summary

The key to a successful upgrade is doing the research prior to the upgrade, backing up the router configurations, jffs partition and nvram settings, and taking screen shots of key settings.  Even though a factory reset is not required for all firmware upgrades, always be prepared to perform a factory reset at the first sign of problems.  I have had to do this for several minor firmware upgrades to resolve OpenVPN Client performance issues.  So, be prepared!  If you have issues, ask for help in the Asuswrt-Merlin Support forum.

 

4 thoughts on “Asuswrt-Merlin Firmware Upgrade”

  1. This is all very helpful, one additional suggestion is to power cycle the router after the upgrade (not just reboot). After both recent updates 380 to 384 and 384 to _2, I was unable to access the router UI from any device connecting wirelessly until power cycle was performed.

    1. Thank you for the feedback. I updated the blog post with instructions to manually power cycle the router rather than rebooting the router after performing the firmware upgrade. A manual power cycle of the router after a firmware upgrade is the recommendation of RMerlin, the author of Asuswrt-Merlin firmware.

  2. Thank you for the useful post.
    On the subject of save/restore static DHCP list, do you:
    1) execute the nvram get command to copy on [any folder of] the usb drive
    2) unplug usb drive, proceed with flashing new fw etc… and,
    3) once the new fw is flashed, mount the same usb drive and simply execute commands
    a) nvram set dhcp_staticlist=”values_previously_saved”
    b) nvram commit
    without further specifying paths/filenames? or do you mean by “value_previously_saved” the full path and filename of the backup?
    Thank you

    1. Thank you for the feedback. I have multiple partitions on my USB drive and saved my DHCP list using the command “nvram show | sort >/tmp/mnt/AC88U/nvram_settings.txt”. However, some may prefer to save the DHCP list to the jffs partition as they may not have a USB drive. If this is the case, saving the DHCP list to the jffs partition is recommended. And it needs to be saved prior to taking the backup of the jffs partition so the file is available when jffs is restored from backup after the firmware update has completed. I have revised the blog post. I hope this update will clarify the process to restore DHCP list.

      For the restore process, open the file containing the DHCP nvram values in a text editor. Copy the text to the clipboard and close the editor. Use the syntax below to restore the DHCP values by copying the text saved in the clipboard between the quotes.
      nvram set dhcp_staticlist=”values_previously_saved”
      nvram commit

Comments are closed.