Reflashing PureOS

Overview

Reflashing the Operating System (OS) on your phone is the best way to remove your personal data from internal storage and reset the phone to factory defaults. The Librem 5 and Liberty phones do not support on-device factory reset at this time, although this feature will be available in the future.

Warning

This procedure will completely erase everything on the device! Create a backup before proceeding!

See also

Terminology

By definition, the Librem 5 and Liberty Phones are fully-featured standalone computers. For readability, this guide will use the following common vernacular to refer to host computers and target devices.

Common Term

Specific Term

Description

Computer

Host computer

The device on which commands are issued to reflash PureOS

Phone

Target device

The device on which PureOS is being reflashed

Required materials

Hardware

  1. 1x Librem 5 OR Liberty Phone

  2. 1x 64-bit computer running a Linux OS with the capability of running shell commands

  3. 1x USB-A to USB-C data cable

Tip

Don’t own a Linux computer? No problem! Follow this guide to configure a temporary environment on your computer to proceed with these steps!

Software

  1. git package

  2. uuu package

  3. librem5-flash-image repository

Procedure

This procedure leverages a computer to erase the existing system image on the internal eMMC of the phone, then installs a new system image on the phone.

All shell commands are executed on the computer and not the phone unless otherwise stated.

1. Install software dependencies

Note

The uuu tool requires a 64-bit computer to run and is packaged as an amd64 binary. If running Ubuntu on this computer, enable the Universe repository before proceeding: sudo add-apt-repository universe

  1. Launch a terminal.

  2. Run the following command to install software dependencies:

    sudo apt install git uuu
    

See also

Installing git

2. Download the Flashing Scripts

Flashing scripts are responsible for downloading the image files and transferring them to the phone.

  1. From within the terminal emulator, clone the librem5-flash-image repository.

    git clone https://source.puri.sm/Librem5/librem5-flash-image.git
    

    The librem5-flash-image directory will be created.

  2. Navigate into this new directory.

    cd librem5-flash-image
    

3. Flash the system image

You are now be ready to run the flashing script to reflash PureOS onto the phone.

Warning

This will erase the contents of the phone’s eMMC memory, including user data.

  1. From within the terminal emulator, configure the environment:
    1. Ensure that the librem5-flash-image directory is the current directory.

    2. Make sure you have installed all python dependencies.

      sudo apt build-dep .
      
    3. Install the udev rules.

      sudo ./scripts/librem5-flash-image --udev
      
  2. Run the following script to download and flash the latest image.

    ./scripts/librem5-flash-image --stable
    

    Tip

    By default, the script will assume it is flashing the Evergreen version of the phone. However, a different version can be flashed with the --board option. Use librem5r2 for Birch and Chestnut series phones, librem5r3 for Dogwood.

  3. Wait for a notification to attach the phone for flashing once the script downloads the image. The phone will not provide an indication of the boot mode.

  4. Expose the filesystem of the phone to the computer.
    1. Ensure that the phone is switched off.

    2. Set all hardware kill switches to the disabled position. 1

    3. Remove the battery.

    4. Press and hold the Volume Up button while performing the following actions:
      1. Connect the phone to the computer using a USB-A to USB-C cable. 2 A successful connection will cause a red notification LED to blink, but will not show a green notification LED.

      2. Reinsert the battery. The red notification LED will remain on, and the script will continue.

    5. Release the Volume Up button.

  5. Allow the script to continue. Successful output will look something like:

    uuu (Universal Update Utility) for nxp imx chips -- libpureos/1.2.91+0git6b465-62-g9c56e46
    
    Success 1    Failure 0
    
  6. Remove the USB-C cable from the phone.

  7. Hold down the power button for 15-18 seconds to reset the phone. The phone should now be running the latest image.

1

The motivation for disabling the hardware kill switches in this procedure is to minimize power consumption. This maximize the chances of a successful boot even with a deeply depleted battery and under-powered USB source. It is entirely possible that this procedure will work even if you do not operate the kill switches as described.

2

Some USB-C cables may need to be plugged into the phone with a particular orientation. If the instructions above do not appear to work, reverse the orientation of the USB-C connector when inserting it into the phone.