Knowledgebase:
How-To: Clear OpenWRT config back to 'factory' settings
Posted by rbTech Staff, Last modified by rbTech Staff on 25 August 2014 03:30 PM

It's rare, but it does happen occasionally... the config on an OpenWRT flashed devices gets well and hosed, and the easiest thing to do is simply nuke the thing and start all over again.  How?  Here's how:

Triggering via Hardware Button (Standard OpenWrt method)

 

Stage 0: Router preparation

  • Power off the router
  • Unplug the WAN port (in case that WAN IP address and LAN IP address are same (address collision happened), if you do not plug out wan port, you cannot enter failsafe mode)

Stage 1: Computer IP settings

  • Set your computer's IP to 192.168.1.2, subnet 255.255.255.0. The router will be reached at 192.168.1.1 when failsafe mode is running.

Stage 2: Detect when failsafe mode can be triggered

  • To detect when failsafe mode can be triggered, there are two options: look for a bootup LED blink pattern, or look for a special broadcast packet from the router

Stage 2 option 1: Trigger failsafe mode when the SYS LED begins to blink

On some routers (e.g. TP-LINK models), OpenWrt will start to blink a LED (e.g. the "SYS" LED) on the front of the router when it is in its early boot cycle. The blink rate is about twice a second. Looking for a blink pattern is much more convenient to use instead of having to use a packet sniffer.

  • Power on the router
  • As soon as this blink pattern is seen, press the hardware button the front of the router
  • The SYS LED will change to faster blink pattern, indicating the router is now in failsafe mode

On some TP-Link routers, the button is on the back of the unit (often labeled "WPS/Reset"). The switch may have a physical button, or may be behind a hole in the case and require a paper clip or similar tool to operate.

At least one TP-Link router seems to respond better to repeatedly clicking the button before the SYS LED starts to blink, until the SYS LED lights with the rapid-flash pattern.

(The above is a cut and paste from http://wiki.openwrt.org/doc/howto/generic.failsafe per their Creative Commons 3.0/ attribution license terms)

In short, if you can telnet/ SSH to it, do so as a privileged user, and do:

  • mount_root
  • mtd -r erase rootfs_data
  • reboot -f

That's it :)

 

(96 vote(s))
Helpful
Not helpful

Comments (20)
0E800
01 July 2014 07:57 PM
Thank you. I found this helpful.
al caughey
20 August 2014 06:36 PM
What if you cannot telnet or SSH? Then what?
Rubin Bennett
25 August 2014 08:31 PM
@Al Caughey, if you cannot telnet or SSH, first confirm that the router is actually in failsafe mode (as indicated by the config/ DMZ light flashing on your router). Most likely it's not actually in failsafe mode. If you cannot get it in failsafe, there's a reasonable chance that the router is bricked and cannot be recovered. If it's in failsafe then there's a high likelihood that you haven't configured your workstation's IP address correctly, and you're working on a Layer 3 problem, not one in the router itself.

Good luck!
Jeremy
08 October 2014 03:36 AM
On my router (TP-Link TL-WR841N), I had to use the WAN port to telnet to the box.
Ishaq Khan
18 October 2014 01:27 AM
Using Telnet in windows 7

Open the command prompt and type "telnet" (On Windows vista/7 you will need to install it from "programs and features").
so in the command prompt write down
telnet 192.168.1.1
Andrew
19 December 2014 05:12 AM
Man, this is great! You save my life!

Thank's a LOT!
BW
03 February 2015 04:05 PM
How to reset the router to "factory" defaults when you are able to connect with SSH (i.e. I don't need to go into safe mode).
I have found description on how to do this:
1: killall dropbear uhttpd; sleep 1; mtd -r erase rootfs_data
2: fastboot
reboot -f
3: mtd -r erase rootfs_data
reboot -f

Or do I have to start in safe-mode?
Shahrukh
18 February 2015 02:45 AM
my router lan ip is dhcp mode i cant find ipv4 address and also cannot access router.... how can i reset my router plzz help me...
rohan
21 February 2015 12:00 PM
hi in cmd i cant telnet to 192.168.1.1 but i can ping also i cant login to openwrt page as i disable everything in interface option,after that i cant open or connect any any one help
Scott
01 April 2015 07:49 PM
I used the "firstboot" command rather than "mtd" to restore the default settings. (for some reason, the "mtd" command gave me an error, but "firstboot" worked great for me.)
Leonardo
26 June 2015 05:41 PM
What if, just wondering, what if the reset button works just like all models when you press and hold for 10 seconds? Why openwrt needs to be different ? =/ even dd-wrt follow the idea behind a "reset" button.
John
06 July 2015 10:22 PM
Hi,

I am able to change the settings in the file under overlay and settings will get change, but when i do factory reset from GUI, All the changes i have done in script file will go. So i need to know from which file this all factory reset configuration is loading so that if i will change it that file with my default configuration.

So that after factory reset it should load with my default settings.

Thanks,
John
Dave
13 February 2016 08:40 AM
Thank you SO much! My router WAS well and truly "hosed" for sure (I *almost* tossed it, glad I didn't), took me about 800 tries, but I FINALLY got back in! Just in case anyone needs it, on Linksys/Cisco WRT160NL, the WPS LED flashes nonstop very rapidly when it goes into failsafe mode. Took me awhile to get that sorted, maybe it'll save someone else some heartache, thanks again!
Dave
Sakui
13 April 2016 04:49 AM
I can get my openwrt into failsafe mode, but I can't login via SSH or telnet. When I ping my router, I get a timeout error. I used chrome to login and it's a no go. I hope I didn't brick it.
Markus Dufner
27 June 2016 12:34 PM
Exactly what I searched for. Thanks.
Stefan
18 September 2016 03:11 PM
I can connect via telnet and also execute the passwd command the password change dialoge starts and asks me for an new password but I can not enter anything.
Any ideas what I have done wrong?
Adoobis
06 August 2017 08:06 PM
Yeah it doesnt show what your typing but you are in fact typing
maxikraxi
08 November 2016 09:19 AM
i can connect via telnet
but the command firstboot is not working (nothing happens)
any ideas?
it is a router with a crappy airfy software on it
moomgraphic
05 March 2017 02:40 PM
Ingenious. Thank you
rado
01 September 2017 08:04 AM
Just in case anyone is not able to connect over telnet, telnet uses port 23. If you are using
putty make sure to set the port to 23, otherwise putty uses port 22 as default.
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).