OpenWrt Forum Archive

Topic: Resetting NVRAM to Defaults

The content of this topic has been archived on 18 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

I'm sure I'm going to get clobbered on this, but I've Googled and still don't have an answer I'm clear on.  In the "Common Mistakes" section, I found this:

#8 STUPID:
"I've reset the nvram to defaults using the mtd command, now my router is all screwed up"

The mtd command will simply erase NVRAM. It will not reset it to defaults. It's up to CFE (the bootloader) to detect that NVRAM is missing and setup some NVRAM variables. As it turns out, most devices are incapable of this, and erasing NVRAM breaks the router until the variables are somehow reset -- in some cases requiring a serial cable.

Okay, I can see that and see why it's a problem.  But there is another point here: This says what NOT to do, but it doesn't say what TO do.  So people (in this case me, but it's clear others or this wouldn't be an issue) want to return the NVRAM values to the defaults.  This says what does NOT work, but what DOES work?

I've Googled through the site and my best guess is that running firstboot should do this, but that's not clear as well.  I looked for a "firstboot" entry in the wiki and didn't find one.  (It's not in the world index at all.)

So what does reset NVRAM to default values?

By  pushing the RESET button ?

That "#8" may have been written when there were routers that didn't initialize a blank NVRAM.  CFE (the boot code... hardly ever changed... NOT to be confused with firmware) should do it automatically.  "FirstBoot" does a little more when it runs but relatively little.

I've read some older WRT54G/WRT54GS had problems doing this.  It's not true of the Gv4 or GSv3 because I do it all the time.  The GL should also be no problem (a repackaged WRT54Gv4).  Non-Linksys I have no idea.  BUT... you didn't mention what router you're talking about, either.

Seriously, I learned more about the old WRT structure by reading all the posts by "mbm" (Mike Baker, OpenWrt co-Founder).  He should be required reading and I'm sorry to say he hasn't written much lately.

The discussion might have continued from here.