Before we can install anything, we need to get the images that we’re going to throw onto our device.
- Download LineageOS installation
- Download the LineageOS recovery
ADB and Fastboot
The Android Debug Bridge (ADB) is a command-line tool that lets you communicate with an Android device from a computer. Fastboot is a special diagnostic and engineering protocol that you can boot your Android device into. We’ll be using these two tools to erase everything on the device, and then install a custom rom.
sudo apt install android-tools-adb android-tools-fastboot -y
Check ADB and Fastboot versions to make sure they both got installed properly:
adb --version > Android Debug Bridge version 1.0.39 > Version 1:8.1.0+r23-5ubuntu2 > Installed as /usr/lib/android-sdk/platform-tools/adb fastboot --version > fastboot version 1:8.1.0+r23-5ubuntu2 > Installed as /usr/lib/android-sdk/platform-tools/fastboot
Developer mode and the bootloader
We need to enable developer mode on the device in order to turn on USB-debugging mode. The debugging mode allows our computer to talk to our phone through a USB cable.
- On the phone, go to Settings > System > About phone.
- Scroll down to Build number and click on it several times. Your phone will attempt to go into developer mode.
- Enter your pin/pattern if asked for it.
- Once it says You are now a developer close the app.
- Go to Settings > System > Advanced > Developer options.
- On this page enable USB debugging. You may have to enter your pin/pattern.
- On the same page, enable OEM unlocking. You may have to accept a warning about device protection features.
Now that we’ve got your phone ready, let’s test the connection to your computer.
Plug your phone into your computer using a USB cable.
A warning may pop up on your phone asking if you want to allow the computer to access your device over USB? Select Always all and then Allow.
Reset your phone and boot into the bootloader by running this command:
adb reboot bootloader
Your device should reboot and show a little guy in a Russian looking hat.
Now that we’re in the bootloader, we can start wiping and installing things. Again, this procedure will erase everything on the phone, so make sure stuff is backed up, and you’ve got a list of all the apps you want to download later.
Check that Fastboot can see your phone:
fastboot devices > 2ed7330 fastboot
Even though we unlocked the bootloader within the phone, we still need to unlock the full OEM features in order to access the full phone when installing our rom. Unlock the full features of the phone:
fastboot oem unlock fastboot oem unlock_critical
unlock_criticalmay result in a error saying you’ve already unlocked this, or something like that. That’s fine, it just means that the first
unlockcommand did everything already.
Install recovery image
The recovery image is what pops up when you boot your phone into Recovery mode. The default recovery that comes with Android phones doesn’t do what we need, so we need to flash a custom recovery mode onto the phone. Luckily, LineageOS has a recovery image we can use.
You will likely have to change the file names of some of the files listed in these commands.
Move to the directory where you downloaded the
Flash the recovery image onto your phone:
fastboot flash boot lineage-17.1-recovery.img > target reported max download size of 536870912 bytes > sending 'boot_b' (24517 KB)... > OKAY [ 0.822s] > writing 'boot_b'... > OKAY [ 0.190s]
If you device doesn’t respond, or the above command does absolutley nothing and just hangs, you have not have unlocked the bootloader fully. Exit the terminal, open a new one, and run
fastboot oem unlock && fastboot oem unlock_critical, then try the above command again.
Continue booting your phone to the homepage:
Unlock your phone.
Install custom ROM
Now it’s time to install the custom rom.
Reboot into recovery mode:
adb reboot recovery
The LineageOS recovery menu should now be shown on your phone. It might be very dim. You should be able to control this menu using the touch screen. If the touchscreen doesn’t do anything, use the volume keys to go up and down, and the power button to select an option.
Select Factory Reset > Format data/factory reset > Format data. The recovery menu should output the following at the bottom of your screen:
-- Wiping data... Formatting /data... Data wipe complete.
Go back to the main menu.
Select Apply Update > Apply from ADB.
On your computer sideload the package using ADB:
adb sideload lineage-17.1-jasmine_sprout-signed.zip > * daemon not running; starting now at tcp:5037 > * daemon started successfully > serving: 'lineage-17.1-20200711-nightly-jasmine_sprout-signed.zip' (~47%)
You phone outputs where things are up to:
Finding update package... Opening update package... Verifiying update package... Update verification package too 48.9 s (result 0) Installing update... Step 1/2 Step 2/2 Install completed with status 0.
Go back to the main menu.
Select Reboot. Your phone should now boot into LineageOS.
Commands don’t do anything
This might have something to do with how your phone is connected to your computer. USB-C seems to be a bit flakey. I connected my phone to a USB-C hub using a USB-C to USB-A cable. That seemed to work.
Installing Open Apps (GApps)
Annoyingly, there’s currently no way to install GApps without rooting your phone.