What's new

[Release] NVRAM Save/Restore Utility

latenitetech

Regular Contributor
First things first ...
We must be talking past each other on the scripts and the awk commands I'm referring to. The "generated script" in my case is named "nvram-restore-202004271709_RT-AC68U-MIGR.sh" (located in the backup directory of my nsru installation).

I had to insert a screenshot as the paranoid bbs wouldn't let me insert the actual code here.
Capture.jpg

Notice the 'awk' on lines 35, 39, 45, 49. The ones on all but line 45 have the issue with the escaped single-quote. Removing the backslashes from those 3 awk statements seems to fix the problem.

As for the other concerns of why as I'm doing such a crazy thing as trying to migrate between 2-yr old FW versions. A bit of background, I was crazy busy with work when the migration from 380 to 384 happened, and since my work is critically dependent on a working router environment, I just didn't have the time to risk any downtime if that migration went south. Fast forward several very busy years, I'm now even more concerned about downtime trying to get that old/reliable router upgraded, so I bought another identical model and will use it as my test bed before I commit it to production on the latest FW. Seeing there was a backup tool that purported to do migrations, I thought I'd give it a try. Worst case, I rebuild it from scratch (I have a lot of customizations).
 
Last edited:

Xentrk

Part of the Furniture
First things first ...
We must be talking past each other on the scripts and the awk commands I'm referring to. The "generated script" in my case is named "nvram-restore-202004271709_RT-AC68U-MIGR.sh"

I had to insert a screenshot as the paranoid bbs wouldn't let me insert the actual code here.
View attachment 23115
Notice the 'awk' on lines 35, 39, 45, 49. The ones on all but line 45 have the issue with the escaped single-quote. Removing the backslashes from those 3 awk statements seems to fix the problem.

As for the other concerns of why as I'm doing such a crazy thing as trying to migrate between 2-yr old FW versions. A bit of background, I was crazy busy with work when the migration from 380 to 384 happened, and since my work is critically dependent on a working router environment, I just didn't have the time to risk any downtime if that migration went south. Fast forward several very busy years, I'm now even more concerned about downtime trying to get that old/reliable router upgraded, so I bought another identical model and will use it as my test bed before I commit it to production on the latest FW. Seeing there was a backup tool that purported to do migrations, I thought I'd give it a try. Worst case, I rebuild it from scratch (I have a lot of customizations).
Thank you. I wasn't hitting the condition on my router to generate the code that is causing issues. It only gets generated when coming from the 380 code base. Those slashes are meant to be escape characters for the single quotes. But it appears to not behaving as intended. I'll fix it once my day job obligations are over. I also replaced some of the last "echo -e" with "printf" last night as shellcheck doesn't like "echo -e" because it is not POSIX compliant.
 

Xentrk

Part of the Furniture
Updated nvram-save.sh to fix issues reported by @latenitetech. I also eliminated the last of the "echo -e" code and updated an if statement to pass shellcheck.net test.

The code updates can be viewed on GitHub.

Type nsrum to access the NVRAM Save/Restore Utility Menu and selection option "u" to check for updates.
 
Last edited:

XIII

Very Senior Member
What I ran the update I got messages for x3mRouting...

(which I don't have installed)
 

Xentrk

Part of the Furniture
What I ran the update I got messages for x3mRouting...

(which I don't have installed)
I ran a search for x3mRouting on the repo and couldn't find any references to x3mRouting.

What steps did you take? You can access the NVRAM Save/Restore Utility Menu via amtm or by typing nsrum at the command line. Then select option "2"

Code:
# nsrum

________________________________________________________________________
|                                                                      |
|  Welcome to the nvram-save-restore-utility installation script       |
|  Version 30.3.0                                                      |
|         ____        _         _                                      |
|        |__  |      | |       | |                                     |
|  __  __  _| |_ _ _ | |_  ___ | | __    ____ ____  _ _ _              |
|  \ \/ / |_  | ` ` \  __|/ _ \| |/ /   /  _//    \| ` ` \             |
|   /  /  __| | | | |  |_ | __/|   <   (  (_ | [] || | | |             |
|  /_/\_\|___ |_|_|_|\___|\___||_|\_\[] \___\\____/|_|_|_|             |
|______________________________________________________________________|
|                                                                      |
| Requirements: Properly formatted USB Drive with designated partition |
|                                                                      |
| See the project repository at                                        |
| https://github.com/Xentrk/nvram-save-restore-utility                 |
| for helpful tips.                                                    |
|______________________________________________________________________|

[1]  Install NVRAM Save/Restore Utility Files
[2]  Check for updates to existing installation
[3]  Force update existing installation
[4]  Remove NVRAM Save/Restore Utility

[e]  Exit Script

Option ==> 2


This option will check your current installation and update any files that have changed
since you last installed the repository.  Updating is highly recommended to get the most recent.
files. Chosing this option will not update missing files. Select the install option from the
menu to reinstall missing files

Would you like to check and download any files that have been updated?
[1]  --> Confirm
[2]  --> No

[1-2]: 1
MD5 hash of clear-maclist.sh matches - skiping download clear-maclist.sh
No new version of jffs-restore.sh to update - latest is 30.3.0
MD5 hash of jffs-restore.sh matches - skiping download jffs-restore.sh
MD5 hash of nvram-excp-merlin.sh matches - skiping download nvram-excp-merlin.sh
MD5 hash of nvram-hnd-migr.sh matches - skiping download nvram-hnd-migr.sh
MD5 hash of nvram-merlin.ini does not match - downloading nvram-merlin.ini
nvram-merlin.ini downloaded successfully
No new version of nvram-restore.sh to update - latest is 30.3.0
MD5 hash of nvram-restore.sh matches - skiping download nvram-restore.sh
MD5 hash of nvram-sample.ini does not match - downloading nvram-sample.ini
nvram-sample.ini downloaded successfully
No new version of nvram-save.sh to update - latest is 30.3.0
MD5 hash of nvram-save.sh does not match - downloading nvram-save.sh
nvram-save.sh downloaded successfully
MD5 hash of nvram-user-sample.sh matches - skiping download nvram-user-sample.sh
MD5 hash of save-mynvram.sh matches - skiping download save-mynvram.sh

Update of nvram-save-restore-utility completed

Press enter to continue
 
Last edited:

XIII

Very Senior Member
What steps did you take? You can access the NVRAM Save/Restore Utility Menu via amtm or by typing nsrum at the command line. Then select option "2"
That’s exactly what I did...

It happened twice, but so fast that I could not take a screenshot.

The third time I got the expected update.
 

Xentrk

Part of the Furniture
That’s exactly what I did...

It happened twice, but so fast that I could not take a screenshot.

The third time I got the expected update.
I stand corrected. I did clone some code from the x3mRouting installation menu when I created the installation menu for NVRAM Save/Restore Utility. I now see an output message when the curl command fails that informs the user to an option in the x3mRouting menu.
Code:
   printf 'Rerun the install %bx3mRouting for LAN Clients%b option\n' "$cGRE" "$cRESET" "$cGRE" "$cRESET"
You may have experienced a curl error since that is what triggers the message. It just requires some rewording. Not sure why I didn't get a hit when I searched for x3mRouting using the search function on GitHub.
 

Xentrk

Part of the Furniture
I applied an update to the message that is displayed if curl is unable to download a file. The curl error number and message will be displayed with prompt. After pressing enter, you are returned to the main menu rather than exiting so you can try the update again. No version change.

Code:
This option will check your current installation and update any files that have changed
since you last installed the repository.  Updating is highly recommended to get the most recent.
files. Chosing this option will not update missing files. Select the install option from the
menu to reinstall missing files

Would you like to check and download any files that have been updated?
[1]  --> Confirm
[2]  --> No

[1-2]: 1
MD5 hash of clear-maclist.sh matches - skiping download clear-maclist.sh
No new version of jffs-restore.sh to update - latest is 30.3.0
MD5 hash of jffs-restore.sh matches - skiping download jffs-restore.sh
MD5 hash of nvram-excp-merlin.sh matches - skiping download nvram-excp-merlin.sh
MD5 hash of nvram-hnd-migr.sh matches - skiping download nvram-hnd-migr.sh
MD5 hash of nvram-merlin.ini matches - skiping download nvram-merlin.ini
No new version of nvram-restore.sh to update - latest is 30.3.0
MD5 hash of nvram-restore.sh matches - skiping download nvram-restore.sh
MD5 hash of nvram-sample.ini matches - skiping download nvram-sample.ini
No new version of nvram-save.sh to update - latest is 30.3.0
MD5 hash of nvram-save.sh does not match - downloading nvram-save.sh
nvram-save.sh download failed with curl error 300

Press enter to continue
 

Xentrk

Part of the Furniture

pirx73

Regular Contributor
Latest nsrum update was a bit confusing :D amtm said "minor update", i ran update. Still minor update, then i noticed there is another update option in nsrum menu - update menu, that was that "minor update", after running menu update, nsrum's menus changed. Done.
 

Torson

Regular Contributor
I took today a backup of the AC86U @ 348.17. The process seemed to run properly in backup mode.

However, when I tried a restore on the same router I get this:
Last nvram save/restore (nvram-restore-file.sh)
WARNING: Last nvram-save MAC address (file)
does not match current router MAC (AB10)!
This may be valid if you are migrating settings from one router to another

If you wish to use a different restore file, answer N and specify the
restore file id the command line in the form
yyyymmddhhmm-mmmm
Do you want to proceed [Y/N]? y

nvram-restore.sh NVRAM Restore Utility - Version 30.3.0

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

1 : nvram-restore-202003211653_RT-AX56U-AF28.sh Ver=--------
2 : nvram-restore-202003271843_RT-AX56U-MIGR.sh Ver=--------
3 : nvram-restore-202003271845_RT-AX56U-AF28.sh Ver=--------
4 : nvram-restore-202004041147_RT-AC86U-AB10.sh Ver=--------
5 : nvram-restore-202004041156_RT-AC86U-AB10.sh Ver=--------
6 : nvram-restore-202004061119_RT-AC86U-AB10.sh Ver=--------
7 : nvram-restore-202005011332_RT-AC86U-AB10.sh Ver=--------
8 : nvram-restore-202005011337_RT-AC86U-AB10.sh Ver=--------
Also, note that the version does not show up. I did a force update of the code, but no change in the outcome.

Any suggestions?
 

L&LD

Part of the Furniture
Because you migrated it originally? :)
 

Torson

Regular Contributor
@L&LD - the migration occurred from item #2 which indeed I've done at the end of March. I expect that after the migration when running the script in backup mode it picks up the current MAC address and is ready to restore to the same router.
 

Xentrk

Part of the Furniture
I took today a backup of the AC86U @ 348.17. The process seemed to run properly in backup mode.

However, when I tried a restore on the same router I get this:


Also, note that the version does not show up. I did a force update of the code, but no change in the outcome.

Any suggestions?
The Version issue occurs if an nvram-save was aborted. There will not be a log entry in nvram-util.log because the log entry is only created when nvram-save completes successfully.

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

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

  1 : nvram-restore-202004281818_RT-AC88U-MIGR.sh       Ver=384.17_0 nvram-merlin.ini
  2 : nvram-restore-202004281943_RT-AC88U-8248.sh       Ver=384.17_0 nvram-merlin.ini
  3 : nvram-restore-202004291837_RT-AC88U-MIGR.sh       Ver=384.17_0 nvram-merlin.ini
  4 : nvram-restore-202004291844_RT-AC88U-8248.sh       Ver=384.17_0 nvram-merlin.ini
  5 : nvram-restore-202004291850_RT-AC88U-8248.sh       Ver=384.17_0 nvram-merlin.ini
  6 : nvram-restore-202004291905_RT-AC88U-8248.sh       Ver=384.17_0 nvram-merlin.ini
  7 : nvram-restore-202004300636_RT-AC88U-8248.sh       Ver=384.17_0 nvram-merlin.ini
  8 : nvram-restore-202005021835_RT-AC88U-8248.sh       Ver=384.17_0 nvram-merlin.ini
  9 : nvram-restore-202005021901_RT-AC88U-8248.sh       Ver=--------

      
 Restore last NVRAM save ? (nvram-restore-202005021835_RT-AC88U-8248.sh)
        { n[{-n}] [ del ] | Y } (or press ENTER to ABORT) >
Similarly, if you remove nvram-util.log or some log file entries, and don't also remove the corresponding files in the backup folder, the menu won't be able to display the version. Best to always delete the files using the delete feature on the menu above so log file entries are also deleted.
 

Torson

Regular Contributor
@Xentrk , in all likelihood there was corruption of sorts in my install that was not corrected by a forced update. What I ended up doing, was to move the content of nsru and then run uninstall followed by an amtm install.

Everything is back to normal now::
Code:
          nvram-restore.sh NVRAM Restore Utility - Version 30.3.0

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

  1 : nvram-restore-202005020938_RT-AC86U-AB10.sh       Ver=384.17_0 nvram-merlin.ini
  2 : nvram-restore-202005020940_RT-AC86U-AB10.sh       Ver=--------
  3 : nvram-restore-202005020941_RT-AC86U-AB10.sh       Ver=384.17_0 nvram-merlin.ini
  4 : nvram-restore-202005020942_RT-AC86U-MIGR.sh       Ver=384.17_0 nvram-merlin.ini
  5 : nvram-restore-202005020943_RT-AC86U-AB10.sh       Ver=384.17_0 nvram-merlin.ini

        Restore last NVRAM save ? (nvram-restore-202005020943_RT-AC86U-AB10.sh)
        { n[{-n}] [ del ] | Y } (or press ENTER to ABORT) >
Thank you!
 

HawkInOz

Regular Contributor
amtm 3.1.7 is indicating a "min upd" is available for nsrum, but running option [2] and [3] in the utility do not clear this status. Suggestions? Thanks!
 

Butterfly Bones

Very Senior Member

Latest threads

Sign Up For SNBForums Daily Digest

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