[LG G5 ROMs, Kernels, Recoveries, & Other Developme] agnostic-apollo:
Updating from modified 21b to 21d using official ota's

DISCLAIMER: i wont be responsible if you brick your device or lose data. Do at your own risk like i did.

I see a lot of people failing to update using zips and bricking and getting into bootloops, i think i only saw one or two people in comments who actually got this to work after trying random stuff.

I didnt wanna risk it, and moreover some paritions could be missing from the zips that might have been updated in the ota's, could be wrong about this, tried to examine the ota file a while back without much success

Here are the instructions that should work to update from modified 21b to 21d using official ota's, atleast the one i did

For ota's your system, boot, recovery and possibly misc and some other partitions need to be stock and unmodified. I had modified my system, boot and recovery and also had previously modified my stock misc partition using scripts to randomize my mac address for privacy situations if need be, but i restored unmodified stock misc partiton before taking ota's. Also LG-RS98821a-Flashable.COMPLETE-ARB01.zip was flashed to downgrade bootloader to 21a so that Asgard kernel 7.0 could work with my 21b rom. Now to update from 21b to 21d this should work.

1) Backup Internal SD, misc and data parition as data will be LOST when stock recovery does a factory reset

2) Flash LG-RS98821a-Flashable.COMPLETE-ARB01.zip with TWRP

3) Restore any other modified partition like misc with stock or ota might fail, boot parition would already have been replaced with stock in last step among some other partitions

4) Restore stock recovery by running "adb reboot bootloader" and then "fastboot flash recovery lg-g5-rs988-stock-recovery-21b.img" once in fastboot to replace TWRP

5) Reboot and download 21b from settings using update center, install when download completes

6) Once phone boots again, update to 21c and then to 21d using the same procedure, note that during updates phone will probably ask you to do a factory reset to remove previous encyption unless you did a format with twrp before.

7) Install TWRP with "fastboot flash recovery twrp-3.0.2-1-rs988.img", do not do "fastboot reboot" or TWRP will be replaced with stock recovery once phone reboots and if you try to go into recovery you will format your data parition including Internal SD as stock recovery will boot, you can flash twrp again with fastboot if you made the mistake

Instead after fastboot flash, unplug battery and start phone again with vol down+power and boot to TWRP as normally done, donot make a mistake as you will have to flash twrp again. Do the following steps in the order given or you will probably get stuck at a flashing black screen after LG logo or into a bootloop

8)To Install Asgard 7.0 Kernel (can be skipped)

i) Flash Asgard-Reborn-lge-rs988-v7.0-17112017-2328.zip

ii) Flash LG-RS98821a-Flashable.Bootloader-ARB01.zip so that Asgard kernel doesnt bootloop

9) Flash xposed-v89-sdk24-arm64 to install xposed (can be skipped)

10) Flash SuperSU or Magisk (if this isnt done TWRP will be replaced with stock recovery on next reboot

11) Clear cache and dalvik/art and reboot phone, and either let "Android Upgrading" finish or just pull the battery and boot to TWRP as art cache will need to built again anyways

12) Restore Data parition you backed up in step one

13) Use TWRP filemanager and delete the following files in /data/system if you had setup a lockscreen pattern or fingerprint before, if you dont delete this you probably wont be able to unlock screen on reboot

gatekeeper.password.key, gatekeeper.pattern.key, locksettings.db, locksettings.db-shm, locksettings.db-wal

14) Clear cache and dalvik/art and reboot phone

13) You should be back to the way you were.

This is kinda a dirty upgrade and you could face problems as the data parition was restored instead of a factory reset, you could try clearing data of problematic apps.

I did not backup my Internal SD and lost a lot of my data during one of updates when the phone asked me to do a factory reset to proceed.

I thought the phone would go to twrp on reboot but instead stock recovery booted and it erased my phone as it had replaced TWRP during the boot. I did take a dump of userdata immediatelly after this using unlocked LG UP, will try recovering data. Basically dont make my mistake.

You can also flash recovery using unlocked LG UP, rename recovery to "recovery.img" and flash using "parition dl"

Links

21a stock rom and bootloader

http://downloads.codefi.re/autoprime/LG/LG_G5/RS988/RS98821a-USA

lg-g5-rs988-stock-recovery-21b.img, i recovered my stock recovery using recoverybak partition as i didnt backup my primary recovery partition when i first installed twrp, the one given in codefi by autoprime is most likely twrp as i tried flashing it. The one below if stock

http://www.mediafire.com/file/ar570bz444xe4hb/lg-g5-rs988-stock-recovery-21b.img

Unlocked LG UP

https://xdaforums.com/showpost.php?p=73051003&postcount=32