What's new

NVRAM NVRAM Save/Restore Utility Restore error on line 652

  • 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!

atkinsom

Senior Member
Hi,

I'm trying to restore a backup of my NVRAM on my AC-68U using John's latest fork. I did a backup including the clock frequency and when I do a restore I get the following error below on line 652. I looked in the .sh file and it appears to relate to custom VPN config entries but I'm not sure. Please see the image attached and the corresponding entries in the .sh file at line 652 which starts with the word Skipping where the error occurs. Thanks for any help

($op || grep -q "vpn_server1_custom" "$tmpfile") && $(nvram set vpn_server1_custom="$(printf '
' "push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"
management localhost 4242")") || printf '
' "Skipping vpn_server1_custom"($op || grep -q "vpn_server1_dhcp" "$tmpfile") && $(nvram set vpn_server1_dhcp="1") || printf '%s\n' "Skipping vpn_server1_dhcp"
 

Attachments

  • Capture.PNG
    Capture.PNG
    36.9 KB · Views: 149
Hi,

I'm trying to restore a backup of my NVRAM on my AC-68U using John's latest fork. I did a backup including the clock frequency and when I do a restore I get the following error below on line 652. I looked in the .sh file and it appears to relate to custom VPN config entries but I'm not sure. Please see the image attached and the corresponding entries in the .sh file at line 652 which starts with the word Skipping where the error occurs. Thanks for any help

($op || grep -q "vpn_server1_custom" "$tmpfile") && $(nvram set vpn_server1_custom="$(printf '
' "push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"
management localhost 4242")") || printf '
' "Skipping vpn_server1_custom"($op || grep -q "vpn_server1_dhcp" "$tmpfile") && $(nvram set vpn_server1_dhcp="1") || printf '%s\n' "Skipping vpn_server1_dhcp"

Can you do me a favor and copy and paste the code in the restore shell script nvram save utility created in the box on https://www.shellcheck.net/ and post the output?

However, the lines of code will probably exceed the amount of lines shellcheck.net supports. As a result, you may have to snip many of the other lines of code containing the $op line which won't matter for the purpose of troubleshooting.

Or, repost the problem code snip above in a code box using the insert code option. It will give me a much better idea where the issues is. Formatting gets lost without code box which makes it hard to debug. Many thanks!
 
Hi Xentrk,

Unfortunately I went ahead and remarked out that bad line at the time and then ran the restore again with no issues. The file is no longer available as I trashed everything and started from scratch after realizing what was happening. It seems to me that it fails at the restore because it doesn't understand what to do with the \ that's been put into the line but as an amateur I'm just guessing. I've inserted the relevant contents of the new restore SH file into code boxes below. Just search for the word PUSH and you'll see that it mangles the custom VPN config commands and I believe that's where it fails. The command should look like push "route 192.168.2.1 255.255.255.255 10.8.0.1 21" but ends up looking like (nvram set vpn_server_custom="push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"")

Hopefully this can help you. The next time I reflash my box I'll save the file again.
 
Code:
echo "Restoring [VPN Server Admin]"
($op || grep -q "VPNServer_enable" "$tmpfile") && $(nvram set VPNServer_enable="0") || printf '%s\n' "Skipping VPNServer_enable"
($op || grep -q "VPNServer_mode" "$tmpfile") && $(nvram set VPNServer_mode="openvpn") || printf '%s\n' "Skipping VPNServer_mode"
($op || grep -q "pptpd_broadcast" "$tmpfile") && $(nvram set pptpd_broadcast="disable") || printf '%s\n' "Skipping pptpd_broadcast"
($op || grep -q "pptpd_chap" "$tmpfile") && $(nvram set pptpd_chap="0") || printf '%s\n' "Skipping pptpd_chap"
($op || grep -q "pptpd_clients" "$tmpfile") && $(nvram set pptpd_clients="192.168.10.2-11") || printf '%s\n' "Skipping pptpd_clients"
($op || grep -q "pptpd_enable" "$tmpfile") && $(nvram set pptpd_enable="0") || printf '%s\n' "Skipping pptpd_enable"
($op || grep -q "pptpd_mppe" "$tmpfile") && $(nvram set pptpd_mppe="0") || printf '%s\n' "Skipping pptpd_mppe"
($op || grep -q "pptpd_mru" "$tmpfile") && $(nvram set pptpd_mru="1450") || printf '%s\n' "Skipping pptpd_mru"
($op || grep -q "pptpd_mtu" "$tmpfile") && $(nvram set pptpd_mtu="1450") || printf '%s\n' "Skipping pptpd_mtu"
($op || grep -q "vpn_server_c2c" "$tmpfile") && $(nvram set vpn_server_c2c="0") || printf '%s\n' "Skipping vpn_server_c2c"
($op || grep -q "vpn_server_ccd" "$tmpfile") && $(nvram set vpn_server_ccd="0") || printf '%s\n' "Skipping vpn_server_ccd"
($op || grep -q "vpn_server_ccd_excl" "$tmpfile") && $(nvram set vpn_server_ccd_excl="0") || printf '%s\n' "Skipping vpn_server_ccd_excl"
($op || grep -q "vpn_server_cipher" "$tmpfile") && $(nvram set vpn_server_cipher="AES-128-CBC") || printf '%s\n' "Skipping vpn_server_cipher"
($op || grep -q "vpn_server_comp" "$tmpfile") && $(nvram set vpn_server_comp="-1") || printf '%s\n' "Skipping vpn_server_comp"
($op || grep -q "vpn_server_crypt" "$tmpfile") && $(nvram set vpn_server_crypt="tls") || printf '%s\n' "Skipping vpn_server_crypt"
($op || grep -q "vpn_server_custom" "$tmpfile") && $(nvram set vpn_server_custom="push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"") || printf '%s\n' "Skipping vpn_server_custom"
($op || grep -q "vpn_server_dhcp" "$tmpfile") && $(nvram set vpn_server_dhcp="1") || printf '%s\n' "Skipping vpn_server_dhcp"
($op || grep -q "vpn_server_digest" "$tmpfile") && $(nvram set vpn_server_digest="default") || printf '%s\n' "Skipping vpn_server_digest"
($op || grep -q "vpn_server_firewall" "$tmpfile") && $(nvram set vpn_server_firewall="auto") || printf '%s\n' "Skipping vpn_server_firewall"
($op || grep -q "vpn_server_hmac" "$tmpfile") && $(nvram set vpn_server_hmac="-1") || printf '%s\n' "Skipping vpn_server_hmac"
($op || grep -q "vpn_server_if" "$tmpfile") && $(nvram set vpn_server_if="tun") || printf '%s\n' "Skipping vpn_server_if"
($op || grep -q "vpn_server_igncrt" "$tmpfile") && $(nvram set vpn_server_igncrt="0") || printf '%s\n' "Skipping vpn_server_igncrt"
($op || grep -q "vpn_server_local" "$tmpfile") && $(nvram set vpn_server_local="10.8.0.1") || printf '%s\n' "Skipping vpn_server_local"
($op || grep -q "vpn_server_ncp_ciphers" "$tmpfile") && $(nvram set vpn_server_ncp_ciphers="AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC") || printf '%s\n' "Skipping vpn_server_ncp_ciphers"
($op || grep -q "vpn_server_ncp_enable" "$tmpfile") && $(nvram set vpn_server_ncp_enable="1") || printf '%s\n' "Skipping vpn_server_ncp_enable"
($op || grep -q "vpn_server_nm" "$tmpfile") && $(nvram set vpn_server_nm="255.255.255.0") || printf '%s\n' "Skipping vpn_server_nm"
($op || grep -q "vpn_server_pdns" "$tmpfile") && $(nvram set vpn_server_pdns="0") || printf '%s\n' "Skipping vpn_server_pdns"
($op || grep -q "vpn_server_plan" "$tmpfile") && $(nvram set vpn_server_plan="1") || printf '%s\n' "Skipping vpn_server_plan"
($op || grep -q "vpn_server_poll" "$tmpfile") && $(nvram set vpn_server_poll="0") || printf '%s\n' "Skipping vpn_server_poll"
($op || grep -q "vpn_server_port" "$tmpfile") && $(nvram set vpn_server_port="8080") || printf '%s\n' "Skipping vpn_server_port"
($op || grep -q "vpn_server_proto" "$tmpfile") && $(nvram set vpn_server_proto="tcp-server") || printf '%s\n' "Skipping vpn_server_proto"
($op || grep -q "vpn_server_r1" "$tmpfile") && $(nvram set vpn_server_r1="192.168.1.50") || printf '%s\n' "Skipping vpn_server_r1"
($op || grep -q "vpn_server_r2" "$tmpfile") && $(nvram set vpn_server_r2="192.168.1.55") || printf '%s\n' "Skipping vpn_server_r2"
($op || grep -q "vpn_server_remote" "$tmpfile") && $(nvram set vpn_server_remote="10.8.0.2") || printf '%s\n' "Skipping vpn_server_remote"
($op || grep -q "vpn_server_reneg" "$tmpfile") && $(nvram set vpn_server_reneg="-1") || printf '%s\n' "Skipping vpn_server_reneg"
($op || grep -q "vpn_server_rgw" "$tmpfile") && $(nvram set vpn_server_rgw="0") || printf '%s\n' "Skipping vpn_server_rgw"
($op || grep -q "vpn_server_sn" "$tmpfile") && $(nvram set vpn_server_sn="10.8.0.0") || printf '%s\n' "Skipping vpn_server_sn"
($op || grep -q "vpn_server_unit" "$tmpfile") && $(nvram set vpn_server_unit="1") || printf '%s\n' "Skipping vpn_server_unit"
($op || grep -q "vpn_server_userpass_auth" "$tmpfile") && $(nvram set vpn_server_userpass_auth="1") || printf '%s\n' "Skipping vpn_server_userpass_auth"
 
Code:
echo "Restoring [VPN Server 1]"
($op || grep -q "VPNServer_mode" "$tmpfile") && $(nvram set VPNServer_mode="openvpn") || printf '%s\n' "Skipping VPNServer_mode"
($op || grep -q "pptpd_broadcast" "$tmpfile") && $(nvram set pptpd_broadcast="disable") || printf '%s\n' "Skipping pptpd_broadcast"
($op || grep -q "pptpd_chap" "$tmpfile") && $(nvram set pptpd_chap="0") || printf '%s\n' "Skipping pptpd_chap"
($op || grep -q "pptpd_clients" "$tmpfile") && $(nvram set pptpd_clients="192.168.10.2-11") || printf '%s\n' "Skipping pptpd_clients"
($op || grep -q "pptpd_enable" "$tmpfile") && $(nvram set pptpd_enable="0") || printf '%s\n' "Skipping pptpd_enable"
($op || grep -q "pptpd_mppe" "$tmpfile") && $(nvram set pptpd_mppe="0") || printf '%s\n' "Skipping pptpd_mppe"
($op || grep -q "pptpd_mru" "$tmpfile") && $(nvram set pptpd_mru="1450") || printf '%s\n' "Skipping pptpd_mru"
($op || grep -q "pptpd_mtu" "$tmpfile") && $(nvram set pptpd_mtu="1450") || printf '%s\n' "Skipping pptpd_mtu"
($op || grep -q "vpn_server_c2c" "$tmpfile") && $(nvram set vpn_server_c2c="0") || printf '%s\n' "Skipping vpn_server_c2c"
($op || grep -q "vpn_server_ccd" "$tmpfile") && $(nvram set vpn_server_ccd="0") || printf '%s\n' "Skipping vpn_server_ccd"
($op || grep -q "vpn_server_ccd_excl" "$tmpfile") && $(nvram set vpn_server_ccd_excl="0") || printf '%s\n' "Skipping vpn_server_ccd_excl"
($op || grep -q "vpn_server_cipher" "$tmpfile") && $(nvram set vpn_server_cipher="AES-128-CBC") || printf '%s\n' "Skipping vpn_server_cipher"
($op || grep -q "vpn_server_comp" "$tmpfile") && $(nvram set vpn_server_comp="-1") || printf '%s\n' "Skipping vpn_server_comp"
($op || grep -q "vpn_server_crypt" "$tmpfile") && $(nvram set vpn_server_crypt="tls") || printf '%s\n' "Skipping vpn_server_crypt"
($op || grep -q "vpn_server_custom" "$tmpfile") && $(nvram set vpn_server_custom="push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"") || printf '%s\n' "Skipping vpn_server_custom"
($op || grep -q "vpn_server_dhcp" "$tmpfile") && $(nvram set vpn_server_dhcp="1") || printf '%s\n' "Skipping vpn_server_dhcp"
($op || grep -q "vpn_server_digest" "$tmpfile") && $(nvram set vpn_server_digest="default") || printf '%s\n' "Skipping vpn_server_digest"
($op || grep -q "vpn_server_firewall" "$tmpfile") && $(nvram set vpn_server_firewall="auto") || printf '%s\n' "Skipping vpn_server_firewall"
($op || grep -q "vpn_server_hmac" "$tmpfile") && $(nvram set vpn_server_hmac="-1") || printf '%s\n' "Skipping vpn_server_hmac"
($op || grep -q "vpn_server_if" "$tmpfile") && $(nvram set vpn_server_if="tun") || printf '%s\n' "Skipping vpn_server_if"
($op || grep -q "vpn_server_igncrt" "$tmpfile") && $(nvram set vpn_server_igncrt="0") || printf '%s\n' "Skipping vpn_server_igncrt"
($op || grep -q "vpn_server_local" "$tmpfile") && $(nvram set vpn_server_local="10.8.0.1") || printf '%s\n' "Skipping vpn_server_local"
($op || grep -q "vpn_server_ncp_ciphers" "$tmpfile") && $(nvram set vpn_server_ncp_ciphers="AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC") || printf '%s\n' "Skipping vpn_server_ncp_ciphers"
($op || grep -q "vpn_server_ncp_enable" "$tmpfile") && $(nvram set vpn_server_ncp_enable="1") || printf '%s\n' "Skipping vpn_server_ncp_enable"
($op || grep -q "vpn_server_nm" "$tmpfile") && $(nvram set vpn_server_nm="255.255.255.0") || printf '%s\n' "Skipping vpn_server_nm"
($op || grep -q "vpn_server_pdns" "$tmpfile") && $(nvram set vpn_server_pdns="0") || printf '%s\n' "Skipping vpn_server_pdns"
($op || grep -q "vpn_server_port" "$tmpfile") && $(nvram set vpn_server_port="8080") || printf '%s\n' "Skipping vpn_server_port"
($op || grep -q "vpn_server_proto" "$tmpfile") && $(nvram set vpn_server_proto="tcp-server") || printf '%s\n' "Skipping vpn_server_proto"
($op || grep -q "vpn_server_r1" "$tmpfile") && $(nvram set vpn_server_r1="192.168.1.50") || printf '%s\n' "Skipping vpn_server_r1"
($op || grep -q "vpn_server_r2" "$tmpfile") && $(nvram set vpn_server_r2="192.168.1.55") || printf '%s\n' "Skipping vpn_server_r2"
($op || grep -q "vpn_server_remote" "$tmpfile") && $(nvram set vpn_server_remote="10.8.0.2") || printf '%s\n' "Skipping vpn_server_remote"
($op || grep -q "vpn_server_sn" "$tmpfile") && $(nvram set vpn_server_sn="10.8.0.0") || printf '%s\n' "Skipping vpn_server_sn"
($op || grep -q "vpn_server_unit" "$tmpfile") && $(nvram set vpn_server_unit="1") || printf '%s\n' "Skipping vpn_server_unit"
($op || grep -q "vpn_server_userpass_auth" "$tmpfile") && $(nvram set vpn_server_userpass_auth="1") || printf '%s\n' "Skipping vpn_server_userpass_auth"
($op || grep -q "vpn_server1_c2c" "$tmpfile") && $(nvram set vpn_server1_c2c="0") || printf '%s\n' "Skipping vpn_server1_c2c"
($op || grep -q "vpn_server1_ccd" "$tmpfile") && $(nvram set vpn_server1_ccd="0") || printf '%s\n' "Skipping vpn_server1_ccd"
($op || grep -q "vpn_server1_ccd_excl" "$tmpfile") && $(nvram set vpn_server1_ccd_excl="0") || printf '%s\n' "Skipping vpn_server1_ccd_excl"
($op || grep -q "vpn_server1_cipher" "$tmpfile") && $(nvram set vpn_server1_cipher="AES-128-CBC") || printf '%s\n' "Skipping vpn_server1_cipher"
($op || grep -q "vpn_server1_comp" "$tmpfile") && $(nvram set vpn_server1_comp="-1") || printf '%s\n' "Skipping vpn_server1_comp"
($op || grep -q "vpn_server1_crypt" "$tmpfile") && $(nvram set vpn_server1_crypt="tls") || printf '%s\n' "Skipping vpn_server1_crypt"
($op || grep -q "vpn_server1_custom" "$tmpfile") && $(nvram set vpn_server1_custom="push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"") || printf '%s\n' "Skipping vpn_server1_custom"
($op || grep -q "vpn_server1_dhcp" "$tmpfile") && $(nvram set vpn_server1_dhcp="1") || printf '%s\n' "Skipping vpn_server1_dhcp"
($op || grep -q "vpn_server1_digest" "$tmpfile") && $(nvram set vpn_server1_digest="default") || printf '%s\n' "Skipping vpn_server1_digest"
($op || grep -q "vpn_server1_errno" "$tmpfile") && $(nvram set vpn_server1_errno="0") || printf '%s\n' "Skipping vpn_server1_errno"
($op || grep -q "vpn_server1_firewall" "$tmpfile") && $(nvram set vpn_server1_firewall="auto") || printf '%s\n' "Skipping vpn_server1_firewall"
($op || grep -q "vpn_server1_hmac" "$tmpfile") && $(nvram set vpn_server1_hmac="-1") || printf '%s\n' "Skipping vpn_server1_hmac"
($op || grep -q "vpn_server1_if" "$tmpfile") && $(nvram set vpn_server1_if="tun") || printf '%s\n' "Skipping vpn_server1_if"
($op || grep -q "vpn_server1_igncrt" "$tmpfile") && $(nvram set vpn_server1_igncrt="0") || printf '%s\n' "Skipping vpn_server1_igncrt"
($op || grep -q "vpn_server1_local" "$tmpfile") && $(nvram set vpn_server1_local="10.8.0.1") || printf '%s\n' "Skipping vpn_server1_local"
($op || grep -q "vpn_server1_ncp_ciphers" "$tmpfile") && $(nvram set vpn_server1_ncp_ciphers="AES-128-GCM:AES-256-GCM:AES-128-CBC:AES-256-CBC") || printf '%s\n' "Skipping vpn_server1_ncp_ciphers"
($op || grep -q "vpn_server1_ncp_enable" "$tmpfile") && $(nvram set vpn_server1_ncp_enable="1") || printf '%s\n' "Skipping vpn_server1_ncp_enable"
($op || grep -q "vpn_server1_nm" "$tmpfile") && $(nvram set vpn_server1_nm="255.255.255.0") || printf '%s\n' "Skipping vpn_server1_nm"
($op || grep -q "vpn_server1_pdns" "$tmpfile") && $(nvram set vpn_server1_pdns="0") || printf '%s\n' "Skipping vpn_server1_pdns"
($op || grep -q "vpn_server1_plan" "$tmpfile") && $(nvram set vpn_server1_plan="1") || printf '%s\n' "Skipping vpn_server1_plan"
($op || grep -q "vpn_server1_poll" "$tmpfile") && $(nvram set vpn_server1_poll="0") || printf '%s\n' "Skipping vpn_server1_poll"
($op || grep -q "vpn_server1_port" "$tmpfile") && $(nvram set vpn_server1_port="8080") || printf '%s\n' "Skipping vpn_server1_port"
($op || grep -q "vpn_server1_proto" "$tmpfile") && $(nvram set vpn_server1_proto="tcp-server") || printf '%s\n' "Skipping vpn_server1_proto"
($op || grep -q "vpn_server1_r1" "$tmpfile") && $(nvram set vpn_server1_r1="192.168.1.50") || printf '%s\n' "Skipping vpn_server1_r1"
($op || grep -q "vpn_server1_r2" "$tmpfile") && $(nvram set vpn_server1_r2="192.168.1.55") || printf '%s\n' "Skipping vpn_server1_r2"
($op || grep -q "vpn_server1_remote" "$tmpfile") && $(nvram set vpn_server1_remote="10.8.0.2") || printf '%s\n' "Skipping vpn_server1_remote"
($op || grep -q "vpn_server1_reneg" "$tmpfile") && $(nvram set vpn_server1_reneg="-1") || printf '%s\n' "Skipping vpn_server1_reneg"
($op || grep -q "vpn_server1_rgw" "$tmpfile") && $(nvram set vpn_server1_rgw="0") || printf '%s\n' "Skipping vpn_server1_rgw"
($op || grep -q "vpn_server1_sn" "$tmpfile") && $(nvram set vpn_server1_sn="10.8.0.0") || printf '%s\n' "Skipping vpn_server1_sn"
($op || grep -q "vpn_server1_userpass_auth" "$tmpfile") && $(nvram set vpn_server1_userpass_auth="1") || printf '%s\n' "Skipping vpn_server1_userpass_auth"
 
Hi Xentrk,

Unfortunately I went ahead and remarked out that bad line at the time and then ran the restore again with no issues. The file is no longer available as I trashed everything and started from scratch after realizing what was happening. It seems to me that it fails at the restore because it doesn't understand what to do with the \ that's been put into the line but as an amateur I'm just guessing. I've inserted the relevant contents of the new restore SH file into code boxes below. Just search for the word PUSH and you'll see that it mangles the custom VPN config commands and I believe that's where it fails. The command should look like push "route 192.168.2.1 255.255.255.255 10.8.0.1 21" but ends up looking like (nvram set vpn_server_custom="push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\"")

Hopefully this can help you. The next time I reflash my box I'll save the file again.
Thanks for the follow up. Excellent feedback. That should help me pinpoint the root cause. I'm back home and online now and will take a look at the code. The intent of the slash e.g. "\" is an escape character so the " is used as a character rather than quotes around text. It should result in this being the nvram value:

Code:
push "route 192.168.2.1 255.255.255.255 10.8.0.1 21"

I did some testing and the most current output you posted works.

The only thing I can think of is there was a hiccup when the nvram-save.sh script ran which produced the line 652 error message. I pasted the code from your OP.

The first printf and the two single quotes should not be there. There should be:
printf '%s\n' for the second printf reference.


Code:
Line 2:
nvram set vpn_server1_custom="$(printf '' "push \"route 192.168.2.1 255.255.255.255 10.8.0.1 21\" management localhost 4242")" || printf '' "Skipping vpn_server1_custom"
                                       ^-- SC2182: This printf format string has no variables. Other arguments are ignored.

So something got mucked up when it ran. But from the logs you posted above, the code is now correct.

You may want to run a chkdsk scan on the USB just to make sure all is good with it.
 
Last edited:
With so much angst over doing factory resets/format jffs in the Beta discussion threads, why are people not using nsrum? I believe this restores some “elements“ of the nvram; very different than an Asus nvram restore.
I did use nsrum recently on an upgrade - my AX88u seems to run fine.
Anyone have issues using nsrum pre-post a firmware update?
 

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