[OnePlus 6T  Guides, News, & Discussion] OhioYJ:
Installing Lineage​

Few quick things.

LOS 18.1 is now official so the guide will now just be covering that.

I also want to address a common question, you can use Windows for this process. I prefer Linux, and Fastboot just works in Linux without driver issues. If you have Fastboot and ADB working in Windows already feel free to use that if you want.

Frequently asked Questions:

This looks like a lot of work, is there an easier way to install? Try the LOS Wiki Method.

Using TWRP 3.5.2_9-0​

1. Start off Fresh. Install OOS using the Fastboot ROM.

Start off with a fresh install of OOS. You need the latest version of OOS 10. I typically use a the fastboot ROMs for this as it will do both slots for me at once. (Alternatively you can use TWRP and install the ZIPs and do it twice to get it on both slots, or my least favorite, the MSM Tool if you want. Doesn't matter how OOS ends up on both slots, as long as it ends up on both slots.)

I use Linux, and honestly I feel like it's easier and more reliable for fastboot and ADB so that's what I'm including here in these steps. It's easy to boot from a USB.

To create a bootable Linux flash drive you can use Unetbootin, which you can download for free here (Your other option would be to burn the ISO straight to a DVD and skip the unetbootin step):

https://unetbootin.github.io/

For Linux, I'm using Linux Mint Cinnamon, You can download for free here:

https://www.linuxmint.com/download.php

Then run unetbootin (yours will look a little different, I'm running it in Linux):

Point it to the Linux ISO, and tell it where an empty flash drive is. It will erase everything on the flash drive. Afterwards you can load whatever you want on the flash drive. However be aware when booting Linux from this drive you can't access what is on the drive (at least not by normal methods).

After this has successfully completed, reboot the PC, and boot from the USB drive. Your PC will boot into Linux (turning off the PC and removing the USB drive will make it boot up like normal again).

Next we need to install fastboot and adb. You need to open up the "start menu" and open the "synaptic package manager". You can find this stuff in the menus, however the easiest way to get to these items is to just start typing the name of the item. See below:

Search fastboot, click the boxes, choose install. Then search for ADB, click the boxes, choose install and then click apply. It's that easy it will download everything that's needed and install.

Time to open up a terminal:

Just to make sure we don't run into any problems we need to update adb and fastboot. In the terminal run these commands to update fastboot and adb (this is downloading them directly from Google).

wget https://dl.google.com/android/repository/platform-tools-latest-linux.zip

unzip \platform-tools-latest-linux.zip

sudo cp platform-tools/adb /usr/bin/adb

sudo cp platform-tools/fastboot /usr/bin/fastboot

You will also need the appropriate fastboot ROM. Fastboot ROMs available in this thread. The catch being that thread is no longer updated. So we will need to make our own fastboot rom. To do this we need two things:

1. The stock rom zip (OP Site).

2. Payload dumper. I've yet to get the one from the GitHub link to work, so I've been using the one from this Article. Direct Download Link

You need to extract the payload.bin file from the stock rom zip. Extract the payload_dumper files as well, and place everything in the same folder. Payload_dumper requires python3. Open up Synaptic again, search for python3.6 and install it. Now open a terminal so we can extract the images from the payload.bin.

Navigate to the location of payload_dumper and your payload.bin file. In my case my commands are:

cd Desktop <-- switches to the Desktop folder

cd payload_dumper <-- switches to the payload_dumper folder on the Desktop

python3 payload_dumper.py payload.bin <-- runs the payload_dumper "program" and extract the images from the payload.bin

Now would be a good time to back everything up. The phone will get wiped. Extract the fastboot images to a folder that is easy to find. I would recommend the Desktop.

Now it's time to flash all those images we just extracted using payload dumper. Place the phone in fastboot mode. You can do this using the advanced reboot menu, ADB, or the key combinations (all key combos listed below for reference):

Volume Up + Power while turning on will boot to fastboot.

Volume Down + Power while turn on will boot to recovery.

Holding Volume Up + Power should force the phone to turn off.

Volume Up + Volume Down should put your phone in Download mode for the MSM Tool.

You can flash the images one by one or use a script. My script is available here. Flashing the fastboot ROM should look something like this:

That image explained:

cd Desktop <-- Switched the directory to the Desktop the default directory when you open up the terminal is the /home directory.

cd flash <-- I put my fastboot images in a folder called flash. This stuff is case sensitive. My folder was all lowercase.

sudo fastboot devices <-- Is just checking to see if my PC can see my phone, and making sure it's in fastboot. Sudo is necessary for this distro, as both fastboot and ADB must be run as root.

sudo sh FlashThese.sh <-- Tells the terminal to run my script, since the script contains fastboot commands it must be run as root.

At the end you should get something like this:

Then just choose start form Fastboot (If you were previously on a custom ROM go straight to recovery and wipe everything). Not booting and getting dumped off at the OnePlus recovery screen is nothing to worry about. Choose your language of choice, Wipe data and cache, Erase everything (Music, pics, etc), This can not be undone, continue. After that the phone will boot. Once booted enable developer options, advanced reboot, and reboot to fastboot.

2. Installing TWRP.

First step is to boot the correct TWRP image. Grab the current TWRP from the official site. You need both files, the img file, and the installer. Once again from the terminal:

The image explained:

cd Desktop <-- Switched the directory to the Desktop the default directory when you open up the terminal is the /home directory.

sudo fastboot devices <-- Is just checking to see if my PC can see my phone, and making sure it's in fastboot. Sudo is necessary for this distro, as both fastboot and ADB must be run as root.

sudo fastboot boot twrp-3.5.2_9-0-fajita.img * <-- Sends that TWRP image to the phone to be booted temporarily. Only boot this, never run the command "flash".

Once in TWRP the phone should show up as a media device so you can copy files to it. Copy the TWRP installer over to it. Choose Install from the TWRP menu and navigate to where you placed the TWRP installer. Press on it, and swipe to confirm flash. When it is done hit the back button until you are back out to the main menu.

From the main menu choose reboot, and choose Recovery:

The first time you try and reboot the official version of TWRP it will ask you if you want to install the TWRP app. Do NOT install the app. In the settings you can disable this prompt. Your other option is just uncheck both boxes at the screen you see below when you get to it, and then click the button that says do not install. Do use the slider. At that point the phone will reboot as to recovery as you selected.

Now that you are back in TWRP that is now installed, time to wipe the phone. From the main menu choose Wipe. Swipe the factory reset slider at the bottom. Then hit back. Next hit Format Data. Type Yes to Continue. Hit back to continue. Keep hitting back till you get to the main menu.

Do NOT wipe cache, do not Wipe system, do NOT Wipe Dalvik / ART, do not add anything else, Just Factory Reset and Format Data. After doing those two Reboot to Recovery one more time. So go back into the reboot menu, choose reboot to recovery again (swipe to allow modifications if it asks). You must do this after formatting data.

3. Install Lineage

Links:

Lineage 18.1 XDA Thread

Official 6T Lineage Downloads

The phone should still be in TWRP at this point. You now need to copy Lineage to the phone. From TWRP's main menu choose install. Then navigate to your ROM .zip location and click on it. Then swipe to confirm flash.

Lineage will replace TWRP, so you need to reflash TWRP as well. Run the TWRP installer again. If it's not on the phone, just copy it over again real quick. On A/B devices ROMs get flashed to the opposite slot. Things like Gapps, Magisk, etc get flashed to the current slot. We need Lineage on both slots, so it must be flash again. Flashing it twice only needs to be done the first time as we need to get rid of OOS. For updates it just gets flashed once. After the TWRP installer has run, back out to the main menu, and choose reboot, then recovery:

Once back in TWRP flash Lineage again. From TWRP's main menu choose install. Then navigate to your ROM .zip location and click on it. Then swipe to confirm flash.

Now run the TWRP installer again. Back out to the main menu, and reboot to recovery.

4.Optional, Gapps

Links:

NikGapps <-- For Lineage 18.1 (Use the R Folders for Android 11. I recommend the "Core" version. I also tested Basic though if you want that level of Gapps. I strongly recommend you grab setup wizard out of the R Addons Folder, I used the regular setup wizard, not the pixel one.)

MindTheGapps <-- It's worth mentioning here Lineage recommends MindTheGapps for 18.1. Take your pick. I personally use NikGapps as I can use a "leaner" Gapps package.

Now that your phone is back in TWRP for the last time before booting up Lineage, it's time to install Gapps if you want them. This step is optional. Same as the other steps here, go to install, choose your OpenGapps package, Then navigate to your .zip location and click on it. Then swipe to confirm flash.

5. Very Optional, Magisk

These steps are very optional. However this is how I, root, pass safety net, and get a various apps to appear in the Play store.

Flash Magisk in TWRP. For Magisk 23, you now have to rename the Magisk.apk to Magisk.zip. Then flash it in TWRP. If you wanted to uninstall it, you rename it to uninstall.zip. If you already had an older version of Magisk installed, make sure you do not have it hidden / nenamed when installing Magisk 23 for the first time. Restore the original package before installing 23.

Magisk <-- Flash this right after Gapps.

These items are add-ons are flashed in Magisk after the first boot (Don't flash these in TWRP anymore):

MagiskHide Props Config

Busybox

To flash modules in Magisk press the puzzle piece icon. Then choose install from storage. Now just choose your addons. After flashing the icons it will have a reboot icon at the bottom. You can reboot or you can press back and flash another. After you are done reboot.

You will also need a Terminal Emulator. I personally use:

Terminal Emulator for Android

Once all these are installed the first step is setup Magisk. Under Magisk go to settings:

In version 20.4+ Magisk Hide is no longer on by default. So make sure the Magisk Hide, Hide Magisk from various forms of detection switch is flipped. Then press Hide Magisk Manager. This will bring up a box for you to choose a random name for the Magisk Manager, type whatever you want here. You can leave it Manager if you wish, but I typically change this.

Now open Magisk again. It will ask you to download it again, click ok, then manually open the app again as it says. Now we need to open Magisk hide. This is now under the shield icon, then click the arrow at the top:

These are the apps you don't want to know that you have root. Less is better. You can cause instability problems by just choosing everything. My general rule of thumb is, Google, steaming video, music, and payment apps get selected. In my experience if I come across an app that needs it and I didn't select it, I just clear cache and/or data and re-open the app and it works. There are some big multiplayer apps that ban hardware / people, so do your research (don't ask me, I don't play those games).

Next time to change the device fingerprint using MagiskHide Props Config Module. We do this using the terminal emulator. In the terminal emulator, type "su" to gain root privileges. Then type props to run the module:

Now it's just following the menus. Choose option 1 - Edit device finger print. (type 1, hit enter)

After this you will see a menu of devices. It doesn't matter what device you pick really. If you want apps / Google to think you have a OPPO or Samsung pick one of those Fingerprints. However there's a bit more to passing Safety-net than that. Since Google has changed how things work not all those fingerprints that used to work will work now. Also now you may get an error when you turn on the phone because of the security dates. The OP6T Android 10 fingerprint has no issues at this point, so use that if you want:

After choosing the fingerprint you want, it will ask you if you want to reboot. Choose yes. After rebooting, you may need to clear the cache from the play store for some apps to appear in it. You should now pass safety net. Check this in Magisk:

6. Very Optional, Ad Blocking with a Host File.

You can block many things with a hosts file, most popular would be ads. I've been use StevenBlack's host file which is a compilation of several hosts files. This is located on Github:

https://github.com/StevenBlack/hosts (Scroll down you'll see the options of what you can block)

Direct link to the hosts file I use. This will block Adware / Malware.

Unfortunately for quite some time now on this device you can no longer just use a root browser to swap the hosts file. The easiest way is to use TWRP.

First we have to make the hosts file. The hosts file must use unix / linux line endings. If you are using linux, don't worry about this, just create the file. If you are using Windows, the easiest thing to do is use Notepad++ (Free).

Notepad++ Downloads

Next one other caveat. The hosts file is quite large. I've never had much luck copy and pasting it from any other browser than Firefox (Windows or Linux), but however you get it into Notepad++ is not a big deal.

Once in you have the hosts file into Notepad++ go to Edit, EOL Conversion, and Choose Unix (LF).

Now save the file as "hosts" no ending. This does mean under file type you will need to change it to All File types *.*. Move this hosts file to your phone. Then reboot to recovery. From the main TWRP menu, choose mount. Then mount system:

Hit the back button and go to the advanced menu. Choose File Manager:

You will find your hosts file under /sdcard, wherever you placed it. In my case I placed it in a folder called ROMs. Once you locate it, press and hold it for a moment, and relase. Then choose copy file:

At this point you need to tell TWRP where you want to paste the hosts file. It belongs in the /etc folder. The only hic-cup here is depending on what you were doing in TWRP this could be (on this device) /system/etc or /system/system/etc (you will see similar folders to the image below if you are in the right place). Once you are there, press "paste?" button in the lower right corner:

After this just swipe to confirm:

You can now reboot the device, and your hosts file should now be in place. Your ad block should now be active for all apps as it's global for all connections.

7. Reboot to system.

Updating Lineage​

1. Flash Lineage.

Reboot to recovery. You can use the advanced reboot menu, or Volume Down + Power while turning the phone on. Don't wipe anything. From TWRP's main menu choose install. Then navigate to your ROM .zip location and click on it. Then swipe to confirm flash.

Lineage will replace TWRP, so you need to reflash TWRP as well. Run the TWRP installer again. After the TWRP installer has run, back out to the main menu, and choose reboot, then recovery:

2. Optional, Gapps (if you installed them once you must continue to install them or do a clean install)

Links:

NikGapps

Now that your phone is back in TWRP for the last time before booting up Lineage, it's time to install Gapps if you want them. This step is optional. Same as the other steps here, go to install, choose your OpenGapps package, Then navigate to your .zip location and click on it. Then swipe to confirm flash.

3. Reboot to system.

Last updated​

Since I don't want people to have to wonder if these instructions are current, I am going to periodically test and update this post with my results. Please note I'm testing with a 6T, TMobile 6Ts are different. You can generally assume previous versions of LOS and OOS were also tested, but if you are unsure feel free to ask in this thread.

Last tested with:

OOS 10.3.7 and LOS 17.1 12-31 with TWRP 3.4.0-2

OOS 10.3.11 and LOS 18.1 05-27 with TWRP 3.5.2_9-0

This method has also been tested with:

OOS 10.3.3 and Omnirom 5-24 MicroG and Omnirom 5-24.