Installing LineageOS on a Samsung Device

Updated: February 2020 using a Samsung S5 Qualcomm device.

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 (A Samsung S5 can be purchased for <$65). 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 difficulty is being careful about installing the right files for your device.

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. It is also software with unclear origins. User beware!

Download TWRP, LineageOS & OpenGAPPS

First, download TWRP (most recent file ending with *.img), LineageOS (nightly for the device) & OpenGAPPS (ARM, same version as LineageOS, pico) for your device. Follow the instructions on LineageOs and either put them on the root directory of your phone’s sdcard or keep them in your Download directory and sideload them.

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. ADB can be used to sideload files. more on that later.

USB Debugging needs to be enabled for the next step.

Install Heimdall

Install Heimdall: Try an apt-get install.

$ sudo apt-get install heimdall-flash

Then, check your version. Update: As of February 2020, Ubuntu installs v.1.4.2, which works as intended.

$ heimdall version

If you get v.1.4.1 (or if you cannot get Heimdall to work), try compiling from source. Previously, I could only got it to work by installing from source. Now, the repository files from Ubuntu work normally.

Install Heimdall From Source (if necessary)

$ sudo apt-get install build-essential cmake zlib1g-dev qt5-default libusb-1.0-0-dev libgl1-mesa-glx libgl1-mesa-dev 
$ mkdir ~/bin
$ cd bin
$ git clone https://gitlab.com/Benjamin-Dobell/Heimdall
$ mkdir -p Heimdall/build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ make
$ sudo cp bin/* /usr/local/bin 

If this doesn’t work or you don’t use linux, official instructions for your operating system can be found at the Heimdall site.

Install TWRP

$ 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.SAMSUNG) download mode was started by holding down Volume Down, Home and Power. Then connect to your computer using the USB cable.

  1. Go to Utilities tab in the Heimdall frontend.
  2. Detect Device.
  3. You will see Download PIT, which stands for Partitions Information Tables. Go to Save As, indicate a location on your computer, then click Download.
  4. Go to Flash tab.
  5. In PIT category, click Browse and select PIT file you downloaded from device in step 3.
  6. Click Add button.
  7. 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.
  8. Go Browse for file and select twrp.img file you downloaded in step 1. In Session, check No Reboot.
  9. Click Start.
  10. 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.

Install LineageOS

From here, it was straight-forward per the instructions on the LineageOS Installation Instructions for my device.

  1. Backup your device, so you can recover in the event you bork it.
  2. Wipe the Cache, System and Data partitions.
  3. Install LineageOS.zip first, then OpenGAPPS.zip (optional, but if OpenGAPPS is not there many apps might not work as expected, or at all) second.

Different devices require different instructions. For a Samsung Note 4 (non-official LineageOS ROM), LineageOS and OpenGAPPS could be installed from an sdcard. A Samsung S5 required sideloading the operating system using adb. Your best bet is to follow the official instructions.

When done, TWRP will ask you to reboot. If you side loaded the software, you’ll need to restart your device manually.

That’s it. Good luck!