When OpenWrt becomes unreachable after a network or firewall change, I do not jump straight to a factory reset. Failsafe boots a minimal state so I can repair /etc/config, while a factory reset removes the overlay and installed packages. Recovery/re-flashing is a separate path controlled by the device bootloader.1
Check the prerequisites
Failsafe is useful with a SquashFS image that has a read-only root and a separate overlay. It cannot repair failed hardware or a broken kernel. x86 builds using an ext4 read-write rootfs do not reset this way. First check:
| |
A result similar to the following confirms a SquashFS /rom:
| |
Enter failsafe mode
Failsafe normally uses 192.168.1.1 with DHCP and Wi-Fi disabled. I assign the computer 192.168.1.10/24 with netmask 255.255.255.0, connect by Ethernet, and try LAN1 first; some DSA devices expose only LAN1. The button window may be four seconds on OpenWrt 24.10 and later and two seconds on 23.05 and earlier, but the target's device page remains authoritative.
The simplest path is to power on the router, watch the LED pattern, and press the WPS/Reset button documented for that model. A very fast blink commonly indicates failsafe; if the window is missed, power-cycle and try again. Do not generalize the button timing across models.
With a packet sniffer, wait for the broadcast to 192.168.1.255 on UDP port 4919, then press the button:
| |
With a serial connection, wait for the boot message asking for f followed by Enter. Once in failsafe, use SSH or the serial keyboard. If OpenSSH reports Bad server host key: Invalid key length, the source calls out -oRSAMinSize=1024.
| |
Repair the configuration
DHCP is not running and only essential services are available. After connecting to 192.168.1.1 over SSH/serial, mount the overlay:
| |
The overlay is then available at /overlay. I edit only the file that caused the failure, using scp from Linux/macOS or WinSCP on Windows when needed. For extroot, the source's separate path is to unplug the external device, reboot, attach it again, mount the correct device, fix the mounted configuration, and verify fstab:1
| |
If mount_root reports jffs2 not ready yet or the filesystem is full, check df -h first. When the source's recovery branch requires erasing rootfs_data, treat it as a destructive configuration wipe:
| |
Factory reset
Factory reset works on SquashFS/overlay layouts. A large NOR may take three to five minutes to format; I do not declare the router dead during that interval. If the device has a physical reset button, follow the model-specific procedure: complete boot or enter failsafe, hold Reset for about ten seconds, release it, and wait for the reboot.
Soft factory reset
The file-based path uses firstboot; the source also notes that firstboot commonly calls jffs2reset and may not be enough when the overlay is abnormal:
| |
| |
Use -y inside a script so it does not wait for confirmation. Installed packages and overlay configuration can disappear, so I keep an offline backup first.
Hard factory reset
If a soft reset is insufficient, mtd marks rootfs_data for erasure at boot:
| |
The source separately describes a physical reset: wait for the LED to stop blinking, hold Reset for ten seconds, release it, and wait several minutes. I only use that procedure after checking the exact model documentation.
Re-flash the firmware
To re-install firmware while discarding settings, use a sysupgrade image, not a factory image, and opt out of preserving configuration:
| |
Re-flashing does not fix a dead bootloader or failed hardware. I verify the device page, image, TFTP/serial method, and recovery button before starting.
JFFS2 reset
For a JFFS2 overlay, the source gives this unmount-and-reset path:
| |
The source notes that jffs2reset was renamed to factoryreset in main/master after December 2024. I check the command available in the running release instead of blindly renaming it.
F2FS reset
The source also includes an F2FS example:
| |
This is dangerous: I verify /dev/loop0 and the target layout before using it. I never assume that another F2FS router uses the same loop device.
Verify the recovery
After the router returns, test 192.168.1.1, log in with the release-appropriate credentials, inspect /etc/config and the required packages, and re-enable interfaces one at a time. If the kernel, flash, or hardware is damaged, stop and use the target's bootloader/debrick instructions; failsafe is not a debrick substitute.
Sources
https://openwrt.org/docs/guide-user/troubleshooting/failsafe_and_factory_reset — OpenWrt Wiki – Failsafe mode, factory reset, and recovery mode. Independently adapted from the complete 2026-08-20 snapshot; destructive commands retain the source syntax and carry scope warnings. ↩︎ ↩︎


Góp Ý / Bình Luận / Đánh giá