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.
Someone (not me) said: That save utility was not designed for the next generation firmware ie: 382.x or 384.x and can lead to problems, to say the least.

It will take me a while to even work out how to run this utility (I'm a Windows person), before I do can someone confirm whether the claim is true, I have a RT-AX92U on 384. Thanks.
 
It will take me a while to even work out how to run this utility (I'm a Windows person), before I do can someone confirm whether the claim is true, I have a RT-AX92U on 384. Thanks.
Yes it's true. This utility was developed for the 380.x and earlier firmware. It has never been updated for the subsequent firmware versions, which contained significant changes to the nvram usage.
 
Well, I just read the above, learning that the utility may not be applicable to 384.xx.

That said, here is some feedback that I noticed today during a nvram restore from a 384.8 to a 384.12 on my AC68.

The Bandwidth Limiter settings from the Guest Network do not appear to be handled by the utility. I have three Guest Networks set up and none of them restored enabled, nor to their Download and Upload settings.

I am not sure when the Guest network B/W limiter feature was introduced, whether 380 or 384....

Thanks for the utility though, is has been a great asset/timesaver!
 
Just out of curiosity, this tool has been so helpful to so many, how come no one maintains it? Is it a complicated software to maintain?

If perhaps the original author moved onto a different router model, did he pass along the source code for contributors? Or maybe create a more generic version with perhaps plugins for different models or something?

Just to be clear I'm not criticizing anyone, I'm genuinely wondering why?
 
The link in the first message still works, it's a shell script and although I didn't see a license stated in a quick perusal of one of the zip files, I presume it's under GPL or similar license so anyone is free to extend it to the 384.x series.

I don't want to speak for John, but just guessing, I'd say that it's not that he moved onto different routers, but since he maintains a fork of a much older version of AsusWRT-Merlin, it's the firmware that has moved well past his area of interest.
 
AppleBag - I am still trying to understand. But one thing I got from skipping through this and other threads is that there is no current version to save the files in the router. And odd things can occur if you try the old version on a current version.

The people helping on the thread are generally very proficient and helpful. But too many things I don't know. I chose this router just so I can easily update with new Merlin release's that are way better than stock. I fumble around a lot because I do not really understand many of the settings. So having them persist through an update would be good. I cause way more problems for myself than come with the firmware. It is kind of like rebuilding a slipping transmission in my car. Once upon a time I actually knew things. I was in the bunch that wrote the standards. But no more. I have deteriorated to muggle status. It took me weeks to figure out where Merlin's downloads went. Essentially all downloads go where I want them in Win 10. The system is set to ask. Not github. But the download files from the new system just disappeared. I finally looked through all the files in my computer. Way into the C drive I found I had numerous copies of the release on a folder and a whole bunch of stuff I had never seen and don't particularly want. Did not know to got there.

The whole thing is getting too complicated for muggles. Particularly for geriatric muggles.

It would be great if there could be a maintained muggle room (wiki?) that really works for simplistic and organized instructions for muggles. Just how to articles describing how to do things without really knowing why.
 
I don’t offer this as a finished product in any way, but since most of my ideas are only half-baked, I figured I’d share what I was playing with after reading John’s explanation here.

This will blindly fetch any nvram setting in one of the ASP pages that isn’t hidden and write a corresponding nvram set command to stdout. This list would need to be trimmed considerably to avoid transferring things that aren’t meant to be transferred. And ideally remove values that are at the default value. But I figure it’s a start to determining what’s in the current firmware.

My sed commands were kludged together and can surely be combined by someone with real skills.
Code:
for i in $(grep "nvram_" /www/*.asp | grep -v hidden | sed 's/^.*nvram_//;s/\;.*$//g' | sed 's/^.*(//g' | sed 's/).*$//g' | sed 's/,.*//g' | sort -u | sed 's/"//g' | grep -v "^$" | sort -fu)
do
  if [ ! -z  "$(nvram get $i 2>/dev/null | grep -v ^$)" ]; then
    echo nvram set $i=\""$(nvram get $i 2>/dev/null)"\"
  fi
done
 
If there is no licence information in the source code or in the documentation, and no copyright string either, then you can safely assume it to be public domain, unless specified otherwise by the author.

In such cases, the only good "netizen" behaviour is to give proper credit were due.
 
I used the utility when migrating to 384.11 on an RT-AC86U that had fallen several releases behind. I do recall having to reenter the commands in the Custom Config section of the OpenVPN Client Screen and the DDNS information. Other than that, no issues.
 
I don’t offer this as a finished product in any way, but since most of my ideas are only half-baked, I figured I’d share what I was playing with after reading John’s explanation here.

This will blindly fetch any nvram setting in one of the ASP pages that isn’t hidden and write a corresponding nvram set command to stdout. This list would need to be trimmed considerably to avoid transferring things that aren’t meant to be transferred. And ideally remove values that are at the default value. But I figure it’s a start to determining what’s in the current firmware.

My sed commands were kludged together and can surely be combined by someone with real skills.
Code:
for i in $(grep "nvram_" /www/*.asp | grep -v hidden | sed 's/^.*nvram_//;s/\;.*$//g' | sed 's/^.*(//g' | sed 's/).*$//g' | sed 's/,.*//g' | sort -u | sed 's/"//g' | grep -v "^$" | sort -fu)
do
  if [ ! -z  "$(nvram get $i 2>/dev/null | grep -v ^$)" ]; then
    echo nvram set $i=\""$(nvram get $i 2>/dev/null)"\"
  fi
done
IMHO, scanning the local '/www/*.asp' files is not a reliable method.

Given the v384.xx NVRAM variables are now restricted in size, in my scripts, I use a crude hack to determine the maximum permitted size of a variable (before possibly updating it).
So, although not infallible, using the source file, you can potentially retrieve a more comprehensive list of NVRAM variables.

i.e. comparison between your method to retrieve all of the VPN Client 1 related NVRAM variables:
Code:
grep "nvram_" /www/*.asp | grep -v hidden | sed 's/^.*nvram_//;s/\;.*$//g' | sed 's/^.*(//g' | sed 's/).*$//g' | sed 's/,.*//g' | sort -u | sed 's/"//g' | grep -v "^$" | sort -fu | grep vpn_client1

vpn_client1_addr
vpn_client1_desc
vpn_client1_port
vpn_client1_proto
vpn_client1_rip
and using the GitHub NVRAM definitions
Code:
curl https://raw.githubusercontent.com/RMerl/asuswrt-merlin.ng/master/release/src/router/shared/defaults.c -o /tmp/defaults.c

awk ' BEGIN { FS = ","} /CKN_/ {print $1}' /tmp/defaults.c | grep -v "^\/\/"| sed 's/[[:space:]]//g' | sort | uniq | tr -d '"{}' | grep vpn_client1

vpn_client1_addr
vpn_client1_adns
vpn_client1_bridge
vpn_client1_cipher
vpn_client1_clientlist
vpn_client1_clientlist1
vpn_client1_clientlist2
vpn_client1_clientlist3
vpn_client1_clientlist4
vpn_client1_clientlist5
vpn_client1_cn
vpn_client1_comp
vpn_client1_connretry
vpn_client1_crypt
vpn_client1_cust2
vpn_client1_cust21
vpn_client1_cust22
vpn_client1_desc
vpn_client1_digest
vpn_client1_enforce
vpn_client1_errno
vpn_client1_fw
vpn_client1_gw
vpn_client1_hmac
vpn_client1_if
vpn_client1_local
vpn_client1_nat
vpn_client1_ncp_ciphers
vpn_client1_ncp_enable
vpn_client1_nm
vpn_client1_password
vpn_client1_port
vpn_client1_proto
vpn_client1_remote
vpn_client1_reneg
vpn_client1_rg
vpn_client1_rgw
vpn_client1_state
vpn_client1_tlsremote
vpn_client1_userauth
vpn_client1_username
vpn_client1_useronly
vpn_client1_verb
Whilst the NVRAM variables are not router-model specific (i.e. the HND variables would never phyiscally exist on non-HND models), they can be used to create a compatible v384.xx custom '.ini' file for @john9527's script.
 
Last edited:
I do recall having to reenter the commands in the Custom Config section of the OpenVPN Client Screen and the DDNS information. Other than that, no issues.
You are missing the NVRAM VPN variables vpn_clientX_cust2,vpn_clientX_cust21, vpn_clientX_cust22 etc.
i.e. either add them to 'nvram-merlin.ini', or create a custom '.ini' (say 'ovpn.ini').
 
IMHO, scanning the local '/www/*.asp' files is not a reliable method.

Given the v384.xx NVRAM variables are now restricted in size, in my scripts, I use a crude hack to determine the maximum permitted size of a variable (before possibly updating it).
So, although not infallible, using the source file, you can potentially retrieve a more comprehensive list of NVRAM variables.

Whilst the NVRAM variables are not router-model specific (i.e. the HND variables would never phyiscally exist on non-HND models), they can be used to create a compatible v384.xx custom '.ini' file for @john9527's script.
I had considered the defaults.c file, but with all the ifdef lines, I couldn't be confident that a variable would exist in any particular configuration. I've also been playing around trying to limit the extract to editable, unhidden radio boxes, checkboxes, dropdowns, password fields and text boxes. To me, this would get 95% of the nvram variables that are intended to be editable by the end-user.

So to continue to expose my poor scripting skills (this is like the nightmare where I show up to school naked), these are the patterns that I've been identifying in the firmware pages on John's fork:
Code:
grep "<input.*type.*\(checkbox\|radio\|text\|password\).*nvram.*" /www/*.asp | grep -v readonly
grep "<option.*nvram_match.*" /www/*.asp
grep "iphoneSwitch.*nvram_" /www/*.asp
grep "textarea.*nvram.*" /www/*.asp | grep -v readonly
grep "nvram_match_x(" /www/*.asp | sed 's/^.*nvram_.*(/(/;s/\;.*$//g' | awk -F, ' { print $2 }
nvram_match_x requires pulling the second quoted value in parens. My original post failed to account for that. But please continue whatever it takes to make a model and firmware agnostic nvram save utility.
 
AppleBag - I am still trying to understand. But one thing I got from skipping through this and other threads is that there is no current version to save the files in the router. And odd things can occur if you try the old version on a current version.
Agree, I think the risks/misses outweigh the possible positives of using it on the 384 series firmware. But that's just my opinion, others see it differently.
The people helping on the thread are generally very proficient and helpful. But too many things I don't know. I chose this router just so I can easily update with new Merlin release's that are way better than stock. I fumble around a lot because I do not really understand many of the settings. So having them persist through an update would be good.
Not sure I understand this, if you just upgrade the firmware, all your settings should remain. They only get reset if you reset to factory defaults, which shouldn't be necessary between point releases, and probably not even if you skip one or two point releases. My solution has been to screenshot my settings periodically so if I find I need to wipe and start over I have a record of what they are. :)
I cause way more problems for myself than come with the firmware. It is kind of like rebuilding a slipping transmission in my car. Once upon a time I actually knew things. I was in the bunch that wrote the standards. But no more. I have deteriorated to muggle status. It took me weeks to figure out where Merlin's downloads went. Essentially all downloads go where I want them in Win 10. The system is set to ask. Not github. But the download files from the new system just disappeared. I finally looked through all the files in my computer. Way into the C drive I found I had numerous copies of the release on a folder and a whole bunch of stuff I had never seen and don't particularly want. Did not know to got there.
Unless you're compiling from source, there should be no reason to download from github. The compiled firmware should be downloaded from https://www.asuswrt-merlin.net/download not github. Merlin's firmware is installed using exactly the same method as for installing firmware from ASUS.
The whole thing is getting too complicated for muggles. Particularly for geriatric muggles.

It would be great if there could be a maintained muggle room (wiki?) that really works for simplistic and organized instructions for muggles. Just how to articles describing how to do things without really knowing why.
If you don't know why you're doing it, why are you doing it? Things like Diversion and Skynet you'd know you want to block ads and domains associated with malware. Those have very detailed instructions on installation in the first messages of their respective threads. There's also a pretty good range of how-to's on the Wiki (https://github.com/RMerl/asuswrt-merlin/wiki) for different things you might want to do.

As far as settings available in the router, I tend to just leave the defaults unless I know why I want to fix them. Merlin keeps pretty sane defaults in his firmware, some I think are different from the ASUS defaults due to ASUS' defaults being wrong for the majority of users.
 
Being completely undereducated in the subject, but still curious from a creative perspective, would it be difficult to add the abilities of this utility right into the Merlin firmware so you can do the backup/restore (of the utility) right from the backup/restore page of the UI?
 
Being completely undereducated in the subject, but still curious from a creative perspective, would it be difficult to add the abilities of this utility right into the Merlin firmware so you can do the backup/restore (of the utility) right from the backup/restore page of the UI?
It's already there on the Restore/Save/Upload Setting page ... the NVRAM utility just expanded on that, adding features such as aiding migration from one router model to another, saving jffs at the same time instead of as a separate operation, etc. For simple backup of your settings, the built-in utility is fine. Why do you think you need the extra granularity of John's NVRAM utility? Even with John's utility, if you ran into a problem with the router and wiped everything, if you reloaded from a recent backup, you'd probably just reload whatever caused the issue in the first place.
 
It's already there on the Restore/Save/Upload Setting page ... the NVRAM utility just expanded on that, adding features such as aiding migration from one router model to another, saving jffs at the same time instead of as a separate operation, etc. For simple backup of your settings, the built-in utility is fine. Why do you think you need the extra granularity of John's NVRAM utility? Even with John's utility, if you ran into a problem with the router and wiped everything, if you reloaded from a recent backup, you'd probably just reload whatever caused the issue in the first place.
Yes, but using John's NVRAM utility you can schedule the backup. And the output is kept, not overwriting, so you can restore to any point.
Using build in way, as far as I know, you have to do the backup manual.
 
For simple backup of your settings, the built-in utility is fine. Why do you think you need the extra granularity of John's NVRAM utility? Even with John's utility, if you ran into a problem with the router and wiped everything, if you reloaded from a recent backup, you'd probably just reload whatever caused the issue in the first place.
Two years ago I proposed some changes to @john9527's script - basically to provide more feedback/stats and easier management of the backups.

i.e. I still use my tweaked version of the script (see this post) to fix the incomplete/broken backups for end-user configuration panels such as the VPN server/client GUI.

So after a firmware upgrade and (mandatory?) firmware reset, exploiting the flexibility of @john9527's design I can in a few seconds reliably (i.e. repeatedly and consistently) selectively restore tedious time-consuming GUI configurations such as the DHCP IP reservations, VPN and Guest Networks etc. safe in the knowledge that a corrupt configuration isn't restored, but if it was, I can easily review the human-readable restore script and adapt as necessary.

Clearly the firmware's GUI backup/restore '.cfg' feature is useless in this very common firmware upgrade scenario.
 
Is it publicly available?

(the linked post only seems to show the usage?)
My script proposal post #648 was acknowledged post #666 :eek: but never published by @john9527.

I presumed he had rejected my modifications (see post #736), and without his approval, deemed it a courtesy to withhold releasing my unofficial version.
 
Status
Not open for further replies.

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