Installing various OSes on the Fairphone 2 phone

The Fairphone 2 is a touchscreen-based, dual-SIM smartphone, designed to be easily repaired by the user. It was the first modular smartphone available for purchase. It was first released in December 2015, and production ceased in 2018, and has since received both hardware improvements and major software updates. Wikipedia

Introduction

The operating system possibilities are quite a few, basically you have to decide between a privacy-oriented OS or one with Google Mobile Services. Your options so far:

  1. Ubuntu Touch - also known as Ubuntu Phone, is a mobile version of the Ubuntu operating system that was originally developed by Canonical Ltd. and is now being developed by the UBports community.
  2. Lineage OS - a free and open-source operating system for set-top boxes, smartphones and tablet computers, based on the Android mobile platform. It is the successor to the custom ROM CyanogenMod , from which it was forked in December 2016 when Cyanogen Inc. announced it was discontinuing development and shut down the infrastructure behind the project.
  3. Fairphone OS - the default Android installation for Fairphone 2, which includes Google Mobile Services (GMS).
  4. Fairphone Open - an alternative, open source version of Fairphone OS, built by Fairphone, that puts transparency and ownership in the spotlight. It comes stripped from proprietary applications (like the Google Mobile Services) and can be modified by people who feel like doing so.
  5. Sailfish OS - is a general purpose Linux distribution used commonly as a mobile operating system combining the Linux kernel for a particular hardware platform, the open-source Mer core stack of middleware, a proprietary UI contributed by Jolla or an open source UI, and other third-party components.

To simplify, if you want privacy you should go for Fairphone Open or Lineage OS. If you use Ubuntu extensively, Ubuntu Touch is really nice. If you need Google Services (Play Store, etc), you should use stock Fairphone OS. I’ve noticed some bugs in Sailfish OS on FP2 but it’s still in beta so there’s that. Take my opinions with a grain of salt.

Let’s begin.

Start by installing the Android SDK Platform Tools (adb and fastboot) if they’re not already installed. Use Homebrew for that.

$ brew cask install android-platform-tools

Ubuntu Touch

Ubuntu Touch (also known as Ubuntu Phone) is a mobile version of the Ubuntu operating system that was originally developed by Canonical Ltd. and is now being developed by the UBports community. It is designed primarily for touchscreen mobile devices such as smartphones and tablet computers, however the original goal of convergence was intended to bring Ubuntu Touch to laptops, desktops, IOT devices, TVs and smart watches for a complete unified user experience. Wikipedia

Additional info

Install

You can opt in for the automatic install, the UBports Installer is available on all major operating systems - Windows | macOS | Linux . Though, sometimes it does not work (it did not work for me first time I installed it but it did the second time) and when that happens, you can install it manually.

If you want to install Ubuntu Touch manually, start by downloading and verifying all the files. I added all the lines to a bash script so you don’t have to type each line, dump the contents to a download.sh file.

#!/bin/bash
wget http://cdimage.ubports.com/devices/recovery-FP2.img -O recovery.img && echo "534cc2da2add4a2bd8136b01069ed7dbe432076659fd4780910b6910b916f77b recovery.img" | sha256sum -c
wget http://cdimage.ubports.com/devices/splash-FP2.img -O splash.img && echo "2bf76ec909af34d9896a954cd6c4ed5ad114d6053e59b7a856325b4fcfca43cd splash.img" | sha256sum -c
mkdir pool gpg
wget https://system-image.ubports.com/pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz -O pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz && echo "a959960b307d565d6352e47b8bc9514a2d40ccefc26a7271adf1a71cfb55851a pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz" | sha256sum -c
wget https://system-image.ubports.com/pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz.asc -O pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz.asc && echo OK
wget https://system-image.ubports.com/pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz -O pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz && echo "d72d3fd2fc78fcfb3dfee5a241f5f8ff67be6d5b9d52c9449fd3833f8e42be6f pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz" | sha256sum -c
wget https://system-image.ubports.com/pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz.asc -O pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz.asc && echo OK
wget https://system-image.ubports.com/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz -O pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz && echo "5b6e870acf8944330acb2a9dad6f5270bd06c377603a3115f805290e989ab421 pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz" | sha256sum -c
wget https://system-image.ubports.com/pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz.asc -O pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz.asc && echo OK
wget https://system-image.ubports.com/ubports-touch/16.04/stable/FP2/version-7.tar.xz -O pool/version-7.tar.xz && echo "55fe809f33497295e1731a5b7cc7bacf062c7db977adce1c6be49b46a13ed00e pool/version-7.tar.xz" | sha256sum -c
wget https://system-image.ubports.com/ubports-touch/16.04/stable/FP2/version-7.tar.xz.asc -O pool/version-7.tar.xz.asc && echo OK
wget https://system-image.ubports.com/gpg/image-signing.tar.xz -O gpg/image-signing.tar.xz && echo OK
wget https://system-image.ubports.com/gpg/image-signing.tar.xz.asc -O gpg/image-signing.tar.xz.asc && echo OK
wget https://system-image.ubports.com/gpg/image-master.tar.xz -O gpg/image-master.tar.xz && echo OK
wget https://system-image.ubports.com/gpg/image-master.tar.xz.asc -O gpg/image-master.tar.xz.asc && echo OK

Create a temporary directory, move the .sh file there and execute it:

$ mkdir ~/ubuntu-tmp && cd ubuntu-tmp
$ ./download.sh

First, you need to reboot your device to boot-loader mode. Press and hold the volume down and power button until the phone reboots. Now, connect your phone to your computer using the micro USB cable and run the following commands to wipe the internal memory:

$ sudo fastboot oem unlock
$ sudo fastboot format cache
$ sudo fastboot reboot-bootloader
# if you want to erase data on the device:
$ sudo fastboot format userdata
$ sudo fastboot format system

Flash recovery:

$ sudo fastboot flash recovery recovery.img
$ sudo fastboot flash splash splash.img

Add this to a file named commandfile:

format system
load_keyring image-master.tar.xz image-master.tar.xz.asc
load_keyring image-signing.tar.xz image-signing.tar.xz.asc
mount system
update ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz.asc
update device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz.asc
update keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz.asc
update version-7.tar.xz version-7.tar.xz.asc
unmount system

Now reboot the device to recovery mode by pressing and holding the volume up and power button until the phone reboots.

Next, all the files need to be sent to the device, we do that using another bash script. Dump the contents to a file named upload.sh (or whatever you want).

#!/bin/bash
adb shell "mount -a"
adb shell "mkdir -p /cache/recovery"
adb push pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz /cache/recovery/
adb push pool/ubports-420bfa80c833e7736e0197d969b5cd981f18eee1215ad3bfae6d82aab9105f03.tar.xz.asc /cache/recovery/
adb push pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz /cache/recovery/
adb push pool/device-e8d46fc155131783d99bfa5c05b1062ec95d1c3324875e16de71e947aecafe1b.tar.xz.asc /cache/recovery/
adb push pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz /cache/recovery/
adb push pool/keyring-4c4e7ef380ebcfa2c31084efa199138e93bfed8fc58aa3eb06bdf75a78af9b57.tar.xz.asc /cache/recovery/
adb push pool/version-7.tar.xz /cache/recovery/
adb push pool/version-7.tar.xz.asc /cache/recovery/
adb push gpg/image-signing.tar.xz /cache/recovery/
adb push gpg/image-signing.tar.xz.asc /cache/recovery/
adb push gpg/image-master.tar.xz /cache/recovery/
adb push gpg/image-master.tar.xz.asc /cache/recovery/
adb push commandfile /cache/recovery/ubuntu_command

And execute it:

$ ./upload.sh

To start the install process:

$ adb reboot recovery

When recovery finishes updating the OS, it will reboot your phone into Ubuntu Touch.

Screenshots

Lineage OS

LineageOS is a free and open-source operating system for set-top boxes, smartphones and tablet computers, based on the Android mobile platform. It is the successor to the custom ROM CyanogenMod, from which it was forked in December 2016 when Cyanogen Inc. announced it was discontinuing development and shut down the infrastructure behind the project. Since Cyanogen Inc. retained the rights to the Cyanogen name, the project rebranded its fork as LineageOS. Wikipedia

Additional info

Install

First, make sure you install a custom recovery, I recommend TWRP , download the latest .img file and save it somewhere on your computer.

Reboot your device to boot-loader mode. Press and hold the volume down and power button until the phone reboots. Now, connect your phone to your computer using the micro USB cable and flash TWRP:

$ sudo fastboot flash recovery twrp-3.3.1-0-FP2.img

If you have a different TWRP version, adjust the command line to point to the proper file. Reboot the device into recovery mode by pressing and holding the volume up and power button until the phone reboots.

Use TWRP to wipe the data (from the main screen, tap Wipe -> Format Data and swipe to proceed, then return to the previous menu, tap Advanced Wipe and select the Cache and System partitions to wipe, then proceed) and sideload the Lineage OS zip package to the phone.

Download the last version of Lineage OS (signed, zip archive, last is lineage-16.0-20190523-nightly-FP2-signed.zip but they’re released nightly). When it’s downloaded, in TWRP (on the device) tap Advanced, ADB Sideload and swipe to begin; on your computer sideload the .zip:

$ adb sideload lineage-16.0-20190523-nightly-FP2-signed.zip

As an alternative, you can install Lineage OS with microG (microG is a free-as-in-freedom re-implementation of Google’s proprietary Android user space apps and libraries). Just download the latest archive from here and sideload it to TWRP recovery as highlighted above. Just replace the file name, for example:

$ adb sideload lineage-16.0-20190513-microG-FP2.zip

When the device finished installing, return to the main TWRP menu, tap Reboot and then System. The phone will reboot into Lineage OS.

If you want to root your device, install the Lineage OS SU package (arm version). Put the zip file on a SD card, reboot into recovery, click Install and browse to the .zip file.

Screenshots

Fairphone OS

Additional info

Install

Boot the Fairphone 2 into the boot-loader (also called fastboot mode) by pressing and holding the volume down button first and then pressing and holding power button as well.

Download the last version of Fairphone OS and extract the archive on your computer.

Connect the micro USB cable from your device to your computer, navigate to where you extracted the archive, right click on the flash-for-mac.command file and select Open.

Should take a few minutes to install the operating system and you will be asked to press Enter to reboot the device. Do that and the phone will reboot into Fairphone OS.

Screenshots

Fairphone Open (Sibon)

Fairphone Open is an alternative, open source version of Fairphone OS, built by Fairphone, that puts transparency and ownership in the spotlight. It comes stripped from proprietary applications (like the Google Mobile Services) and can be modified by people who feel like doing so.

The Fairphone Open edition is a pure Android experience, without the integrated Google Mobile Services (Google apps, Play store, etc.). Once you run our open source version of the software and you would like to install third party applications, there are several easy ways to do this. Homepage

Additional info

Install

Boot the Fairphone 2 into the boot-loader (also called fastboot mode) by pressing and holding the volume down button first and then pressing and holding power button as well.

Download the last version of Fairphone Open and extract the archive on your computer.

Connect the micro USB cable from your device to your computer, navigate to where you extracted the archive, right click on the flash-for-mac.command file and select Open.

Should take a few minutes to install the operating system and you will be asked to press Enter to reboot the device. Do that and the phone will reboot into Fairphone Open.

Screenshots

Sailfish OS

Sailfish OS is a general purpose Linux distribution used commonly as a mobile operating system combining the Linux kernel for a particular hardware platform, the open-source Mer core stack of middleware, a proprietary UI contributed by Jolla or an open source UI, and other third-party components. Sailfish is being developed by Jolla, the Sailfish and Mer project communities, corporate members of the Sailfish Alliance and various open community members.

The Sailfish community members make development requests and decide development priorities by voting. The Mer project receives contributions from Jolla and its community, and Mer is the source of middleware for Jolla, thereby continuous development and compatibility of all Mer based projects is maintained. Wikipedia

Additional info

Install

Installing Sailfish OS on your Fairphone 2 device requires Fairphone OS or Fairphone Open 18.04 (does not work with 19.02!!), so make sure you have that installed. Just follow the steps above (from Fairphone OS/Open) and just download the different zip archive .

Download the Sailfish OS beta release .

Reboot the device into recovery mode by pressing and holding the volume up and power button until the phone reboots. In TWRP (on the device) tap Advanced, ADB Sideload and swipe to begin; on your computer sideload the .zip:

$ adb sideload sailfishos-fp2-sibon-release-3.0.2.8-beta5.zip

When the device finished installing, return to the main TWRP menu, tap Reboot and then System. The phone will reboot into Sailfish OS.

Warning

Do not erase the system partition.

Screenshots

Addendum