[SPLIT] nvram erase vs factory defaults

Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware
Author Message
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sat Jun 18, 2022 21:28    Post subject: [SPLIT] nvram erase vs factory defaults Reply with quote
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.

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.

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)


Last edited by the-joker on Fri Jul 01, 2022 8:44; edited 3 times in total
Sponsor
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Sat Jun 18, 2022 22:11    Post subject: Reply with quote
the-joker wrote:
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

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sat Jun 18, 2022 22:22    Post subject: Reply with quote
And this was the time where I split the thread. thx.
_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
Duxa
DD-WRT User


Joined: 16 Aug 2013
Posts: 191

PostPosted: Sun Jun 19, 2022 6:00    Post subject: Reply with quote
so, what a non destructive way to do the most clean possible if Factory Reset button in GUI is not sufficient.

I dont want to get into a situation where I am restoring flash via serial.
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12837
Location: Netherlands

PostPosted: Sun Jun 19, 2022 7:20    Post subject: Reply with quote
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!:
Code:
erase nvram
Do not try this at home!
(this is the same as mtd erase nvram)

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
Alozaros
DD-WRT Guru


Joined: 16 Nov 2015
Posts: 6410
Location: UK, London, just across the river..

PostPosted: Sun Jun 19, 2022 10:04    Post subject: Reply with quote
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 ... Cool

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
the-joker
DD-WRT Developer/Maintainer


Joined: 31 Jul 2021
Posts: 2146
Location: All over YOUR webs

PostPosted: Sun Jun 19, 2022 10:22    Post subject: Reply with quote
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.

Sure if a more stubborn gremlin resists, there is also the hammer. lol

_________________
Saving your retinas from the burn!🔥
DD-WRT Inspired themes for routers
DD-WRT Inspired themes for the phpBB Forum
DD-WRT Inspired themes for the SVN Trac & FTP site
Join in for a chat @ #style_it_themes_public:matrix.org or #style_it_themes:discord

DD-WRT UI Themes Bug Reporting and Discussion thread

Router: ANus RT-AC68U E1 (recognized as C1)
dale_gribble39
DD-WRT Guru


Joined: 11 Jun 2022
Posts: 1899

PostPosted: Sun Jun 19, 2022 10:54    Post subject: Reply with quote
the-joker wrote:
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

<fact>code knows no gender</fact>

This is me, knowing I've ruffled your feathers, and not giving a ****
Some people are still hard-headed.

--------------------------------------
Mac Pro (Mid 2012) - Two 2.4GHz 6-Core Intel Xeon E5645 processors 64GB 1333MHz DDR3 ECC SDRAM OpenSUSE Leap 15.5
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Broadcom SoC based Hardware All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum