Installing LineageOS on a Samsung Device

Updated: April 2021 after updating a Samsung S5 Qualcomm device to LineageOS 18.1 or Android 11.

LineageOS is an alternative operating system for your phone. It’s what stock Android looks like, i.e., it doesn’t have the unnecessary software from device manufacturers and phone carriers. 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 your phone works. You are going to make mistakes. You may brick your phone. But, most problems can be fixed. If you are interested in attempting it, use an outdated phone you already have on the LineageOS device list or get one from eBay to learn on (A Samsung S5 can be purchased for <$60). In the beginning, it’s best not to attempt installing LineageOS on a device that is important to you until you know what you are doing.

Installing LineageOS on your phone is relatively painless. It requires two steps. First, install either a custom recovery or TWRP into the RECOVERY partition using flashing software, i.e., Heimdall or Odin. Second, install LineageOS and then OpenGAPPS as described on the LineageOS website for your device.

It sounds difficult. But, it’s pretty straight-forward. The most important step? Make sure you are 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 required software

There are two choices for recovery software: custom recovery and TWRP. To illustrate, here is the link to the Samsung S5 custom recovery and TWRP files. Notice that the device code name is the same for each. I recommend installing custom recovery to start.[1]

First, select your device from the left side of the LineageOS build downloads page. Then download the custom recovery and LineageOS (most recent nightly for the device).

Second, if you want Google’s suite of software to work, such as Maps, you’ll need a version of GAPPS, such as MindtheGAPPS for 18.1 (previously it was OpenGAPPS). Select the appropriate architecture listed in your devices’ information page, e.g., ARM is listed as the architecture for a S5 device. Select the same version of Android as the LineageOS build you downloaded, e.g., Lineage 17.1 is equivalent to Android 10. Then, select how much of Google’s software you want, e.g., pico is the minimum for most of Google’s software to work as expected.

Take a look at the installation instructions. If you are installing from recovery, then transfer the LineageOS and OpenGAPPS files to the SD Card on your phone. If sideloading, then put them in whatever directory makes sense, e.g., just leave them in the Downloads folder.

Enable developer mode

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 files to your phone. USB Debugging needs to be enabled to flash the custom recovery or TWRP.

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
$ 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 custom recovery

$ 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.

  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 lineage-[version]-[date]-recovery-[device-name].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. Boot into recovery. On my S5 device, download mode was started by holding down Volume Up, Home and Power
  2. Wipe the Cache, System and Data partitions.
  3. Install or sideload first, then second – using the installation instructions for your device at the LineageOS site.

Different devices use different instructions, such as install from within recovery or sideloading the software. For a Samsung Note 4, the instructions suggested LineageOS and OpenGAPPS could be installed from an sdcard after TWRP/custom recovery was installed. The Samsung S5 instructions suggested sideloading the operating system using adb. Your best bet is to follow the official instructions, but I was able to do it either way with a S5 device.

When done, custom recovery will ask if you want to reboot. If you sideloaded the software, you’ll need to restart your device manually, e.g., by pulling the battery.

That’s it. Good luck!

[1] The difference between custom recovery and TWRP is that custom recovery is more tightly integrated with LineageOS but it has fewer features, specifically it doesn’t allow you to back up your phone. TWRP does allow you to back up your phone. However, it doesn’t always do the system update properly, and it tries to install the TWRP app, which requires root, when you reboot from recovery. There are tradeoffs to each choice, but if you doing this for the first time, use custom recovery. You can always go through the install recovery process and try either later. In fact, I recommend trying both. The correct TWRP file ends in *.img.