Factory Reset
The factory reset feature returns the device to a clean, factory-like state by removing all user-specific modifications. All custom changes are stored in overlays on the data partition. To safely wipe the data partition, the system is switched into a dedicated rescue mode, which stops all non-essential services and the overlays are unmounted.
To perform a factory reset, the factory_reset script must be invoked. This triggers the transition into rescue mode.
When entering rescue mode, the network is disabled and the system is reduced to a minimal runtime environment. A dedicated service is then started, which unmounts all active overlays and wipes the data partition while preserving /data/mender.
In addition, exceptions can be defined via the configuration file /etc/factory-reset-excludes.conf. Any paths listed in this file are excluded from deletion during the reset process. This allows for fine-grained control over which data is retained.
For example, network configuration files may be excluded to ensure continued remote access to the device after the factory reset, which can be essential for systems that are only reachable remotely.
If the factory reset fails, a log file is created at /data/failed-factory-reset.log to help the user to troubleshoot the issue.