What's new
  • 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!

How to clear NVRAM?

ANJ9686

Regular Contributor
I have Asus AC66U, and my speed keeps going up and down. Can anyone tell me how to clear NVRAM?

I never done this before, I tried Power on and WPS that never did anything except it reset the router.


Sent from my iPhone
 
What are you trying to accomplish with that?
In a terminal you can enter
nvram show to list all settings in the ram.
To save the long, long list enter
Code:
nvram show | sort > nvram.txt
this writes the file to /tmp/home/root
 
Btw resetting the router should clear nvram. That's why it is resetting.
 
Is my NVRAM right? Here a picture

6aju6ade.jpg



Sent from my iPhone
 
Looks OK.
Mine is: NVRAM usage 42340 / 65536 bytes
 
Last edited:
Reboot to factory specs clears the NVRAM.
It works only on April builds and later. There was a bug with clearing NVRAM on MIPSEL routers (N66U, AC66U, N16) before.

For older builds there is two steps workaround:

1) running mtd-erase -d nvram
2) switching router off by power button (not reboot!).

Otherwise, you'll get some garbage in NVRAM.
 
Last edited:
It works only on April builds and later. There was a bug with clearing NVRAM on MIPSEL routers (N66U, AC66U, N16) before.

For older builds there is two steps workaround:

1) running mtd-erase -d nvram
2) switching router off by power button (not reboot!).

Otherwise, you'll get some garbage in NVRAM.

Turning the router on while pressing the WPS button will also work, since this is handled by the CFE.
 
Last edited:
  • Like
Reactions: a5m
Hi ! I have AC66U. I don’t know what is the reason but now, not reset to factory settings

** YES MASTER! ** - RT-AC66U 380.70.1-HGG-RC2 Fri Jul 20 21:00:25 UTC 2018
admin@RT-AC66U-3B90:/tmp/home/root# mtd-erase -d nvram
Erasing 0x0 - 0xffff
"nvram" successfully erased.
admin@RT-AC66U-3B90:/tmp/home/root# reboot
 
Hi ! I have AC66U. I don’t know what is the reason but now, not reset to factory settings

** YES MASTER! ** - RT-AC66U 380.70.1-HGG-RC2 Fri Jul 20 21:00:25 UTC 2018
admin@RT-AC66U-3B90:/tmp/home/root# mtd-erase -d nvram
Erasing 0x0 - 0xffff
"nvram" successfully erased.
admin@RT-AC66U-3B90:/tmp/home/root# reboot
You're using the beta build of an unofficial firmware. :rolleyes: No one here can guess what changes the creator has made to it.
 
I tried the latest release of Asuswrt-Merlin RT-AC66U_380.70_0, but the result is the same..
p.s all ok only official firmware
 
https://www.snbforums.com/threads/faq-nvram-and-factory-default-reset.22822/
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 you will have to turn off the router, press the WPS button (on Asus routers), then turn on the router. Wait about 10 seconds, then release the WPS button.

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
  • Over SSH, you can run the "nvram erase" command.
  • Over SSH you can manually erase the nvram partition (do not use this method unless you know what you are doing! Erasing the wrong partition can permanently brick your router!) Run "mtd-erase nvram", followed by PHYSICALLY turning off then on the router. Do not use the reboot command.
 
I am no Asus rt firmware nor code expert, far from it. I had similar issues and looked for a way to free up unused and "cashed" NVRAM space to ensure router runs efficiently. Not sure why everyone suggests to flat out delete NVRAM ie reset when it is sufficient to clear the excessive use of it and the command you can run and even set it as a cron job is:

for line in `nvram show | grep =$ `; do var=${line%*=}; nvram unset $var; done; nvram commit

You can also create script and run it as a cron job. Code for the script would be (I am no scrpter so someone who is expert can advise you if there is a "cleaner" way):

#!/bin/sh
for line in `nvram show | grep =$ `; do var=${line%*=}; nvram unset $var; done; nvram commit
echo -e "\n"
exit 0

Save the script using any name for the file you like. Give it -rwxrwxrwx permissions and either run as a cron job (adding is using cru command) or by running the script manually as to ./scriptname

Hope this helps.
 
Similar threads
Thread starter Title Forum Replies Date
garycnew Asuswrt-Merlin Change Operation Mode Fails via NVRAM Variables Asuswrt-Merlin 15

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!
Back
Top