Placek's corner

LG G5 H850 bootloader unlock, custom recovery and root

I have had a lot of trouble getting Magisk to work with the latest Oreo update. I've managed to get it to work great though, and I have written everything down in the hopes that it may help you too.

I've found this to be pretty unstable, updates to Magisk would often result in a bootloop. If you want root and custom recovery on your H850, your best bet would be to downgrade to Android 7. Things work so much better there.

Prequesites

You will need to download this file, which has everything you will need, and extract it somewhere. I recommend you use the torrent, but there is a direct link too. The SHA256 checksum is 923736288C9CD288074851B2D8CAD174999BA84E2D8BF163EA29A5666AF78B00.

The package contains:

You will also need 7zip or WinRAR to extract all of the files.

Preparation

I have prepared a package with all the files that you may need inside. Download it below, then extract it somewhere.

Make a backup of everything on your internal storage and external SD card before proceeding. I recommend using the built in LG Switch utility to make a copy of your system, which can be restored when everything is complete.

Copy files in "Copy to SD" folder to your phone's external SD card (don't copy it to the internal storage as that will get wiped in the process.)

Open the "LGUP" folder and install "LGMobileDriver_WHQL_Ver_4.5.0.exe", and "LGUP_Store_Frame_Ver_1_14_3.msi."

In the same folder, install "adb-setup-1.4.3.exe". Answer Yes to everything.

Open your phone dialer, and type in *#06*. Note down your IMEI number somewhere, it will be needed for the OEM unlock. In your phone settings, enable Developer mode by going to Settings > About phone > Software info, and tap "Build number" 7 times. Return to the settings, and enter Developer settings. Enable USB debugging and enable OEM unlock.

Unlocking bootloader

Turn off your phone completely. Hold down Volume -, and plug in the phone to your PC. Don't touch the power button. Your phone will enter Fastboot mode. Right click on the Start menu, and go to Device Manager. You should see a device named "Android", under the subsection "Other devices" with a yellow warning next to it. Right click on that, and click Update driver. Click "Browse my computer for drivers", then navigate to the CT_HsPhone_General_Drivers folder. Click next. Windows will find the correct driver, and in a short while the Fastboot driver will be installed.

Go to your desktop, and right click while holding down Shift. Click "Open Powershell window here." Typing "fastboot devices" should give you a result. If you see anything output, then your device is set up properly for Fastboot. If the command returns nothing, then the Fastboot drivers aren't installed correctly.

Type "fastboot oem device-id". This will return a string of characters which you will need for LG's website to generate the unlock.bin file. The site tells you where to input this and how. You will need to create an LG developer account but this is free.

If all goes well, you should receive an unlock.bin file in an email attachment. Put this on your desktop.

In the Powershell window, type "fastboot flash unlock ~/Desktop/unlock.bin". This will unlock your bootloader, and wipe your phone in the process. You have been warned. You'll also get a nice new warning message to look at every time you boot up your phone, as far as I know there's no way to remove that like you can on Samsungs.

If your phone is any model other than European (or RS988 US unlocked model, but this tutorial is not for that model,) the LG website will not generate you a unlock.bin. I don't really get why LG feels the need to lock this down, but there's not that can be done about it.

Assuming you are still in Fastboot mode, the quickest way to shut down your phone is to just pull the battery out. You won't harm anything, but make sure everything is finished flashing first.

Hold down Volume+ while plugging in the USB cable to your phone, not touching the power button. Your phone will enter download mode, and a few seconds later will say Firmware Update.

Earlier you have installed LGUP, and the LG mobile drivers. The installer might have put a LGUP icon on your desktop, ignore it. Use the "UPPERCUT_1.0.0.0.exe" crack to launch LGUP, it will find the installation by itself. Windows Defender will pick up the file as a trojan, but don't worry as this is a false positive. You will have to allow the file in Windows Defender.

Your phone should show up in the list on the top of the program. The program will display some errors if it doesn't detect your phone, and won't load.

Under process, select UPGRADE. Set the file path to the BIN file to the "H85030a_00_OPEN_EU_OP_0910.kdz" file. Press Start to start loading the stock firmware onto your phone.

When the process is done, your phone will reboot a few times, then load into the Android setup. Complete this setup, but don't bother putting any of your accounts in as the phone will be reset again.

Flashing TWRP recovery

Locate the .img file in the "TWRP" folder, and drag this to your desktop.

Once you are at the home screen, turn off your phone. Enter Fastboot mode and open a Powershell window as shown in the "Unlocking bootloader" section. In the window, type "fastboot flash recovery ~/Desktop/twrp-3.2.3-2-h850.img". Wait for this to complete, then type "fastboot reboot".

Immediatly after rebooting, hold down Volume- and the power button. Hold down the power button for a few seconds, let go of it for a few seconds, then hold down the power button again. The Volume- button should be pressed in for the whole time. If successful, you should see a screen talking about factory reset. Use the volume buttons and the power button, and navigate to Yes twice. TWRP will load. Don't swipe to enable write to system partition, click the box to keep system read-only.

If you boot into the system by accident, you will have to start the flashing TWRP recovery section again. This is because until we install the Magisk root .zip, the stock rom will overwrite the TWRP recovery with the stock one on every boot.

Flashing the stock rom (again) and Magisk root

Go to "Wipe". Press "Format Data", then type "yes". Go back to the main TWRP screen, press "Reboot", then "Recovery". Your phone will reboot back into recovery.

Go to "Flash", and find the "LG-H85030a-Flashable.COMPLETE.zip" you copied to your external SD card at the start. You may have to go up a few directories, and find a folder called "external-sd". Flash this file, then go back to the main menu (don't reset yet!) and do the same for the "Magisk-v17.1.zip". After flashing Magisk you can reset your phone. This time you can set up your phone properly. I recommend to make a backup after completing setup, just in case the Magisk update doesn't work properly. You can never have too many backups :)

Updating Magisk

Magisk Manager should be isntalled automatically, but if it isn't, install the APK "MagiskManager-v5.9.1.apk". Magisk Manager might force stop continuosly, but it should show a push notification about updating. Click on it, and the latest manager will download. From the latest manager, you can update Magisk, using the "Direct Install" option. Don't click on the preserve dm-verity checkbox. After your phone reboots, you can enjoy your rooted LG G5 on the latest Oreo firmware!

If you have any trouble with the MagiskManager .apk included, delete the app and install the latest manager from here.

Make a Nandroid backup now!! If you mess anything up later, you will save yourself the trouble of going through the whole process again, and can just start fresh with a clean phone and updated Magisk.

If you get error messages on bootup, if you have a lot of random Orange/Vodafone bloat, if your flashlight or Bluetooth stop working, then see the addendum below.

Addendum

I have found that installing an older version of Magisk and Magisk Manager, then updating them both, seems to work the best. Whenever I tried to flash the latest Magisk in TWRP, I would just get bootloops.

You may see the following errors on each bootup:

If your device is from mainland Europe you probably won't have this issue, but my phone is a UK model, so I am greeted with some bonus error messages on bootup. These messages don't really affect anything, but it can be annoying. To remove these messages:

Download a root file manager, and navigate to /cust. Delete everytihng inside this folder, and reboot. This might break WiFi calling, but if you want to use that then you probably should flash your carrier specific ROM anyway. (don't flash a .kdz ROM as you'll overwrite your root and recovery, but if you can somehow convert .kdz to a update.zip, then you should be able to flash it without losing your data or root.) My network doesn't support WiFi calling, so I don't worry about that.

You may also get a load of bloat apps, from a few different phone networks, which can be removed with a root uninstaller. Below are all the carrier apps that I can find. My guess is that the installer gets a bit confused as to what country my phone is from, so it just installs everything it has onto the phone. The UK ROM can do the same, it will install your carrier's application depending on what simcard is inserted, they're all in the ROM and are installed at the first boot.

You can probably delete some more apps here, for example I believe Google Play Music and the LG Friends Manager are now inactive. And LG commits the sin of making Facebook and Instagram system apps, for god knows what reason. Make sure you make a backup in TWRP before messing around with anything, if you brick your phone you just have to start this tutorial from the start, but with a backup you will save a lot of time.

This root doesn't seem to pass Google's SafetyNet check, although from what I can tell this seems to be more of an issue with Magisk and Google, rather than the phone itself. Google Pay, your banking app, and some games might not work due to this, you'll have to find your own way around that as everyone's case will be different. For me personally, everything seems to work just fine. The problem with Google Pay mainly is that it might install and activate just fine, but it won't work when you try it at the card terminal. So you should check just to be 100% sure before you go leaving your wallet at home. My Google Pay seems to be working fine, and testing with another phone shows that it's putting out an NFC signal, so my hopes are pretty high up that it'll work fine.

For whatever reason, Magisk can break the flashlight. The flash wont show up at all in the camera app, and clicking the flashlight in the drop down menu will give an error. I see some reports of Bluetooth being broken too. If you have this issue, just flash the "H850_v2.2-mk2000.zip" kernel in TWRP. You may want to install the TWRP app (from the app store, don't do it from TWRP itself if it asks!) to easily reboot to recovery. After flashing, reboot, and your flashlight and BT will work. The forum thread for this kernel can be found here.

The End!

Thanks for reading, and I hope I have helped you get your root working on Android Oreo. TIf you have any trouble, or have something to add, then feel free to email me at placekxyz@protonmail.com.