[T-Mobile LG G5 Guides, News, & Discussion] kevin71246:
I did NOT Develop or create any of this! THANK YOU TO EVERYONE THAT DID!!

Although it would be easier for me to directly link to the files, instead I linked to the creators page for you to download the files, and give them credit.

What did I do?

I inherited a Tmobile LG G5 LG-H830 and couldn't find any good info to quickly get up and running a custom rooted ROM. So I spent a few days researching and testing, and decided to put all of this current info in one place in an easy to follow guide.

Who is this for?

Someone like me that wants an all-in-one, easy to follow guide to get a Custom ROM installed, but NOT a lot of time. The other key here is this information is the latest as of March 2019. Once you get this going, customize all you want. And DO share!! This guide should work on ALL software versions out there.

What will you have when you're done?

TWRP Recovery & LineageOS 15.1 (Oreo, Android 8). BUT, you can install your own ROM at that point instead if you want.

Quick Notes:

-About G5: https://xdaforums.com/lg-g5/how-to/info-autos-g5-thread-t3350648/

-Tmobile is easily bootloader unlockable, but no fastboot commands available! Dirtycow exploit is how to install the TWRP Recovery. All exploits are based on "20a", which is (Nougat Android 7.0). Guide will walk you through getting to this version.

-Root: Via Dirtycow exploit, Install TWRP & flash SuperSu

-LineageOs is the successor to CyanogenMod. It is directly based on AOSP, bare bones Android. ZERO bloat. You pick what Google apps get installed when you get to the GApps part.

This will wipe all of the data off your phone!! I am NOT responsible for ANYTHING you do!!

Summary:

-Prerequisites: ADB: Download Android SDK

-Unlock Bootloader

-Downgrade Android software to 20a (Nougat)

*Need 20a in order to flash TWRP	https://xdaforums.com/tmobile-lg-g5/development/stock-h830-20a-rom-flashable-zips-imgs-t3511294

-Install TWRP Recovery via ReCowvery	https://xdaforums.com/v20/development/h918-recowvery-unlock-v20-root-shell-t3490594

https://github.com/jcadduono/android_external_dirtycow#running

-Install LineageOS

Unlock Bootloader:

-Enable Developer options

-Enable OEM Unlock

-Connect USB PC<->Phone

-Unlock:	adb reboot bootloader

fastboot oem unlock

fastboot getvar unlocked	(Should say unlocked)

fastboot reboot	(get out of fastboot)

adb reboot bootloader	(restart into bootloader)

Downgrade to H83020a:

(Nougat Android 7.0) https://xdaforums.com/tmobile-lg-g5/development/stock-h830-20a-rom-flashable-zips-imgs-t3511294

-Download & Install LGUP_Store_Frame_Ver_1_14_3.msi	https://xdaforums.com/tmobile-lg-g5/development/stock-h830-20a-rom-flashable-zips-imgs-t3511294

-Download & unzip UPPERCUT_1.0.0.0.zip	https://xdaforums.com/tmobile-lg-g5/development/stock-h830-20a-rom-flashable-zips-imgs-t3511294

-Download & Install Latest LG Windows PC drivers	http://tool.lime.gdms.lge.com/dn/downloader.dev?fileKey=UW00120120425

-Download H83020a_00_1107.kdz	https://xdaforums.com/tmobile-lg-g5/development/stock-h830-20a-rom-flashable-zips-imgs-t3511294

-Turn OFF device then place in Download Mode: Hold Volume Up while plugging in USB cable.

-Double-click the UPPERCUT.exe to load LGUP... ( I got errors, then clicked abort - not sure whats going on here, but continue with steps below)

-Open LGUP (desktop shortcut)

-Select device

-Check "Upgrade" box

-Check BIN File box under File Type then select H83020a_00_1107.kdz

-Click START button to flash file to G5 (you may have to close and reopen LGUP before being able to hit Start)

-Phone reboots

-"Encryption Unsuccessful" message: Click Reset phone & allow it to do its thing

Install TWRP Recovery

- ReCowvery Method

https://github.com/jcadduono/android_external_dirtycow#running

https://xdaforums.com/v20/development/h918-recowvery-unlock-v20-root-shell-t3490594

https://xdaforums.com/tmobile-lg-g5/development/root-h830-20a-nougat-lg-g5-hard-t3542496

-Download (4) ReCowvery files to ADB.exe directory:	https://build.nethunter.com/android-tools/dirtycow/arm64/

-Download latest TWRP to ADB.exe directory & rename to twrp.img:	https://dl.twrp.me/h830/

-Command Steps:	https://github.com/jcadduono/android_external_dirtycow#running

adb push dirtycow /data/local/tmp

adb push recowvery-applypatch /data/local/tmp

adb push recowvery-app_process64 /data/local/tmp

adb push recowvery-run-as /data/local/tmp

adb push twrp.img

adb shell

$ cd /data/local/tmp

$ chmod 0777 *

$ ./dirtycow /system/bin/applypatch recowvery-applypatch	(wait until done, ~2min)

$ ./dirtycow /system/bin/app_process64 recowvery-app_process64	(will see Tmobile screen, continue)

$ exit

adb logcat -s recowvery	(still tmobile screen)

"[CTRL+C]"	(Keyboard CTRL+C to break from cmd)

adb shell reboot recovery	(wait for phone to reboot to Android)

adb shell

$ getenforce	(should say Permissive)

$ cd /data/local/tmp

$ ./dirtycow /system/bin/run-as recowvery-run-as

$ run-as exec ./recowvery-applypatch boot	(wait for it to flash boot image)

$ run-as su	(should say "We have root access")

ls /sdcard/twrp.img	(should show file)

dd if=/sdcard/twrp.img of=/dev/block/bootdevice/by-name/recovery	(flash TWRP)

reboot recovery

-Should be in TWRP!

TWRP Recovery Startup & Disable Encryption:

-Swipe to allow modifications

-Disable encryption & Root:

-Download latest no-verity zip to adb.exe folder:	https://build.nethunter.com/android-tools/no-verity-opt-encrypt/

-Copy to no-verity phone:

adb push no-verity-opt-encrypt-6.0.zip /sdcard

-Flash latest no-verity zip via TWRP

-Download latest SuperSu to adb.exe folder: (SuperSu/Root is only needed here if you will stick with Nougat rooted, won't hurt regardless)	https://download.chainfire.eu/1220/SuperSU/SR5-SuperSU-v2.82-SR5-20171001224502.zip

-Copy SuperSu to phone:

adb push SR5-SuperSU-v2.82-SR5-20171001224502.zip /sdcard

-Flash SuperSu zip via TWRP

-Format Data (REQUIRED!):

-TWRP->Reboot->Recovery

-TWRP->Wipe->[Format Data]

-Reboot

-Flash SuperSu again (? I didnt do this and didnt end up with SuperSu, hoping this fixes that)

-Wait for Android to boot, will show "Android is starting" message. Go through phone setup

-Should have SuperSu installed & root

*If you don't have SuperSu:

-Reboot to recovery (Enable Developer option, enable adb debugging, adb reboot recovery)

adb push SR5-SuperSU-v2.82-SR5-20171001224502.zip /sdcard

-Flash SuperSu zip. Wipe Cache/dalvik. Reboot System.

-Ignore Warning message on boot. This is because we unlocked the bootloader.

-Should have SuperSu now!

Install UNOFFICIAL LineageOS-15.1

(Oreo, Android 8)	https://xdaforums.com/lg-g5/development/rom-unofficial-lineageos-15-1-g5-t3806842

-Download GApps: (Pick you own style, I chose mini)	https://opengapps.org/?arch=arm64&api=8.1&variant=nano

-Download LineageOS for G5:	https://xdaforums.com/lg-g5/development/rom-unofficial-lineageos-15-1-g5-t3806842

-Download to-x86cpu.zip:	https://xdaforums.com/lg-g5/development/rom-unofficial-lineageos-15-1-g5-t3806842

-Copy files to phone

-Restart phone into TWRP Recovery:	adb reboot recovery

-TWRP:

-Flash to-x86cpu.zip

-Back, Back, Reboot->Recovery

-Flash LineageOS

-Wipe cache, and dalvik cache

*Optional: Flash Magisk (root, customization, etc)	https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

-Flash GApps

-Wipe->Factory Reset (swipe)

-Reboot . Will reboot a couple times. Then see arch with circle moving. Wait ~5 minutes. Enjoy.

-Install MagiskManager-v7.0.0.apk (Required for Magisk)	https://xdaforums.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445