Installing LineageOS on a Samsung 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. 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, LineageOS & OpenGAPPS

First, 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

Install Heimdall: 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. Update: As of February 2020, Ubuntu installs v.1.4.1-2.

$ heimdall version

If you get v.1.4.1 (or if you cannot get Heimdall to work), try compiling from source. Personally, I only got it to work by installing from source.

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
$ 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 Save As and save it on some location.
  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 first, then (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!