OpenWrt offers several ways to “start over” with your router.
OpenWrt allows you to boot into a failsafe mode that overrides its current configuration. If your device becomes inaccessible, e.g. after a configuration error, then failsafe mode is there to help you out. When you reboot in failsafe mode, the device starts up in a basic operating state, with a few hard coded defaults, and you can begin to fix the problem manually.
Failsafe mode cannot, however, fix more deeply rooted problems like faulty hardware or a broken kernel. It is similar to a reset, however with failsafe, you can to access your device and restore settings if desired, whereas a reset would just wipe everything.
Caveat: Failsafe mode is only available if you have installed firmware from a SquashFS image, that includes the required read-only root partition. To verify whether your device has the SquashFS root partition, check for “squashfs” either in the OpenWrt image name or perform the following check on your device:
grep squash /proc/mounts
The terminal should return something similar to this:
/dev/root /rom squashfs ro,relatime 0 0
Make sure you use a wired connection, since the failsafe will disable your wireless connectivity.
On most routers, OpenWrt will blink a LED (usually “Power”, may be other) during the boot process after it gets control from the initial bootloader (like u-boot). OpenWrt will rather early in the boot cycle check if the user wants to enter the failsafe mode instead of a normal boot. It listens for a button press inside a specific two second window, which is indicated with LEDs and by transmitting an UDP package.
There are three different (power) LED blinking speeds during boot for most of the routers:
To enter failsafe mode, follow one of the procedures listed below:
tcpdump -Ani eth0 port 4919 and udp
Usually, it is easiest to watch the LEDs. However, do consult the available documentation for your device, as there is no default button assigned as a reset button and not all procedures work on every device. Whichever trigger you use, the device will enter failsafe mode and you can access the command line with SSH (always possible) or a serial keyboard.
Note that modern OpenWrt uses always SSH, but early OpenWrt releases (15.05 and before) offered a telnet connection in this state but no SSH.
Note: old OpenWrt wiki page offer more details, most of them still valid: https://wiki.openwrt.org/doc/howto/generic.failsafe
Once failsafe mode is triggered, the router will boot with a network address of 192.168.1.1/24, usually on the eth0 network interface, with only essential services running. Using SSH or a serial connection, you can then mount the JFFS2 partition with the following command:
After that, you can start looking around and fix what’s broken. The JFFS2 partition will be mounted to /overlay, as under normal operation.
A factory reset returns your router to the configuration it had just after flashing. This works on any install with a squashfs / overlayfs setup (the norm for most installations), since it is based on erasing and reformatting the overlayfs. Note: X86 builds with an ext4 read-write rootfs cannot be reset this way.
With a large NOR chip, it can take 3 to 5 minutes for the overlayfs to be formatted in the flash. During this time, changes cannot be saved.
If you want a clean slate, there’s no need to flash again; just enter the following commands. Your device's settings will be reset to defaults like when OpenWrt was first installed.
umount /overlay && firstboot && reboot
Note: for most routers, “firstboot” actually just issues a “jffs2reset” command, so there is no difference compared to the “hard reset” advice below.
umount /overlay && firstboot && reboot
does not work, try those commands on separate lines in the terminal.
This command will erase and reformat the whole jffs2 partition and create it again:
umount /overlay && jffs2reset && reboot
While essentially doing the same thing as firstboot, this actually rewrites the whole flash area of the JFFS2 (read-write) partition instead of just re-formatting it.
If neither Failsafe Mode nor Factory Reset returns control of your router, you can often replace the firmware of your device using one of the procedures described on the Recovery Mode page.