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!

Download Text version

Required materials

Hardware

  1. 1x Librem 5 OR Liberty Phone

  2. 1x 64-bit host computer running a Linux OS with the capability of running shell commands
    • Don’t own a Linux computer? No problem! Follow this guide to configure a temporary environment on your computer to proceed with these steps!

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

Software

  1. Download and install the git package

  2. Download scripts from the librem5-flash-image repository

  3. Download and install an appropriate version of the uuu utility

Procedure

This procedure leverages a host computer to erase the existing system image on the internal eMMC of a Librem 5 or Liberty phone, and installs a new system image on the phone.

Note

Unless otherwise stated, all shell commands are executed on the host computer, not on the phone.

1. Install git

The git package must be installed on the host computer in order to continue. You can see whether or not the command is available on the host computer by running the shell command which git. If you receive no output, you do not have that command available and you should first run:

sudo apt install git

See also

Installing git

2. Download the Flashing Scripts

Files from the librem5-flash-image repository are responsible for downloading the image files and transferring them to the phone. Other scripts are used to help with building tools.

In a terminal, clone the librem5-flash-image repository before proceeding.

then, as the git command is (now) available, proceed with:

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

The librem5-flash-image directory will be created. Make this directory the current directory:

cd librem5-flash-image

You are now ready to install uuu.

3. Install uuu

Note

The uuu tool requires a 64-bit host to run and is packaged as an amd64 binary.

Note

For Ubuntu, enable the Universe repository to install uuu: sudo add-apt-repository universe

If you are using PureOS, Debian, or a recent Ubuntu derivative, install uuu by opening a terminal and entering the following command:

sudo apt install uuu

4. Flash the system image

You are now be ready to run the flashing script to reflash the phone’s system software.

Warning

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

First, configure the environment:

  1. Check 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

Run the following script to download and flash the latest image.

Tip

By default, the script will assume it’s flashing Evergreen. However, you can pass in the different version to the --board option. Use librem5r2 for Birch and Chestnut series phones, librem5r3 for Dogwood.

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

Once the script downloads the image, you’ll be prompted to attach the Librem 5 for flashing. The phone itself will not provide an indication of the boot mode – the script will simply continue once you follow these steps:

  1. Ensure that the phone is switched off.

  2. Turn all Hardware-Kill-Switches off i.e. switches in the powered off / disabled / towards the bottom of the phone position

  3. Remove the battery

  4. Press and hold the Volume Up button

  5. Connect the Librem 5 or Liberty Phone to the host computer using a USB-A to USB-C cable. (red light blinks, no green light)

  6. Reinsert the battery: (red light is constantly on, the script will continue)

  7. Release the Volume Up button

Note

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, try flipping the USB-C end of the cable over and replugging it into the phone.

The motivation for disabling the Hardware Kill Switches in this procedure is to keep the power consumption as low as possible. 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.

Successful output will look something like this:

uuu (Universal Update Utility) for nxp imx chips -- libpureos/1.2.91+0git6b465-62-g9c56e46

Success 1    Failure 0

Remove the USB-C cable and hold down the power button for 15-18 seconds to reset the phone.

Your phone should now be running the latest image.