What's new

User NVRAM Save/Restore Utility (R26.2)

  • 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.
My pleasure....but I forgot the most important advice....

- after you are done, take a run through the gui pages and make sure everything looks reasonable!:)

John;

Your utility worked beautifully as far as I can tell.

Thanks again for making it available to us!
 
Yeah this is a incredibly helpful and time-saving utility. Add my voice to those asking for a sticky or given the concern about too many stickies a mention and link to it in the wiki.
 
I've created a Wiki entry and added it to the index under 'Misc HowTo and Guides'

Thanks again to all for the feedback.
 
Does
Code:
ls -l
show the file with the correct permissions?

If you copied the file off, then back, you may have lost the correct permissions.
In the directory with the file:

Code:
chmod a+rx nvram*.sh

I didn't copy it off but will check it when I get home. I was using Putty to access the router but that shouldn't be an issue.
 
A wee little thing, but a WPA2 key I was using had a "$" in it. The exported fine, but when it was reimported the $ and everything after were deleted. I assume because it was a special character.

Along the way I also edited the outputted script to reorder the static IP list.
 
A wee little thing, but a WPA2 key I was using had a "$" in it. The exported fine, but when it was reimported the $ and everything after were deleted. I assume because it was a special character.

Along the way I also edited the outputted script to reorder the static IP list.

Wow....thanks for the report on the "$". I checked and that's the only special character that behaves that way...but will work correctly if you escape the character. I'll put in a fix.

Code:
admin@AC68R-06650:/tmp/home/root# nvram get test
admin@AC68R-06650:/tmp/home/root# nvram set test="xxxx$yyyy"
admin@AC68R-06650:/tmp/home/root# nvram get test
xxxx
admin@AC68R-06650:/tmp/home/root# nvram set test="xxxx\$yyyy"
admin@AC68R-06650:/tmp/home/root# nvram get test
xxxx$yyyy

Regarding the sorting of the various list type of parameters, I don't think I'm going to try and do anything special there and just leave that for the users to change as they see fit.
 
I ran the backup and it created the file. When I went to restore I ran the file nvram-restore-20141127-5AD7.sh it told me file not found. I even copied the files name and pasted and same issue. Any ideas?

I have the exact same problem here, have you solved it yet?
 
I have the exact same problem here, have you solved it yet?

Sorry you are having a problem. Here are some things to check (assuming you are using the QuickStart guide).

First, make sure the file actually exists and has the correct permissions by entering 'ls -l' on the router (without the quotes). You should see something like this....

Code:
admin@AC68R-00000:/mnt/ASUS# ls -l
-rw-r--r--    1 admin    root          5062 Dec  3 21:35 QuickStart-linux.txt
-rw-r--r--    1 admin    root          5161 Dec  3 21:34 QuickStart-win.txt
-rwxr-xr-x    1 admin    root         24757 Dec  4 10:09 nvram-restore-20141204-E0F0.sh
-rwxr-xr-x    1 admin    root          3231 Dec  3 14:30 nvram-save.sh
-rw-r--r--    1 admin    root         12680 Dec  3 13:56 nvram.ini

In this example the router mac bytes are E0F0. Note the restore file exists and has 3 x's in the permissions. If the file doesn't exist, please re-run the save portion and capture the output. If the x's aren't present, run

Code:
chmod a+rx nvram*.sh

If that's all OK, open the file in the 'vi' editor, and you should see this (abbreviated some lines with ....)

Code:
admin@AC68R-00000:/mnt/ASUS# vi nvram-restore-20141204-E0F0.sh

#!/bin/sh

# generated script to restore user nvram settings

echo "Restoring [System - Basic]"
nvram set time_zone_dst="0"
nvram set time_zone="MST7_2"
nvram set http_passwd="xxxxxxxxxx"
nvram set http_username="admin"
nvram set jffs2_on="1"
nvram set jffs2_format="0"
nvram set btn_ez_radiotoggle="0"
nvram set ntp_server0="time-a.nist.gov"
nvram set telnetd_enable="0"
nvram set sshd_enable="1"
nvram set sshd_forwarding="0"
....

- nvram-restore-20141204-BC88.sh 1/635 0%


If the file looks like this (with the ^M), it means at some point it was edited with a non-Linux editor and will give an error. Please re-run the save portion of the utility to recreate it.

Code:
#!/bin/sh^M
# generated script to restore user nvram settings^M
^M
echo "Restoring [System - Basic]"^M
nvram set time_zone_dst="0"^M
nvram set time_zone="MST7_2"^M
nvram set http_passwd="xxxxxxxxxx"^M
nvram set http_username="admin"^M
nvram set jffs2_on="1"^M
nvram set jffs2_format="0"^M
nvram set btn_ez_radiotoggle="0"^M
nvram set ntp_server0="time-a.nist.gov"^M
nvram set telnetd_enable="0"^M
nvram set sshd_enable="1"^M
nvram set sshd_forwarding="0"^M

Enter
:q
to exit the vi editor

Hope this helps. Please let us know what you find....
 
Sorry you are having a problem. Here are some things to check (assuming you are using the QuickStart guide).

----cut----

Hope this helps. Please let us know what you find....

Thanks for your help John, unfortunately it is still not working.
I have indeed been following the QuickStart guide.
The file does actually exist and seems to have the correct permissions.
I have opened the file in the 'vi' editor and it seemed OK.

After flashing the new firmware I tried to restore the settings but all I get is:
-sh: nvram-restore-20141204-0480.sh: not found

However, when I run the script to save the file and immediately thereafter (without flashing the new firmware) run the script to restore it does work.
So once the new firmware is in place, running the script to restore no longer works.
 
After flashing new firmware try either of the these approaches

Use the full path to the script which assumes that the USB stick is named as per the QuickStart guide

/mnt/ASUS/nvram-restore-20141204-0480.sh

or to run the script in the current working directory use ./

cd /mnt/ASUS/
./nvram-restore-20141204-0480.sh
 
After flashing the new firmware I tried to restore the settings but all I get is:
-sh: nvram-restore-20141204-0480.sh: not found

However, when I run the script to save the file and immediately thereafter (without flashing the new firmware) run the script to restore it does work.
So once the new firmware is in place, running the script to restore no longer works.

Do you change the login id from 'admin' to something else? If so, try changing just that one item in the gui along with the telnet setting before trying the restore.
 
After flashing new firmware try either of the these approaches

Use the full path to the script which assumes that the USB stick is named as per the QuickStart guide

/mnt/ASUS/nvram-restore-20141204-0480.sh

or to run the script in the current working directory use ./

cd /mnt/ASUS/
./nvram-restore-20141204-0480.sh

Thank you very much, that worked!
 
After flashing new firmware try either of the these approaches

Use the full path to the script which assumes that the USB stick is named as per the QuickStart guide

/mnt/ASUS/nvram-restore-20141204-0480.sh

or to run the script in the current working directory use ./

cd /mnt/ASUS/
./nvram-restore-20141204-0480.sh

Interesting.....it works with or without the path in the current directory on my fork release (374.43 base) and I didn't change the PATH var. Maybe a change in the later releases. I'll update the QuickStart to include the path.
Thanks for figuring it out.
 
Update to....

Version 6
- save/restore correctly handles '$' in nvram variables
- Update QuickStart.txt to include current path in commands - thanks to longstaff

Thanks!
 
I have the exact same problem here, have you solved it yet?

That was good someone else was having an issue like I did I didn't get a chance to test it as I was sick as hell after my post. Don't know why I didn't think to try using the full path to the file but makes sense.
 
After flashing new firmware try either of the these approaches

Use the full path to the script which assumes that the USB stick is named as per the QuickStart guide

/mnt/ASUS/nvram-restore-20141204-0480.sh

or to run the script in the current working directory use ./

cd /mnt/ASUS/
./nvram-restore-20141204-0480.sh

Hello
Here it is a little trick that I use in my shell scripts to be sure that they always run in their directory besides how you start them
Few lines at the beginning:

#!/bin/sh
BASEDIR=`dirname $0`
cd $BASEDIR

and there you go , no matter how you run the script (full path or ./ or any other way) it runs in the same directory where the script is saved.

So i added them to nvram-save.sh and modified the following lines in nvram-save.sh

echo "#!/bin/sh" >$outfile
echo "BASEDIR=\`dirname \$0\`">>$outfile
echo "cd \$BASEDIR" >>$outfile
echo >>$outfile

I let John (thanks again for your great idea and for how you mantain the script) decide if to adopt this solution or not

BR
Ocram
 
Last edited:
I've recently updated to 3.0.0.4_376.49_alpha2 and cleared nvram and restored some settings via your script. Very useful. Thanks for this script.

I had the wireless sections commented out, because I wanted to start from scratch there, and I noticed WPS was enabled by default, so I turned WPS off from the web interface and compared nvram dumps from before and after changing the setting, by comparing these files:
Code:
nvram show | sort > /tmp/before
nvram show | sort > /tmp/after

Three nvram values changed when toggling the WPS button:
wl0_wps_mode
wl_wps_mode
wps_enable

When I was going to uncomment them in my ini I couldn't find any of them. I added them to my ini, but maybe they can also be added to the default ini, in case other users want to save the WPS on/off setting?
 
.... Three nvram values changed when toggling the WPS button:

wl0_wps_mode
wl_wps_mode
wps_enable

When I was going to uncomment them in my ini I couldn't find any of them. I added them to my ini, but maybe they can also be added to the default ini, in case other users want to save the WPS on/off setting?

Thanks for the feedback. I checked and there are a couple more WPS vars to also be added besides those you listed. Will definitely put them in the next ini update.
 
Soon I'll start an update this fork on my AC68U from 04 to build 06 and I'll use this script....get back soon with results, meanwhile, thank you for this good idea.
 
Soon I'll start an update this fork on my AC68U from 04 to build 06 and I'll use this script....get back soon with results, meanwhile, thank you for this good idea.

Won't hurt....but right now there is no need for a factory reset moving between different versions of the fork (if there ever is a reset required, I'll definitely highlight it).
 
Status
Not open for further replies.

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