[R7800 utility] nvram-utils

  • ATTENTION! As of November 1, 2020, you are not able to reply to threads 6 months after the thread is opened if there are more than 500 posts in the thread.
    Threads will not be locked, so posts may still be edited by their authors.
    Just start a new thread on the topic to post if you get an error message when trying to reply to a thread.

HELLO_wORLD

Very Senior Member
I already mentioned all of that, but since it is buried in the middle of the thread about the recurring factory reset problems, I open this thread dedicated only to the utility.

I made a little script called nvram-utils.

To install:
  1. Connect to the router with ssh or telnet
  2. Go to the directory you want to install the script, for example /opt/scripts (or /bolemo/scripts if you hare using my blocklist script) :
    Code: cd /opt/scripts
    If directory does not exist use:
    Code: mkdir -p /opt/scripts; cd /opt/scripts
  3. Copy and paste the following code:
    Code: wget https://tinyurl.com/nvram-utils && chmod +x nvram-utils
Now the script is installed.

Usage:
  • /opt/scripts/nvram-utils backup
    • To backup the current settings to be able to restore with the boot fix.
    • If you have an external drive labeled ‘optware’, it will save a copy to it with a timestamp in /mnt/optware/nvram_backups/ in binary and text formats.
  • /opt/scripts/nvram-utils bootfix install
    • To install the boot fix (init.d and rc.d) to restore saved settings from backup at early boot stage.
    • Recommended only if you have the problem of non persistant nvram (loosing your settings at reboot or restore).
    • Once installed, the bootfix WILL PREVENT THE ABILITY TO DO A FACTORY RESET as the backup settings will always be restored at boot time. To prevent that, you need to access the root file system (telnet or ssh) and either:
      • remove /nvram_backup (rm /nvram_backup and confirm), or
      • uninstall the boot fix (see next command)
    • Note that if you have no telnet/ssh access, it is possible to make a little autorun script on a usb thumb drive to do that.
  • /opt/scripts/nvram-utils bootfix uninstall
    • To uninstall the boot fix

That’s it. I threw that quickly without much testing. It is basic and to help people having the settings reset at reboot or restore from web GUI problem.

Thanks to @kamoj who helped with the boot fix.
To install the boot fix (init.d and rc.d) to restore saved settings from backup at early boot stage.

PS : tinyurl link `https://tinyurl.com/nvram-utils` is sending here: `https://raw.githubusercontent.com/bolemo/nvram_utils/master/nvram_utils`
If you don’t want to use tinyurl, use this instead of point 3 of install procedure:

Code: wget -O- https://raw.githubusercontent.com/bolemo/nvram_utils/master/nvram_utils >nvram-utils && chmod +x nvram-utils
 
Last edited:

L&LD

Part of the Furniture
May I suggest not to use tiny URL? :)
 

HELLO_wORLD

Very Senior Member

L&LD

Part of the Furniture
No shortener at all. :)

I want to see what I'm clicking. :)

Thank you.
 

HELLO_wORLD

Very Senior Member
Added PS explaining where tinyurl is sending, and the substitution procedure for the ones wanting to avoid tinyurl.

No shortener at all. :)

I want to see what I'm clicking. :)

Thank you.
 

L&LD

Part of the Furniture
@HELLO_wORLD thank you. We can never be too safe today. :)
 

Droidrat

Regular Contributor
I installed the script, and ran /opt/scripts/nvram-utils backup. I did this as a precaution; I did not install the bootfix.

Questions:
  • I do not have an external drive attached to the router. I assume that the settings are backed up on the router, as well. Pls confirm.
  • What happens if I make a change in my settings, and run the "backup" command a second time. Will it overwrite the prior backup (I hope it will, but I have to ask)? Is there a y/n prompt for the overwrite? (yes, I know it is a simple script; not sure how robust you made it)
  • Assuming that the answer to the prior question is "yes, overwrite", I assume that a change is saved settings will persist, even if the bootfix has been enabled. Pls confirm. It would therefore be quite easy to change the settings.
I'm happy to have your script; I hope I won't need to enable it.
 

HELLO_wORLD

Very Senior Member
I installed the script, and ran /opt/scripts/nvram-utils backup. I did this as a precaution; I did not install the bootfix.
That is very wise, and the right way to use this utility.
If your router loses its settings (what I don’t wish for you), you have the ability to restore.
Questions:
  • I do not have an external drive attached to the router. I assume that the settings are backed up on the router, as well. Pls confirm.
Yes.
The backup parameter makes a backup (binary form) on the root file system (internal drive or more exactly on the flash NAND, MTD6 that is the root file system)
The exact location is /nvram_backup

If you have an external drive (USB) named optware connected, the backup parameter will also backup into that drive (binary and text format)

  • What happens if I make a change in my settings, and run the "backup" command a second time. Will it overwrite the prior backup (I hope it will, but I have to ask)? Is there a y/n prompt for the overwrite? (yes, I know it is a simple script; not sure how robust you made it)
Yes, it will overwrite the backup made on the root file system.
There is only one backup file on the root file system, and that is the last one you made with the backup parameter.

If you have an external drive (USB) named optware connected, the additional backup saved there will be dated and the previous one(s) on the USB will be kept.

  • Assuming that the answer to the prior question is "yes, overwrite", I assume that a change is saved settings will persist, even if the bootfix has been enabled. Pls confirm. It would therefore be quite easy to change the settings.
The backup parameter only creates a backup of the settings at the moment the command is called.
It does not change the normal function of the router. And doing a backup never writes (change) the settings unless you use the boot fix.
If you do a backup, then change and apply a setting (from the router web page for example), then the setting will be changed (as it should), however, the backup file made with the utility won’t reflect that change (it is not automatically updated each time you change a setting).
Of course, if you do a backup again after changing a setting, then the backup will reflect that change.

The boot fix only restores the last backup at boot time.

With the boot fix installed, if you:
  • 1) do a backup, 2) change a setting
that changed setting will only persist until next restart. And the setting that was in place at the time of the backup will be restored at boot time.
With the boot fix installed, if you:
  • 1) change a setting, 2) do a backup
  • or 1) do a backup, 2) change a setting, 3) do a backup
that changed setting will persist after restart.​

I'm happy to have your script; I hope I won't need to enable it.

I hope too for you. Thank you for using it :)


PLEASE, BE AWARE THAT ANY FIRMWARE FLASHING (UPDATE) WILL ERASE THE BACKUP SAVED IN THE ROOT FILESYSTEM.
Also, as an information, the /nvram_backup file, which is a binary format of the backup is the same format as the backup made from the web interface (and you can save from your web browser). So if make a backup from the web interface, you can also use it with the boot fix: you would have to rename the backup nvram_backup and place it at the root on the internal filesystem /
I personally had problems with the web backups as sometimes it would not save a correct backup (but an html error file), so I do not trust the web backup.
 

Similar threads

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