What's new

Low NVRAM.. despite factory defaulting etc

  • 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!

Thanks! That worked: 55657 / 65536 bytes, reduced size by 9k by using the following single line script:

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

after it completed, ran nvram commit a second time by itself and refreshed screen and shows the 9k reduction! But, once rebooted, nvram goes back to bloat and flashing warning!

This may be a stupid question, but can the memory be upgraded?
 
This may be a stupid question, but can the memory be upgraded?

This is a software limitation. Not sure why Asus isn't increasing the size of the nvram partition on that model, probably because they don't want to put their customers through having to require a factory default reset.
 
dumb.......I would be more than happy to manually re-config the router in order to eliminate this problem once and for all! Why don't they post the fix and leave it up to the purchaser to decide......at least offer us a fix!
 
dumb.......I would be more than happy to manually re-config the router in order to eliminate this problem once and for all! Why don't they post the fix and leave it up to the purchaser to decide......at least offer us a fix!

Because they can't make it optional.
 
I just discovered this thread and this command is AWESOME!!!! I went from 60312 of NVRAM used on my AC-3200 down to 50761.....thanks so much!

So since this command needs to be rerun after an upgrade, I'm guessing that I could run into issues where after an upgrade, my NVRAM is maxed out, since I'm so close to being "full" before running this. What would happen then, would I have to reset to defaults (which I do sometimes anyway) or could I reach a point where I can't upgrade to the latest version?

Just curious and thanks again for this tip!
Stach
 
This is usefull for many users, but be aware: Before clearing names, I would propose one should first check what will be cleared! Namely this command searches for the lines ending in =. I just run a check on two of my routers, and runing this command would damage:

sshd_hostkey=AAA...ZE=
sshd_dsskey=AAA...w==

which do indeed contain data, but the data (the keys) themselves end in = (and this command would write them back without the final = char). Not sure that would be a good idea :)

So, before this little cleanup, I would propose to first check what will be removed (or damaged) and be prepared to fix errors (scroll back and if variable name is not ending in = but in some other text, that must not be touched).
Code:
nvram show | grep =$

Keep in mind that on other routers there may be different items ending in = which should not be deleted / damaged. Probably a good idea to first copy such items and restore them afterwards manually.

In cases similar to mine, where I have a problem with two quite long keys, I would propose a simpler solution: limit the length of the string so change applies only to shorter strings than the given number (40 - in my case, 35 would also work but 30 would not be enough). But, this may not be an universal solution for everyone and I do not propose anyone blindly doing this. First check what will be removed or modified!

First, I would do a test to find the needed length:
Code:
for line in `nvram show | grep =$ `; do var=${line%*=}; [ ${#line} -lt 40 ] || echo $var; done

Whatever this command spits out, will not be affected by the modified cleanup with the next command (use the number you found with the previous command here too, instead of 40):
Code:
for line in `nvram show | grep =$ `; do var=${line%*=}; [ ${#line} -lt 40 ] && nvram unset $var; done
If now you run
Code:
nvram show | grep =$
you should see only the (in my case two) items which were not to be impacted.

On one of my routers, before and after numbers are:
size: 55068 bytes (10468 left)
size: 45773 bytes (19763 left)

Do not forget nvram commit if all was done well. I would not append this blindly and automatically to the above command. Let's ignore improper quoting style, it should work like this well.

As I was curious how long these keys of mine were, I may also add it here: it may be interesting to check the sizes of the longest NVRAM variables, this fills my screen nicely:
Code:
nvram show | awk -F= '{printf "%4s %s\n", length(), $1}' | sort -nr | head -n22
 
Last edited:
Couldn't a compression algorithm be applied to the nvram partition?
 
This is usefull for many users, but be aware: Before clearing names, I would propose one should first check what will be cleared! Namely this command searches for the lines ending in =. I just run a check on two of my routers, and runing this command would damage:

sshd_hostkey=AAA...ZE=
sshd_dsskey=AAA...w==

which do indeed contain data, but the data (the keys) themselves end in = (and this command would write them back without the final = char). Not sure that would be a good idea :)

So, before this little cleanup, I would propose to first check what will be removed (or damaged) and be prepared to fix errors (scroll back and if variable name is not ending in = but in some other text, that must not be touched).
Rather than manually repairing errors caused by the script, just change the script to ignore lines that contain multiple equal signs. This will do it:
Code:
for line in `nvram show | grep '^[^=]*=$'`; do var=${line%*=}; nvram unset $var; done; nvram commit
 

Latest 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