back to the beginning
Last updated: 2019-01-22
Upgraders go to this page!
LineageOS is an alternate version of the Android operating system for your phone. Rather than building it yourself the first time, I recommend you use the image provided by invisblek). However, his image includes Google apps by default. If you want to experience life without Google's apps you will have to build LineageOS yourself. If you want to use Google apps get LineageOS from here. You can still use these instructions to install.
WARNING: Moving from stock Android to LineageOS (including builds from various sources that use different build keys!) or back again will require restoring your phone to factory settings.
YOU WILL LOSE ALL YOUR DATA. YOU MUST COPY ANYTHING YOU VALUE OFF OF THE PHONE.
If you want to remove LineageOS and return to stock Android follow the instructions here:
You will lose all your data so make a backup beforehand (see step for that below).
A quality USB cable. The manufacturer recommends you do not use the cable provided with your phone for anything other than charging.
invisiblek's installation notes These have been updated and contain a lot of useful information.
All instructions assume you are running Linux. These instructions are for Ubuntu with minimum version of 16.04.
You will need to install proper ADB (Android Debugging Bridge) tools for your platform. For Ubuntu 18.04 this is as simple as running
sudo apt install adb
If your distribution provides out of date tools you can obtain them directly from Google.
Install the tools from Google:
unzip platform-tools-latest-linux.zip -d ~
# add Android SDK platform tools to path
if [ -d "$HOME/platform-tools" ] ; then
Run the following command to update your shell:
If you are moving from another version of LineageOS, then you should do this. Versions built with different keys will not read the data partitions of other builds. See note regarding keys at top of this page.
I don't know if this works; got it off the internet!
sudo adb backup -apk -shared -all -f ph1.backup.ab
sudo adb restore ph1.backup.ab
Personally, I put everything I value in a syncthing folder and just use that for backup/restore.
Installing LineageOS will require you have an unlocked boot loader. You only do this the first time.
If you are coming from stock you will have to wipe your phone with this command (it will ensure the phone is erased):
sudo fastboot -w
Type the following in your shell and wait for the phone to restart (your phone may prompt for permission):
sudo adb reboot-bootloader
To verify you can access the phone type:
sudo fastboot devices
If you see a device with the label "unauthorized" you forgot to give your computer permission to access your phone through the adb interface.
TWRP gets written to the boot partition.
sudo fastboot flash boot twrp-3.2.3-0-mata.img
sudo fastboot reboot
After a few moments TWRP will start.
You most likely won't be able to control TWRP with the touchscreen. You can install Lineage without using the touch screen.
If something goes wrong and you need to restart the phone depress the volume down button while the phone reboots.
(NOTE: I had to unplug/replug my phone and wait until my computer acknowledged the phone before issuing each of the next two commands.)
sudo adb shell twrp sideload
The phone will show a message that sideloading is enabled.
sudo adb sideload lineage-16.0-date-UNOFFICIAL-mata.zip
(NOTE: Progress might appear to hang at 47% but the phone will show it is in step 2; be patient. The phone will return to TWRP main screen when it finishes.)
(I don't do this but I expect you can install other things like Magisk or gapps here the same as above: sudo adb sideload images.zip)
sudo adb reboot
If you phone boot loops or takes more than a few minutes to start into LineageOS then boot to recovery and reset to factory. This can happen if the OS cannot read the data partition.
To boot to recovery hold the volume up button down until the recovery menu appears. Use the volume buttons to select factory reset and the power button to execute. This will reset the phone and it will start properly.
This can also be done from like this:
sudo fastboot -w
Settings - System - Developer options - Android debugging
It is safest to keep USB debugging disabled until you need it. Go to the developer options menu in settings and disable it.
Settings - Security - Screen Lock
back to the beginning
Something need fixing? Contact me: