What's new

[FAQ] NVRAM and Factory Default Reset

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

Status
Not open for further replies.

RMerlin

Asuswrt-Merlin dev
Staff member
A lot of questions related to nvram keep popping up on the forums, usually always the same coming back again and again. This post is an attempt to at least clear up a lot of recurring questions.


What is nvram?
NVRAM stands for Non-Volatile Random Access Memory. It's a small portion of the router's flash memory that's usually between 32 KB and 128 KB in size (depending on the router model), and which contains all the router settings. This includes both some low-level settings that are automatically managed by the router (such as power gain per antenna, GPIO addresses of hardware features, etc...), temporary storage, and user-configured settings.


Default settings - where do they come from?
The first time a router boots, it will start by copying various default settings from the bootloader (or CFE in the case of Broadcom's routers). Once it starts booting the firmware itself, another set of default settings are taken from the firmware, and written back to nvram. This is why in certain cases it's very important that you do a factory default reset (more on this below).


What happens if I run out of nvram space?
Best case scenario: your router simply stops storing any settings change you make. Worst case scenario: the nvram content gets corrupted, router crashes, and you are forced to do a factory default reset, and start all over from scratch to be able to once again boot the router.


Why do I sometime need to do a factory default reset?
In addition to those user-entered settings, there's all those system level settings I previously mentioned. Sometimes, the manufacturer will need to change some of those low-level settings, either to resolve an issue, or to adapt to a newer wireless driver that they started using.

If you fail to do a factory default reset, then your router will still have the old values, and it will keep using them. That can lead to performance issues (especially in changes related to the wireless driver), or flat out odd behaviour (if one of the settings no longer works the same way as before).


Can I just restore my saved settings after I do a factory default reset?
No. The idea behind a factory default reset is to have your router start using the NEW default values. If you restore your saved settings, you will overwrite those new values with the old ones, and you are back to square one.

This is similar to having a PC with a corrupted Windows installation. If you reformat, and immediately after you restore a Ghost/TrueImage/Clonezilla backup on top of the reformatted Windows, you are back to where you were before you did all that work.


Factory default reset: before, or after flashing?
Since the goal is to use the NEW default values that are included in the NEW firmware, the factory default reset must be done while the NEW firmware is already flashed. Doing so before flashing will leave you running the OLD default values.


How do I do a factory default reset?
Multiple ways to do so, which will depend on your particular situation.

If your router fails to boot due to corrupted/invalid nvram settings, then follow Asus's documentation (varies between models):

https://www.asus.com/US/support/FAQ/1039074

If the router is booting correctly, then you can use any of the following:

  • While router is running, press the reset button for about 5 secs, then release it. Router will then reboot.
  • From the webui, on the same page where you can save/restore saved settings, there is a button to restore factory default values


Any way to ease the pain of reconfiguring after a factory default reset?
A few methods:

  • Note down the important settings, using screenshots, and then reconfigure the router using these screenshots as a reference.
  • Keep a text-based backup of all your settings, and manually restore the important settings over SSH/telnet.


How to I use get a text-based backup?
Connect to your router over SSH/telnet, and run the following:

Code:
nvram show | sort

If you have a USB disk plugged as /mnt/sda1/, then you can save the output to a text file:

Code:
nvram show | sort > /mnt/sda1/settings.txt


How do I restore a specific setting?
If you noted down a particular setting (or have a complete text dump of them), the syntax would look like this example:

Code:
nvram set dhcp_staticlist="what is saved in your text file output"
... do all others nvram set here ...
nvram commit


When do I need to do a factory default reset?
The first rule is to check the changelog of the firmware you are about to flash. If for a particular reason this specific firmware release requires one, it will be mentionned.

Also, if jumping more than one revision, check the changelog of past release. If going from 376.40 to 376.45, and 376.43 required a factory default reset, then you must also do so with the 376.45 flash.

As a general rule, if you are jumping more than 2-3 revisions, it's often safer to do a factory default reset. If you want to try out without doing a factory default reset, go ahead and try it. But at the first sign of problem, be prepared to do one.


What are those saved config files for if I can't reuse them?
Those are backups. They are still very useful for the following scenarios:

  • When trying to resolve an issue by making a lot of random changes, and you want to be able to revert back to your original setup
  • If a bug, corruption issue or a power surge caused your router to lose all of its configuration, you can restore it
  • Having 2 or more alternative configurations that you want to easily switch between (personally, almost all my routers have a _Development and _Production copy of my settings, based on whether the router is fronting my Internet connection, or sitting behind another router).
 
Last edited:
Status
Not open for further replies.
Similar threads

Similar threads

Support SNBForums w/ Amazon

If you'd like to support SNBForums, just use this link and buy anything on Amazon. Thanks!

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top