What's new

NVRAM [Release] NVRAM Save/Restore Utility

  • 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.
Hi, you need to check for updates within the script then it will download the changed files.

@Xentrk can you add an option within your script to view backups and be able to delete ones if not needed please?
That feature exists when you run nvram-restore.sh. It will present a list of files in numeric order. You can delete the first file listed by specifying: 1 del
at the prompt. Or, you can delete a range using a dash as a separator: 1-5 del

Code:
         nvram-restore.sh NVRAM Restore Utility - Version 30.3.0

        NVRAM Restore File Directory: /tmp/mnt/AC88U/nsru/backup

  1 : nvram-restore-202001112027_RT-AC88U-8248.sh       Ver=384.14_2 nvram-merlin.ini
  2 : nvram-restore-202001112031_RT-AC88U-8248.sh       Ver=384.14_2 nvram-merlin.ini
  3 : nvram-restore-202001121854_RT-AC88U-8248.sh       Ver=384.14_2 nvram-merlin.ini
  4 : nvram-restore-202001151944_RT-AC88U-8248.sh       Ver=--------
  5 : nvram-restore-202001151945_RT-AC88U-8248.sh       Ver=--------

        Restore last NVRAM save ? (nvram-restore-202001121854_RT-AC88U-8248.sh)
        { n[{-n}] [ del ] | Y } (or press ENTER to ABORT) > 5 del
        Deleted                   (*202001151945_RT-AC88U-8248.*)
 
Hello, sorry to bother your thread, I am writing a script now, do you know how to distinguish a router is HNDs (bcm49xx) or Non-HNDs (bcm47xx and outher)? I tried to find the cpu model in nvram, but I not found anything. that way I use now is to write a white list for all router mode, but this way is not elegant and asus may be add new models in the future, so that will make me lose control.


thanks for your any help.
 
Last edited:
Hello, I am writing a script, do you know how to distinguish a router is HNDs (bcm49xx) or Non-HNDs (bcm47xx and outher), I tried to find the cpu model in nvram, but I found anything. that way I use now is to write a white list for all router mode, but this way is not elegant and asus may be add new models in the future, so that will make me lose control

Currently I use
Code:
Is_HND() {
    [ -n "$(uname -m | grep "aarch64")" ] && { echo Y; return 0; } || { echo N; return 1; }
}
to differentiate between my RT-AC68U/RT-AC86U/RT-AX56U
 
Currently I use
Code:
Is_HND() {
    [ -n "$(uname -m | grep "aarch64")" ] && { echo Y; return 0; } || { echo N; return 1; }
}
Wow, that's so great, thanks so much for that! and thank you for your very quick reply!
 
Last edited:
Thanks guys for all your coding and script work. I can fumble my way around as an advanced laymen user, but had some slight observations as I restored NVRAM settings today after a factory reset.

After the reset and restore, my Diversion installation did not work anymore, and would not launch with the Diversion command. Was able to re-download it and the clever installation scrip asked if I wanted to reinstall the version it found. That worked and got me out of a jam.

My question is:
- Should the NVRAM restore (nvram-restore.sh) have restored my Diversion also?
- or, Would I have to have a) ran the NVRAM restore script, and then also afterwards separately run the jffs restore?
- or, would I have to have enabled jffs again on the router after reset, before then running NVRAM restore to add back my Diversion installation?

If the latter then I suggest modifying the factory setting notes to include:

Restoring After a Factory Reset
  • Perform Factory reset (IAW your specific Router)
  • log into the router's default IP at 192.168.1.1/index.asp (To bypass the ASUS Wizard)
  • Set a new username / password
  • You will need to acknowledge the TrendMicro EULA upon logging into the router Web GUI if it was previously enabled.
  • Enable SSH (Recommend LAN only for security purposes)
  • Enable JFFS (to allow jffs restoration)
  • Connect via your favorite terminal emulator (e.g. Putty or WinSCP)
  • Run NVRAM Restore

  • The UPnP setting on the WAN page must be configured manually after running nvram-restore.sh.
Check me....

Thanks for both utilities: Diversion and NVRAM Restore (both the old and new forks)!
 
Why would you expect the content of a storage device of sorts to be restored by a specific nvram restore script that does not mention such capability?
 
Why would you expect the content of a storage device of sorts to be restored by a specific nvram restore script that does not mention such capability?

Not the storage devices (USB), but the router's internal jffs partition and contents, which I thought was part of the backup utility's capability....
 
The jffs content is backed-up by the script and stored in /mnt/<mount.point>/nsru/backup/jffs-<date.time>_<router.host.name>.
Diversion requires and installs Entware also on your storage device though. The configuration and more lives in jffs, hence after the restore you were asked if you want to reinstall the version it found. Different entities is the answer - nvram (+jffs) on one hand, external storage on the other.
 
The jffs content is backed-up by the script and stored in /mnt/<mount.point>/nsru/backup/jffs-<date.time>_<router.host.name>.
Diversion requires and installs Entware also on your storage device though. The configuration and more lives in jffs, hence after the restore you were asked if you want to reinstall the version it found. Different entities is the answer - nvram (+jffs) on one hand, external storage on the other.

Are you saying that the nvram restore utility along the way asked if I wanted to restore my jffs partition? If so, then maybe I missed that.

Thanks
 
"reinstall the version it found' - is in a Diversion context... I believe the essence of it all is in the last phrase.
 
"reinstall the version it found' - is in a Diversion context... I believe the essence of it all is in the last phrase.

Thanks Torson I appreciate your replies, but I think we are talking apples and oranges.

My problem is 'not' with Diversion, but with how and if nvram restore, actually restores jffs when after a factory reset jffs is disabled.

Appears like I have to first re-enable jffs on the router again, before running nvram restore, in order for it to restore the saved jffs content.
 
Last edited:
Thanks Torson I appreciate your replies, but I think we are talking apples and oranges.

My problem is 'not' with Diversion, but with how and if nvram restore, actually restores jffs when after a factory reset jffs is disabled.

Appears like I have to first re-enable jffs on the router again, before running nvram restore, in order for it to restore the saved jffs content.
I'll update the text below step 6 in the QuickStart.txt file to mention re-enabling jffs parition. It is listed later in the text. But having the requirement listed right below step 6 should help clarify.
 
@kenhlan, please accept my apologies for talking apples to your oranges (or the other way around.)
I am an end user, who over a number of years, has used the original nvram restore script and the fork we're talking about, more than twice. It never crossed my mind that enabling jffs would somehow be expected from the script.
 
Thanks Xentrk and Torson, the willingness to help it what its all about.

Helping someone even less saavy then me (and that isnt saying much!), for next time.

I also used the original nvram-save a few times before Xentrk's latest fork. Must have never noticed the jffs not being restored in the past.

Updating step 6 would indeed help, and also on your main web page test under Restoring After a Factory Reset (for those of us who just jump in off the web site)

Keep up the good work.

BTW - When I re-installed Diversion, its script re-enabled jffs and installed the scripts there again. Maybe whatever script or code he used to reenable jffs, can be leveraged into the nvram-restore code.

Thanks again!!!
 
I believe I ran into a bug in the "generated script to restore user nvram settings" (VERSION=30.3.0). I was attempting to migrate settings between two AC68U's one running 380.70 and the new one on 384.17. The backup ran fine on the older unit, but when trying to restore (nvram-restore.sh) on the new unit, I get

Code:
 ... nsru/backup/nvram-restore-202004271709_RT-AC68U-MIGR.sh: line 35: syntax error: unexpected "(" (expecting ")")
and then the script aborts.

I believe the problem is undesired backslashes before the single-quotes in the awk statement. This same problem appears again on lines 39 and 49, but not on a similar line 45. My simple fix was to remove the backslashes from those lines and the script appeared to run fine. I didn't bother to look at the generator script (where the real problem lies), but I assume the author should be able to find it easy enough.

Kind of weird that I would stumble on such an obvious problem. Perhaps the migrate function isn't used much, or something else changed in the environment recently that suddenly made that code no longer workable?

Anyway, great tool! Just thought I'd share before someone else stumbles on this.
 
I believe I ran into a bug in the "generated script to restore user nvram settings" (VERSION=30.3.0). I was attempting to migrate settings between two AC68U's one running 380.70 and the new one on 384.17. The backup ran fine on the older unit, but when trying to restore (nvram-restore.sh) on the new unit, I get

Code:
 ... nsru/backup/nvram-restore-202004271709_RT-AC68U-MIGR.sh: line 35: syntax error: unexpected "(" (expecting ")")
and then the script aborts.

I believe the problem is undesired backslashes before the single-quotes in the awk statement. This same problem appears again on lines 39 and 49, but not on a similar line 45. My simple fix was to remove the backslashes from those lines and the script appeared to run fine. I didn't bother to look at the generator script (where the real problem lies), but I assume the author should be able to find it easy enough.

Kind of weird that I would stumble on such an obvious problem. Perhaps the migrate function isn't used much, or something else changed in the environment recently that suddenly made that code no longer workable?

Anyway, great tool! Just thought I'd share before someone else stumbles on this.
Thank you. I will look into it.
 
@latenitetech updating a currently supported router between firmware versions that are two years apart is not obvious either. :)

I hope you're not relying too much on that one. :)
 
I believe I ran into a bug in the "generated script to restore user nvram settings" (VERSION=30.3.0). I was attempting to migrate settings between two AC68U's one running 380.70 and the new one on 384.17. The backup ran fine on the older unit, but when trying to restore (nvram-restore.sh) on the new unit, I get

Code:
 ... nsru/backup/nvram-restore-202004271709_RT-AC68U-MIGR.sh: line 35: syntax error: unexpected "(" (expecting ")")
and then the script aborts.

I believe the problem is undesired backslashes before the single-quotes in the awk statement. This same problem appears again on lines 39 and 49, but not on a similar line 45. My simple fix was to remove the backslashes from those lines and the script appeared to run fine. I didn't bother to look at the generator script (where the real problem lies), but I assume the author should be able to find it easy enough.

Kind of weird that I would stumble on such an obvious problem. Perhaps the migrate function isn't used much, or something else changed in the environment recently that suddenly made that code no longer workable?

Anyway, great tool! Just thought I'd share before someone else stumbles on this.
@L&LD does have a good point. Updating the source router to the same firmware first may be less risky. For example, nvram vars dhcp_staticlist and dhcp_hostnames had changes in 384.13 that may not convert properly. But let me know your experience. I don't see any 'awk' commands in the generated nvram restore file. I ran the code thru shellcheck too. There are 'awk' commands in the nvram-save.sh and nvram-restore.sh files though. I ran a test and no issues. Maybe you can post the code that you had to change. Thanks.
 
Status
Not open for further replies.

Sign Up For SNBForums Daily Digest

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