1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

nvram erase; reboot = press in reset button for 30 secs?

Discussion in 'DD-WRT Firmware' started by habskilla, Dec 12, 2005.

  1. habskilla

    habskilla Network Guru Member

    Wondering because I remote desktop to the computer that is physically connected to the router. I was wondering if nvram erase; reboot is good enough?

    Just trying to save myself a trip to the router each time I want to upgrade the firmware.
     
  2. sded

    sded Network Guru Member

    Works fine for me when changing FW versions. Within V23, just load the new firmware unless the notes warn otherwise. Brainslayer warns agains saving settings between versions, but I have had no problems within V23.
     
  3. 4Access

    4Access Network Guru Member

    I don't know if it ever did anyting in the past but I can say for sure that the 'nvram erase' command currently has no affect at all!

    The simple proof of this is that after executing the command none of the configuration options in the web GUI have been reset!

    Also you'll notice that if you simply execute 'nvram' by itself the quick help shows the following:

    Notice that there is no "erase" parameter... Further, try appending any random parameter onto the end of the nvram command. Something like:

    nvram sddsslksfjkwpds

    You'll notice that it simiply returns without giving an error even though "sddsslksfjkwpds" is obviously not a valid parameter.

    So in summary: nvram erase is not a valid command!!!

    Instead use:

    mtd erase nvram

    Which is valid and works just like holding the reset button for 30 seconds.

    Speaking of holding the reset button...

    I've discovered that how long you hold the reset button is very significant!!!

    For example, you'll notice that about 5 sec after you start holding the reset button the power LED will begin to blink. If you let go of the power button and let the device reboot you'll notice that all the options in the web GUI have been reset to their default values... BUT nvram was NOT completely reset!!! If you check you'll discover that only the default nvram variables have been reset, any custom nvram variables you may have defined are left alone!

    Proof:

    1. Start by holding reset button for a FULL 30 sec to start from a clean state.

    2. Log into web GUI and change a few settings.

    3. Log into telnet and execute the following commands:

    nvram set test=HELLO
    nvram commit
    reboot

    4. After the router reboots log into telnet again and execute the following command:

    nvram get test

    5. When you ran the command above you should have seen "HELLO" spit back at you. That means you've successfully set a custom nvram variable.

    6. Hold the reset button JUST UNTIL THE POWER LED STARTS BLINKING THEN LET GO!! (Should be about 5 seconds.)

    7. After the router reboots log into the web GUI and notice that all the settings you changed are back to their defaults.

    8. Log into telnet and execute the following command:

    nvram get test

    9. You should notice that the output is still "HELLO" which proves that nvram was NOT completely wiped!!

    10. This time hold the reset button for a full 30 seconds!!!

    11. Once the router reboots log into telnet again and execute the same command:

    nvram get test

    12. This time the command should simply return without printing "HELLO".


    What's happening:

    When the reset button is held down for about 5 seconds all the default nvram variables are reset to their default values but it's not until the reset button is held down while the router starts up that nvram is completely cleared! By telling people to hold the reset button for 30 seconds it's ensuring that they are still holding the reset button while the router goes through the boot up process which triggers the complete erasure of nvram.

    Further proof:

    1. Log into telnet and execute the following commands:

    nvram set test=HELLO
    nvram commit

    2. Unplug the router

    3. Plug the router back in and after it has started up log into telnet and execute the following command just to prove to yourself that the nvram variable "test" was successfully configured:

    nvram get test

    4. Unplug the router again.

    5. This time press and hold the reset button before you plug in the router.

    6. Wait only 5 seconds after you've plugged in the router and then release the reset button.

    7. After the router has booted log into telnet and check nvram, you'll notice that it has been cleared even though you only held the reset button for a few seconds while the router was booting:

    nvram get test


    This also explains why sometimes you will hear suggestions that you hold the reset button for 30 seconds, then unplug the router without letting go of the reset button, wait 30 more seconds, and finally plug the router back in without letting go of the reset button until another 30 seconds have passed. They're just trying to be sure you're holding down the reset button while the device starts up since that's what really clears nvram.

    BTW, the command 'mtd erase nvram' fully erases nvram just as though you held the reset button for a full 30 seconds.

    :thumb:
     
  4. sded

    sded Network Guru Member

    Seems to be a bit of confusion here. The command most of us have been using is "erase nvram; reboot". "erase" returns
    "usage: erase [device]"
    and isn't nvram a device? In any case, after the command and reboot, everything is back at the default value for whatever firmware you load. I have not had a brick since I started using it with Tofu, Thibor, and dd-wrt. Seems to be equivalent to the 30 second hold down, but have not tried to investigate further.
     
  5. 4Access

    4Access Network Guru Member

    Ah, there was some confusion. Double-check the title of this thread, he didn't ask about 'erase nvram' he asked about 'nvram erase' ;)

    But you're right, 'erase nvram' also does the same thing as holding the reset button for 30 sec. :)
     
  6. habskilla

    habskilla Network Guru Member

    fascinating...

    I'm glad I asked the question.
     
  7. sterix

    sterix Network Guru Member

    Hi 4 Access,
    I'm having problem accessing my WRT54G through telnet. Mine is a v3.03 and I'm using win xp dos command window. Telnet complains that it could not open connection to the host on port 23. No connection could be made because the target machine actively refused it.

    I made sure to disable the firewall. Am I missing something ?

    Thanks.
     
  8. 4Access

    4Access Network Guru Member

    You must be running a firmware like DD-WRT that includes telnet. The default Linksys firmware does not include telnet support.
     
  9. devil-strike

    devil-strike Network Guru Member

    Hmm intresting, i have the v2.2 and have the same problem if i use mtd erase nvram; reboot
    in v22 of dd-wrt is have working perfectly, and in v23 it have never worked.
    only power off/on is helping me.
     
  10. 4Access

    4Access Network Guru Member

    There is a known issue with the 'mtd erase nvram;reboot' command causing the router to lock up in v23 final (12/25/05).

    See bug 170
     

Share This Page