Lineage OS 14.1 on my LG G2 D802 (intl) - using only open source software

Finally, a technical task that warrants for transcription in my long neglected blog: I’ve updated my LG G2 from CM11 to LOS 14.1 over the last day or so. It was surprisingly painful, given the large number of tutorials online. Hence I want to point out why exactly this was the case. Though, be warned: this is not intended as a step-by-step tutorial or what not! I’m merely pointing out some caveats in the process, which you should be more or less familiar with, when you attempt anything like that. I will take no responsibility for any harm you, dear reader, might cause to your phone.

  1. Rooting: I am on Linux. I can’t start off by downloading the LG Flash Tool or anything like that. Instead, I rooted my device using a shell script wrapper around the adb tool, called VERY IMPORTANT: before you call it, replace SLEEP with sleep and ./adblinux with adb. Especially if you forget the SLEEP part, you will no longer be able to boot, not even into recovery. Your only choice then is to find above mentioned Windows tool and reflash a stock image from the net somewhere using the phone’s download mode. (That happened to me back when I switched from LG’s original image to CM11.)

  2. Bootloader: If you follow the tutorials on rooting, using, you’ll end up either with the CWM or TWRP bootloader. My observation: TWRP seems to be where it’s at today. However, you’ll end up with a version 2.6, while the official project’s sources are at 2.8 and patched versions floating the net are 3.2.1. To cut a long story short: TWRP 2.6 is absolutely useless for getting a recent CM/LOS zip installed.

More so, I was not even able to install 3.2.1 with it, until I patched the existing 2.6 with what is known as the “loki exploit”. While loki is no longer needed (or even supported) for 3.2.1, it seems, that in 2.6 you cannot install anything rather recent without it. This wasn’t obvious to me and installation somewhat painful, because what the Lineage OS install page says seems wrong: you cannot simply dd an image of TWRP 3.2.1 to /dev/block/.../by-name/recovery or anything like that but have to do as I said: patch 2.6, and then do an ordinary install of 3.2.1 using the patched 2.6.

  1. Bootstack: Also, it turns out, the official Lineage OS documentation didn’t mention either that if you’re coming from a very old version of Android/CM/LOS, as I did, you’ll need to install a new bootstack first. This is the scariest part of the process, as failing to apply the right file will definitely brick your device!

The right bootstack for the D802 seems to be the hybrid one that’s widely available on github. The zip can be installed as normal using the now installed TWRP 3.2.1 and the phone rebooted afterwards.

  1. Lineage OS 14.1: If your device isn’t bricked at this point, it is now possible to adb push a Lineage OS 14.1 zip onto /sdcard, wipe everything except internal storage, and then install it. Afterwards, it is necessary to wipe cache/dalvik clean and install the appropriate OpenGapps for the right device and LOS revision, and then reboot again.

Another very important point in this regard: After step 3., the key combination to enter recovery mode will have changed! Before, one had to hold down Vol-Down + Power on a switched-off phone until the LG-logo would pop up, let go of the buttons, and then press them again until the factory reset would appear. With a new bootstack, one has to initially press Vol-Down + Power, let go, and then press Vol-Up + Vol-Down until the factory reset appears! Very important to know that!

As I said, the whole update process isn’t exactly straightforward and bears the potential to brick the device, but the good news is: it helped me get Android 7.1.2 on my trusty old G2, and I expect that future updates to Android 8 will now only require entering the recovery mode, and then installing a new LOS-zip and GApps without further bootloader, bootstack, etc. patching.