Differences
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision Next revisionBoth sides next revision | ||
| docs:guide-user:troubleshooting:failsafe_and_factory_reset [2023/07/29 12:26] – reorganize contents vgaetera | docs:guide-user:troubleshooting:failsafe_and_factory_reset [2024/06/23 11:45] – Tweak failsafe to remind about setting static IP for the PC richb-hanover | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Failsafe mode, factory reset, and recovery mode ====== | ====== Failsafe mode, factory reset, and recovery mode ====== | ||
| - | OpenWrt offers several ways to "start over" with your router. | + | OpenWrt offers several ways to "start over" with your router: |
| - | * **Failsafe | + | * **[[docs: |
| - | * **Factory Reset** erases all your packages and settings, returning the router to its initial state after installing OpenWrt. | + | * **[[docs: |
| - | * **Recovery | + | * **[[docs: |
| - | + | ||
| - | <WRAP center round info 90%> | + | |
| - | **Factory Reset** depends on completing the boot process. If **Factory Reset** is not working, try with **Failsafe Mode** instead. | + | |
| - | </ | + | |
| ===== Failsafe mode ===== | ===== Failsafe mode ===== | ||
| - | //OpenWrt// allows you to boot into a **failsafe mode** that overrides its current configuration. If your device becomes inaccessible, | + | OpenWrt allows you to boot into a **failsafe mode** that overrides its current configuration. |
| + | If your device becomes inaccessible, | ||
| + | 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 access your device and restore settings if desired, whereas a reset would just wipe everything. | + | Failsafe mode can be triggered by pressing (almost any) button on the device shortly after powering it on. |
| + | Each router | ||
| - | **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 " | + | 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 access | ||
| - | < | + | **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 " | ||
| + | |||
| + | < | ||
| grep squash / | grep squash / | ||
| </ | </ | ||
| Line 22: | Line 25: | ||
| The terminal should return something similar to this: | The terminal should return something similar to this: | ||
| - | < | + | < |
| + | /dev/root /rom squashfs ro,relatime 0 0 | ||
| + | </ | ||
| ==== Entering failsafe mode ==== | ==== Entering failsafe mode ==== | ||
| - | Make sure you use a wired connection, since the failsafe will disable your wireless connectivity. Sometimes you need to connect to a specific network port of your router to get connectivity. **Try the LAN 1 port first.** | + | Failsafe mode starts |
| + | DHCP and wireless connectivity. | ||
| + | You will need to set your PC to a static address on the same subnet | ||
| + | (e.g., 192.168.1.10) and connect via Ethernet. | ||
| + | Sometimes you need to connect to a specific network port of your router | ||
| + | to get connectivity. | ||
| + | **Try the LAN1 port first.** | ||
| + | DSA devices | ||
| - | On most routers, OpenWrt will blink an LED (usually " | + | On most routers, OpenWrt will blink an LED (usually " |
| + | Early in the boot cycle, OpenWrt watches | ||
| + | inside a specific two second window | ||
| **To enter failsafe mode, follow one of the procedures listed below:** | **To enter failsafe mode, follow one of the procedures listed below:** | ||
| - | **Recommended | + | **Simplest - recommended |
| + | This can be the WPS, Reset, or other button on the device. | ||
| - | For most users and most devices, the LEDs now (2018) | + | The LEDs provide clues for timing the button |
| - | + | Watch the LED blinking speeds immediately after powering up the router. | |
| - | There are three different (power) LED blinking speeds during boot for most of the routers: | + | Most routers show three different (power) LED blinking speeds during boot: |
| * A power-on sequence of lights that is specific to the device' | * A power-on sequence of lights that is specific to the device' | ||
| - | * Then a fast 5-per-second blinking rhythm during two seconds, while router waits for user to trigger the failsafe mode, typically by a button press | + | * Then a fast 5-per-second blinking rhythm during two seconds, while router waits for a button press |
| - | * Then either | + | * Then either: |
| - | * A faster, 10-per-second blink if the user pressed a button and failsafe mode was triggered | + | * A faster, 10-per-second blink if failsafe mode was triggered. The device is listening on 192.168.1.1 |
| - | * A slower, 2.5-per-second blink continuing to the end of boot, if the failsafe was not triggered and the normal boot continues | + | * A slower, 2.5-per-second blink continuing to the end of normal |
| + | * If you missed the timing | ||
| + | |||
| + | **Alternate for expert users: Wait (with a packet sniffer) for a special broadcast packet and press a button.** The packet will be sent to destination address 192.168.1.255 port UDP 4919. | ||
| + | The packet contains the text "// | ||
| + | So for example, in a terminal and using tcpdump, with the router connected to port eth0 of your computer, you would enter the command < | ||
| - | **Alternate for expert users: | + | **Alternate for expert users with serial connection: Watch for a boot message on the serial console |
| + | The message shown in the console is "//Press the [f] key and hit [Enter] | ||
| - | **Alternate for expert users with serial connection: Watch for a boot message on the serial console | + | Usually, it is easiest to watch the LEDs. |
| + | However, do consult the available documentation | ||
| + | Whichever trigger | ||
| - | 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 | + | Note that modern OpenWrt |
| - | Note that modern OpenWrt always uses SSH, but early OpenWrt releases (15.05 and before) offered a telnet connection in this state but no SSH. | + | |
| + | ================= | ||
| ==== Fixing your settings ==== | ==== Fixing your settings ==== | ||
| - | Once failsafe mode is triggered, the router will boot with a network address of 192.168.1.1/ | + | Once failsafe mode is triggered, the router will boot with a network address of 192.168.1.1/ |
| + | When in failsafe mode, the DHCP server will not be running. | ||
| + | You must set your computer' | ||
| Using SSH or a serial connection, you can then mount the JFFS2 partition with the following command: | Using SSH or a serial connection, you can then mount the JFFS2 partition with the following command: | ||
| - | < | + | < |
| mount_root | mount_root | ||
| </ | </ | ||
| - | After that, you can start looking around and fix what’s broken. The JFFS2 partition will be mounted to ///overlay//, as under normal operation. | + | After that, you can start looking around and fix what’s broken. |
| + | The JFFS2 partition will be mounted to '' | ||
| - | **Failsafe extroot** | + | You can also transfer files by using scp command/ |
| - | If you use [[: | + | Additional steps required for [[: |
| - | < | + | |
| + | < | ||
| # unplug external device | # unplug external device | ||
| reboot | reboot | ||
| + | |||
| # plug external device | # plug external device | ||
| # mount external device, e.g. | # mount external device, e.g. | ||
| block info | block info | ||
| mount / | mount / | ||
| + | |||
| # fix the issue, e.g. | # fix the issue, e.g. | ||
| vi / | vi / | ||
| + | |||
| # verify external device will be mounted automatically, | # verify external device will be mounted automatically, | ||
| vi / | vi / | ||
| - | # reboot | + | reboot |
| </ | </ | ||
| ===== Factory reset ===== | ===== Factory reset ===== | ||
| - | 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), | + | 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), | ||
| - | :!: x86 builds (made for PC/Server hardware) with an ext4 read-write rootfs cannot | + | With a large NOR chip, it can take 3 to 5 minutes |
| + | During | ||
| - | 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 | + | **Caveat: |
| + | * Factory reset depends on completing | ||
| + | * x86 builds (made for PC/Server hardware) with an ext4 read-write rootfs | ||
| ==== Reset button ==== | ==== Reset button ==== | ||
| Line 90: | Line 126: | ||
| - Power on the device and wait for the status led to stop flashing (or go into failsafe mode, as described above). | - Power on the device and wait for the status led to stop flashing (or go into failsafe mode, as described above). | ||
| - | - Press and hold the reset button for 10 seconds. | + | - Press and hold the reset button for 10 seconds. |
| - Release the reset button. | - Release the reset button. | ||
| - | The device will do a hard factory reset (see below) and then reboot. This operation can be slow on some devices, so wait a few minutes before connecting again. | + | The device will do a hard factory reset (see below) and then reboot. |
| + | This operation can be slow on some devices, so wait a few minutes before connecting again. | ||
| ==== Soft factory reset ==== | ==== Soft factory reset ==== | ||
| - | If you want a clean slate, there’s no need to flash again; just enter the following commands. Your device' | + | If you want a clean slate, there’s no need to flash again; just enter the following commands. |
| + | Your device' | ||
| - | Issuing " | + | Issuing " |
| - | < | + | Note that this "soft reset" is performed with file system actions, so in some cases it is not enough. |
| - | firstboot && reboot | + | |
| + | < | ||
| + | firstboot && reboot | ||
| </ | </ | ||
| Line 109: | Line 149: | ||
| Note: if you're issuing this command inside a bash script, remember to add the option -y to force firstboot: | Note: if you're issuing this command inside a bash script, remember to add the option -y to force firstboot: | ||
| - | < | + | < |
| - | firstboot -y && reboot | + | firstboot -y && reboot |
| </ | </ | ||
| Line 149: | Line 189: | ||
| ======================================================= | ======================================================= | ||
| - | admin@(none):/# | + | admin@(none):/# |
| [ 102.942293] jffs2reset: This will erase all settings and remove any installed packages. Are you sure? [N/y] | [ 102.942293] jffs2reset: This will erase all settings and remove any installed packages. Are you sure? [N/y] | ||
| y | y | ||
| Line 158: | Line 198: | ||
| ...</ | ...</ | ||
| - | Tips**:** after (a openwrt | + | Tips**:** after (a OpenWrt |
| + | The boot menu accepts | ||
| + | After that bootmenu stage, within 3 to 8 seconds later (depending on CPU speed, etc) the failsafe mode appears & passes, so you have to press the " | ||
| ==== Hard factory reset ==== | ==== Hard factory reset ==== | ||
| - | This command will erase and reformat | + | === Re-flashing |
| + | Re-flash or upgrade | ||
| - | < | + | < |
| - | umount | + | sysupgrade -n /path/ |
| </ | </ | ||
| - | While in most cases this is producing similar end-result as the "soft reset", this marks the whole flash area of the JFFS2 (read-write) overlay partition as a empty non-initialised JFFS2 partition. Thus the partition will be re-created at the next mount, usually at the next boot. So, this hard reset bypasses the current file system of the overlay. | + | OpenWrt preserves settings [[docs: |
| - | Explanation: | + | === JFFS2 reset === |
| - | https:// | + | Reset the JFFS2 partition. |
| - | + | ||
| - | ==== Erasing filesystem to factory | + | |
| - | OpenWrt can be forced to re-format F2FS and perform factory reset. | + | |
| <code bash> | <code bash> | ||
| - | dd if=/dev/zero of=/ | + | umount |
| </ | </ | ||
| - | ==== Re-flashing to factory reset ==== | + | Based on the mount status of the overlay, jffs2reset [[commit>? |
| - | Factory reset is an [[docs: | + | |
| - | Settings are preserved by default, but you can opt-out to achieve factory | + | === F2FS reset === |
| + | Reset the F2FS partition. | ||
| <code bash> | <code bash> | ||
| - | sysupgrade -n /path/to/file | + | dd if=/dev/zero of=/dev/loop0 bs=1M; reboot |
| </ | </ | ||
| - | |||
| - | ==== File access through scp ==== | ||
| - | It's possible to edit and transfer files from the Failsafe mode, by using scp command/ | ||
| - | |||
| - | ===== Recovery mode ===== | ||
| - | 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 [[docs/ | ||