Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Sat Jun 18, 2022 21:28 Post subject: [SPLIT] nvram erase vs factory defaults
dale_gribble39 wrote:
Administration -> Factory Defaults is not entirely the same exact thing as doing an nvram erase && reboot or an mtd -r erase nvram && reboot (the latter being a high-risk maneuver that can result in a bricked device). That function only restores default configurations via resetbutton functionality. The other two wipe the partition completely as best I understand it.
It's not exactly but does pretty much the same by the time the router reboots.
Restore to factory defaults wipes all user configuration restoring parameter values to default.
nvram erase|clear deletes all nvram parameters but keeps important system variables otherwise you have an unusable system, so if it just wiped the whole partition there would be trouble, that should never happen.
sysinit (various per device files) have the defaults that are restored at boot per machine so it all ends up being the same in the end all parameters values are back to defaults.
And for this end we now have command line nvram help entries added from commit r49247 to r49251 that explain what these things do exactly nvram command wise.
Restore to factory defaults wipes all user configuration restoring parameter values to default.
It does not clear anything set by nvram set like nvram erase does.
the-joker wrote:
nvram erase|clear deletes all nvram parameters but keeps important system variables otherwise you have an unusable system, so if it just wiped the whole partition there would be trouble, that should never happen.
Which is my the mtd -r erase command is so volatile since it has raw access to that partition, as best I recall.
the-joker wrote:
sysinit (various per device files) have the defaults that are restored at boot per machine so it all ends up being the same in the end all parameters values are back to defaults.
Parameters are checked and if they exist, they are not (re)set; Certain changes over the years require a rest to defaults at a minimum, if not an nvram erase.
the-joker wrote:
And for this end we now have command line nvram help entries added from commit r49247 to r49251 that explain what these things do exactly nvram command wise.
Finally.
the-joker wrote:
As for the rest mtd erase commands and cfe nvram erase commands are not to be used without backups or by someone who knows wtf their doing.
Agreed. _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio
Joined: 18 Mar 2014 Posts: 12837 Location: Netherlands
Posted: Sun Jun 19, 2022 7:20 Post subject:
From CLI:
Code:
nvram erase && reboot
But actually I think the factory reset from the GUI should do the same, but this is the way I am doing it.
(If you have an Asus router there is the WDS button trick I think it goes like this:
Power down
Press WDS and while holding power up.
Keep the WDS button pressed for 25 sec and then release)
The destructive way and *not* recommended as it will brick some routers is just erasing the whole nvram partition, it only works if you cut the power after erasing!:
Joined: 16 Nov 2015 Posts: 6410 Location: UK, London, just across the river..
Posted: Sun Jun 19, 2022 10:04 Post subject:
dale_gribble39/KP-69 wrote:
Reset to default via GUI...
It does not clear anything set by nvram set like nvram erase does.
i haven't explored this option yet...but it sounds handy, as i have some nvram values on my R9000 that are odd by reset to default via(nvram erase), so i have to set them manually via nvram set...afterwards, if those will stay on GUI reset, this is my goal then...will try is soon ...
I always been using nvram erase or nvram clear(now)...(erase nvram on the older builds)...and never had an issue with it...
mtd -r erase nvram is brutal...but if im not wrong ive done it on bricked devices...only...!!
and then mtd -f write tl-wr1043nd-v2.bin linux _________________ Atheros
TP-Link WR740Nv1 ---DD-WRT 55179 WAP
TP-Link WR1043NDv2 -DD-WRT 55303 Gateway/DoT,Forced DNS,Ad-Block,Firewall,x4VLAN,VPN
TP-Link WR1043NDv2 -Gargoyle OS 1.15.x AP,DNS,QoS,Quotas
Qualcomm-Atheros
Netgear XR500 --DD-WRT 55460 Gateway/DoH,Forced DNS,AP Isolation,4VLAN,Ad-Block,Firewall,Vanilla
Netgear R7800 --DD-WRT 55460 Gateway/DoT,AD-Block,Forced DNS,AP&Net Isolation,x3VLAN,Firewall,Vanilla
Netgear R9000 --DD-WRT 55363 Gateway/DoT,AD-Block,AP Isolation,Firewall,Forced DNS,x2VLAN,Vanilla
Broadcom
Netgear R7000 --DD-WRT 55460 Gateway/SmartDNS/DoH,AD-Block,Firewall,Forced DNS,x3VLAN,VPN
NOT USING 5Ghz ANYWHERE
------------------------------------------------------
Stubby DNS over TLS I DNSCrypt v2 by mac913
Joined: 31 Jul 2021 Posts: 2146 Location: All over YOUR webs
Posted: Sun Jun 19, 2022 10:22 Post subject:
egc wrote:
From CLI:
Code:
nvram erase && reboot
But actually I think the factory reset from the GUI should do the same, but this is the way I am doing it.
Via the UI or reset button or gpio 11 process is technically different from nvram erase|clear but when router reboots on the other side of any of them, ends up the same, since what was wiped (minus system parameters and values) is added via sysinit if its not present.
To do the same as UI factory defaults or reset button on Broadcom via command line, its enabling gpio 11 or disabling it, idk if the polarity is reversed or not, never tried.
The point is no matter the method chosen as above, no user set parameter values survive either process, and if it did, it would be pointless.
I tried this after setting the hidden console_debug=1 and after reset button the parameter was no longer present nor its value, obviously.
The point is no matter the method chosen as above, no user set parameter values survive either process, and if it did, it would be pointless.
I tried this after setting the hidden console_debug=1 and after reset button the parameter was no longer present nor its value, obviously.
Because console_debug is not a default parameter name. I should've been more specific. The webUI and sysinit check for default parameter names being present. Not the values. _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio