Docs/factory-reset-tool

From Apertis
Jump to: navigation, search

Contents

Documentation

This page is meant to be documentation for the feature "factory reset tool" implemented on the 14.12 release and that is part of the Robust System Update and Rollback design.

Introduction

The complete updates and rollback feature has many individual parts. For more details about the feature, please see the System Updates and Rollback design.

Scope

For this release, the scope of the feature was to ensure the following features work:

  • Modify image post-processing to add a factory image to an unused partition of the armhf target image so it could be restored to a factory state.
  • Add factory reset support to the flagcheck script to restore the image to its factory state if that is indicated on the bootflags status.
  • Make possible for the user to trigger a factory reset using the flagtool and to check the boot flags in bootloader mode.

During Apertis image generation, a post-processing step creates a compressed tarball for the boot and root filesystem partitions and store it on a partition so it can be extracted by the factory reset tool when the system can't boot and the only option is to be restored to its factory state. This happens when all mini and full user-space are marked as failed on the boot status flags.

Usage

This happens automatically when the boot flags is marked that the system can't boot and that it has to be restored to its factory reset state. The rootfs partition is formatted and the the compressed tarball extracted from the recovery partition and the system restored.

Alternatively, a user can force a factory reset using the flag tool to update the boot flags accordingly and rebooting:

$ flagtool -r -p /dev/disk/by-partlabel/flags && reboot

The flagtool will write the required values to boot status flag and after a reboot when the system boots again the factory reset script will read the boot flags and perform a factory reset.

This feature only works on armhf images, the reason for this is that bootflags integration was done with U-boot which is only available for ARM images.

Factory image

On image building, a recovery image is stored on partition /dev/disk/by-partlabel/system. By default that is the image that is used by the factory reset tool but it also supports restoring from an USB mass storage device. If the factory reset tool detects a USB mass storage device then it mounts and use the image there and if no USB mass storage is detected, it falls back to the default in /dev/disk/by-partlabel/system.

Caveats

Currently, after a factory reset the system will be in a clean state, replacing home directories and any settings changed. This will change when the system has a separate subvolume for user data.

Personal tools
Namespaces

Variants
Actions
Navigation
Tools