LineageOS is an alternative operating system for your phone. It’s what Android looks like before the device manufacturers and phone carriers start adding software. Installing it is also an interesting exercise in how taking more control of technology often means taking more responsibility and risk.
Note: Installing alternative operating systems like LineageOS on your phone is a great way to learn more about how it works. You are going to make mistakes. You may brick your phone. If you are interested in attempting it, use an outdated phone you already have on the LineageOS list or get one from eBay to learn on. It’s okay to mess up, just don’t attempt it on a device that is important to you until you know what you are doing.
Installing LineageOS on your phone is relatively painless. The major difficulties are twofold: 1) being careful about installing the right files for your device and 2) getting Heimdall, the software on Linux to flash the bootloader TWRP to your phone, to work. Heimdall doesn’t work out of the box when installed with a package manager like apt-get on Debian.
Note: If you are on Windows, Odin sounds easier to use than Heimdall. I didn’t use it, so I do not know if this is true. I can say Heimdall does not work as expected on Linux.
- Download TWRP (most recent), LineageOS (nightly for the device) & OpenGAPPS (ARM, same version as LineageOS, pico) for your device and put them on the root directory of your phone’s sdcard. To transfer to your sdcard, enable developer mode for your device (in my case, going to Settings, About Device, and tapping on Build Number 7 times) then select USB Debugging in developer options. You will then be able to connect your phone to your computer, agree to connect on your phone and use any file utility to transfer the three files transfer rather than ADB, the android debug bridge. USB Debugging also needs to be enabled for the next step.
- Install Heimdall from source. There is a bug in the version v.1.4.1, which is what currently installs from apt-get. That version always throws off error messages when trying to flash the bootloader TWRP using software from apt-get. Try an apt-get install.
$ sudo apt-get install heimdall-flash
Then, check your version with:
$ heimdall version
If you get v.1.4.1 (or if you cannot get Heimdall to work), try compiling from source.
Compiling from source and using the heimdall-frontend solves that problem. I never got it to work from the command line. Install the required software to compile from source.
$ sudo apt-get install build-essential cmake zlib1g-dev qt5-default libusb-1.0-0-dev libgl1-mesa-glx libgl1-mesa-dev
Make a bin directory in your home directory and enter it.
$ mkdir bin
$ cd bin
Clone the source.
$ git clone https://github.com/Benjamin-Dobell/Heimdall
Make a build directory and enter it.
$ mkdir -p Heimdall/build
$ cd Heimdall/build
Build the software from source.
$ cmake -DCMAKE_BUILD_TYPE=Release ..
Transfer Heimdall to the system directory.
$ sudo cp bin/* /usr/local/bin
- Start the Heimdall-frontend.
Turn off your device. Boot into download mode, on my device (SAMSUNG) download mode was started by holding down Volume Down, Home and Power. Then connect to your computer using the USB cable.
- Go to Utilities tab in the Heimdall frontend.
- Detect Device.
- You will see Download PIT, which stands for Partitions Information Tables. Go Save As and save it on some location.
- Go to Flash tab.
- In PIT category, click Browse and select PIT file you downloaded from device in step 3.
- Click Add button.
- For partition name select where you want to flash it. BE CAREFUL! If you flash it on wrong partition you can perma-brick device. For most devices, the recovery partition is RECOVERY.
- Go Browse for file and select twrp.img file you downloaded in step 1. In Session, check No Reboot.
- Click Start.
- When complete, disconnect device from the USB cable, pull the battery and immediately restart into recovery. On my device, you can boot into recovery by holding down Volume Up, Home and Power. If you don’t, your phone will likely write over the TWRP file you have flashed, and it will look like nothing has happened.
- From here, it was straight-forward per the instructions on the LineageOS Installation Instructions for my device.
- Backup your device, so you can recover in the event you bork it.
- Wipe the Cache, System and Data partitions.
- Install LineageOS.zip first, then OpenGAPPS.zip (optional, but if OpenGAPPS is not there a lot of apps might not work as expected, or at all) second.
When done, TWRP will ask you to reboot. That’s it.