• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

[HOWTO][H815] Complete Guide to Unlock Bootloader + TWRP + Root + Xposed + ViperFX

Search This thread

htr5

Senior Member
May 18, 2014
358
238
Disclaimer and Warning: By attempting any of the processes outlined below, you accept full responsibility for your actions. Neither the contributors of this thread or XDA are responsible for any damage caused. Some of the actions may void your warranty.
I recently went through all of this and it took me quite a while to dig through dozens of threads so I decided to make a new one bringing all of these great things together specifically for the H815. Brace yourselves for the Android right of passage...

LG G4 H815 Marshmallow 6.0 Guide.
1. Unlock the Bootloader
2. Install the custom recovery: TWRP
3. Root
4. Install Xposed
5. Install Viper4Android
6. Unbrick Guide
7. Debloat
8. Battery Optimisations


- Quicklinks:

IMPORTANT | IMPORTANT | IMPORTANT | IMPORTANT | IMPORTANT
Backup any personal files because everything will be deleted! Make sure you have at least 50% battery remaining.

1. Unlocking the bootloader officially
This is the first step in voiding your warranty so is the point of no return. I've read in some places that you may be able to do this without voiding your warranty but I did not look into this.

WARNING - This will delete everything on the phone so make sure to backup important personal files.
i) Visit the official LG website to obtain a bootloader unlock file. First click the 'How to Unlock the Bootloader' tab and then the button 'Starting Unlocking the Bootloader' at the bottom of the page: https://developer.lge.com/resource/mobile/RetrieveBootloader.dev
ii) Sign up to a free developer account using a real email address (it's needed)
iii) Enter your IMEI number which you can find on your box, under the battery or by dialing *#06# on the phone. Keep this tab open
iv) On your phone, go to settings -> About phone -> Software info and then tap on Build number 7 times. Go back to Developer options under general settings and enable 'USB debugging' and 'Enable OEM unlock'.
v) Install the LG G4 drivers from here: http://oceanhost.eu/e4h2px4e0hkd/LGMobileDriver_WHQL_Ver_4.0.4.exe.htm
vi) Download and install minimal adb 1.4 from here: https://www.androidfilehost.com/?fid=24521665358595410
vii) Browse to where you installed this and then right click and select 'Open command window here'. By default, this is in C:\Program Files (x86)\Minimal ADB and Fastboot
viii) Plug in your phone to your computer using a reliable USB port and cable (USB 3.0 doesn't seem to work). Enter "adb reboot bootloader" into the command window without quotations. Wait for it to reboot and then type "fastboot oem device-id"
ix) This fastboot command will return a character string. This is the Device ID which is needed to generate your unique unlock key. It will look like this:
Code:
Example Device ID (PC User)$ fastboot oem device-id
(bootloader)-----------------------------------------------------------------
(bootloader) Device-ID
(bootloader) CD58B679A38D6B613ED518F37A05E013
(bootloader) F93190BD558261DBBC5584E8EF8789B1
(bootloader)-----------------------------------------------------------------
To generate your unlock key, you will need to paste together the 2 lines of output into one continuous string without "(bootloader)" or white spaces. In the example above, the Device ID would be:
CD58B679A38D6B613ED518F37A05E013F93190BD558261DBBC5584E8EF8789B1
Paste this into the LG website form and confirm. It will email you an unlock.bin file which you need to put in the same folder as your adb.exe file.
x) Now enter "fastboot flash unlock unlock.bin" into the command window. This should take seconds.
xi) Now check it is unlocked. By entering “fastboot reboot” and waiting for it to reboot. Then enter "adb reboot bootloader" again and then "fastboot getvar unlocked" and verifying that the response is "unlocked: yes".
Your bootloader should now be unlocked.Keep this command window open for the next step.

Thanks to shimp208 for minimal adb http://forum.xda-developers.com/showthread.php?t=2317790


2. Installing TWRP Custom Recovery
This will install a custom recovery allowing you to make backups and flash zip files.

i) With your bootloader freshly unlocked, you can boot up the device and set it up. Go through the startup guide thoroughly without skipping as these settings are going to stay.
ii) Download the latest TWRP img file from https://forum.xda-developers.com/attachment.php?attachmentid=4387389&d=1515789045 and place it in the same folder as your adb.exe file and unlock.bin. Now rename it to lgg4-twrp.img without changing the file extension!
iii) Now also copy the lgg4-twrp.img file to your phone's SD card using a USB cable.
iv) Enable USB debugging again
v) Open up a command window again by Shift+Right clicking in the folder with adb.exe.
vii) In the command window, type "adb reboot bootloader". Wait to enter the bootloader and then type "fastboot boot lgg4-twrp.img" and hit enter. The device should now restart in TWRP but it is not installed yet.
vii) Once TWRP starts, select 'install' and then tick 'images' at the bottom.
viii) Find the lgg4-twrp.img file and select it. Then in the next menu select 'recovery' and swipe the bar at the bottom to confirm flash.
ix) You should then see 'Image Flash Complete' so can select back then reboot and system.

(If installing from an external SD card, go to 'mount' from the main screen and then tick to mount your ext SD card. Go back and continue as normal)

Thanks to TeamWin for TWRP https://twrp.me/
Thanks to Adam Myczkowski for TWRP install corrections.



3. Root
By now, you should have an unlocked bootloader and a custom recovery installed.

If you use snapchat, you won't be able to log in with a rooted phone. So it would be a good idea to install it now and log in. You remain logged in rooting and installing Xposed. Quicklink: https://play.google.com/store/apps/details?id=com.snapchat.android
i) Download SuperSU from https://www.androidfilehost.com/?fid=24369303960690845 and place it on your phones internal storage.
(this works fine but you can get the latest from here: http://forum.xda-developers.com/showpost.php?p=64161125&postcount=3
ii) Make sure you have USB debugging enabled again.
iii) Now with your phone on and plugged in, enter recovery by opening adb as before and entering "adb reboot recovery".
If you have problems, see the end of this section​
iv) Once in the recovery, hit install and browse to the SuperSU file we just downloaded.
vii) Swipe flash and then reboot into the system.
The phone should now boot and be rooted. If not, see the notes at the end of this section.
You can use https://play.google.com/store/apps/details?id=com.joeykrim.rootcheck to verify if you have root.

• If your phone does not turn on then pull out the battery and USB cable and then put just the battery back in. Now Press and hold the volume down and power buttons together. Then first LG logo should appear. Now continue holding the down button but release the power button for one second and then press it again and hold.
You should now see a screen asking you to wipe everything. Navigate with the down arrow and press the power button for both screens. This should now take you to TWRP recovery and NOT actually wipe the phone.
• If you had a bootloop then follow the above steps to get into the recovery and then you will need to download the following onto the phone: http://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503 [1.5GB]
Once in the recovery, you are able to connect the phone to the computer for regular data transfer in order to transfer the file. (I had problems with the microSD card so I would avoid it).
This system image seems to be missing the FM Radio, LG Remote and SmartSettings, Voice Recorder and Quickmemo apps. To get these back, go to general settings -> About phone -> Update centre -> App updates and download/install as necessary.​
• If you still could not get into the recovery at all then follow the unbrick steps below in section 6.​

Thanks to autoprime for the system images [url[http://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503[/url]
Thanks to Chainfire for SuperSU http://forum.xda-developers.com/showpost.php?p=64161125




4. Installing Xposed

i) Download Xposed from here: https://forum.xda-developers.com/attachment.php?attachmentid=3848457&d=1471691646 and place it on your phone or SD card
ii) Enter recovery using the methods shown before. (You can also now enter recovery using this root app: https://play.google.com/store/apps/details?id=com.antaresone.quickreboot)
iii) Use the recovery menus to flash the zip file. Reboot.
iv) Download and install the Xposed installer app, XposedInstaller_3.0_alpha4.apk, from the post attachment here: http://forum.xda-developers.com/showthread.php?t=3034811

Thanks to rovo89 for Xposed and Follow_and_Feel for sharing the G4 Xposed link http://forum.xda-developers.com/showthread.php?t=3034811


5. Installing Viper4Android (this breaks FM radio!)


WARNING - The FM radio app will not work after installing this.

i) Download Viper4Android from here: https://www.dropbox.com/s/lvcxffdqimbi78b/V4A_Poweramp_Lollipop_v3.zip?dl=0
ii) Place the zip file on your phone or SD card and flash it in recovery. Reboot.
iii) Open the ViperFX app. From the menu and install the driver.
iv) You need to get Viper4Android to run in enforcing mode so flash this zip in recovery: https://www.dropbox.com/s/k9cnruw2e1t1d4t/ViPER4Android-supolicy.zip?dl=0
Install it. Open the app and set selinux to permissive. Reboot.
v) Install BusyBox from here: https://play.google.com/store/apps/details?id=stericson.busybox

Thanks to the ViperFX developers and zhuhang for Viper4Android http://forum.xda-developers.com/showthread.php?t=2191223
Thanks to Choristav for the Viper4Android file http://forum.xda-developers.com/lg-g2/general/guide-poweramp-viper4android-lollipop-t3133935
Thanks to maximumentropy for the SElinux enforcing zip http://forum.xda-developers.com/showthread.php?p=61242973#post61242973



Once all this is done and you're happy. It would be a good idea to enter recovery and make a full backup so that you can restore to the clean rooted state.

6. Unbrick Guide

If something messed up while flashing something and can't boot. Open up the recovery and restore your backup. If you don't have one, flash the v20d system image from an external SD card [1.5GB]. Download here: http://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503

If you cannot get to the recovery then follow these steps:
i) Make sure you have the LG Drivers installed from here: http://oceanhost.eu/e4h2px4e0hkd/LGMobileDriver_WHQL_Ver_4.0.4.exe.htm
ii) Download the LG Bridge software from here: http://www.lg.com/us/support/product-help/CT10000025-1438110404543-preinstall-apps
iii) Remove the battery and reinsert it so the device it is fully off.
iv) While holding the up volume button, insert your USB cable.
v) You should enter download mode. Go to the Software Update tab of the LG Bridge. It will say connecting and then should say your device is up to date. Click on the recovery text on the bottom right and then follow the instructions. The software will download the system image for you and this is roughly 1.6GB so make sure your firewall doesn't block this connection.

This shouldn't delete your data (no guarantees) but you will have to grant app permissions again and reapply any changes to system files e.g. root, viper4android, xposed ect.

If you have problems try this method instead:
http://forum.xda-developers.com/g4/general/guide-lg-g4-stock-firmware-to-stock-kdz-t3107848



7. Debloat

Here is a list of apps and services an XDA user has suggested removing: https://forum.xda-developers.com/g4/general/bloatware-tool-t3141890/post61509537#post61509537

Removing these won't break the phone but of course be smart about it; removing Weather will mean you don't have the weather app. I only removed Google apps I don't use and redunadant apps from LG.
You can remove bloat apps using the Titanium Backup app from here: https://play.google.com/store/apps/details?id=com.keramidas.TitaniumBackup
I would advice you to make a backup of them first in case you want them back. It's the easiest way to get the apps back.
If you do need a guide for using Titanium Backup, head over to this excellent guide: http://forum.xda-developers.com/showthread.php?t=2717159



8. Battery Optimisations


The aim is to get maximum battery life without compromising speed, user experience, features or notifications.
(I'm just going to use the following space as a log of things I've done. I will tidy this up when complete. Please do suggest if any of these things are ineffective or detrimental.)
Read through this guide: http://forum.xda-developers.com/g4/general/guide-g4-lag-free-marshmallow-t3327878
1. Disable Activity Logs: General Settings -> About phone -> Activity Logs at the bottom.
Also try following the steps on here; users report better battery life: https://www.reddit.com/r/lgg4/comments/4fb4uf/psa_free_up_some_ram_up_to_300mb_and_maybe_gain_a/
2. Disable Smart Settings under General Settings
3. Disable Bluetooth and Wi-Fi scanning location service: General Settings -> Location -> Menu -> Scanning -> Untick both. (I honestly can't believe these exist. I wondered why I have bluetooth wakelocks)
4. Disable Open Wi-Fi scanning: Network Settings -> Wi-Fi -> Menu -> Advanced -> Untick Wifi notification. Toggle this on and off as it should also fix random white LED blinking.
5. Greenify 2.9 beta to enable aggressive doze.
6. Follow this guide for processor tweaks http://forum.xda-developers.com/nexus-5x/general/guide-advanced-interactive-governor-t3269557


Please note that this is my first thread and I'm not a developer. I hope the instructions are as complete and accurate as possible and they are what I followed for my H815 602. If there are any things I forgot or updates, please do let me know.
 

Attachments

  • xposed-v84-sdk23-arm64-test3.zip
    7.8 MB · Views: 3,630
  • lgg4-twrp.zip
    14.5 MB · Views: 9,290
Last edited:

whitenoise2007

Senior Member
Oct 6, 2008
79
14
Galati
when i try to get my device id it just hangs at:
Code:
C:\ADB>adb reboot bootloader

C:\ADB>fastboot oem device-id
< waiting for any device >
any ideas?
running win10, with the drivers installed.

-LE-
found out the problem. usb3.0 does not work :D used usb2.0 and work flawlessly
 
Last edited:
  • Like
Reactions: htr5

Adam Myczkowski

Senior Member
Aug 29, 2015
451
373
On 6.0 Android is more secured and so to install recovery you have to either boot the recovery, flash custom kernel, then flash recovery or unpack boot.img from a custom kernel, flash it via fastboot, then flash recovery and lastly full kernel package in recovery. Better if you include this in your guide because many people will be asking "why my recovery is not booting?" and that's what we don't want. :) I've repeated this about 50 times or more and finally I will not have to. :p
 
  • Like
Reactions: htr5

Redgoblin

Member
Sep 8, 2010
41
7
Lindesberg
Hi! Thanks for this guide!
Just found a "typo"
ii) Now with your phone on and plugged in, enter recovery by opening adb as before and entering "adb fastboot recovery". (You will need to enable USB debugging again)
I'm sure it should say "adb reboot recovery" : )
It could be worth saying that after installing root, there will be a boot loop or two, it even say so when you install the latest SuperSU.

I am also interested in your battery optimization, the most I've done so far is to disable NFC and location and disable some of my google account syncs that I don't use or use very rarely.
 
  • Like
Reactions: htr5

htr5

Senior Member
May 18, 2014
358
238
Hi! Thanks for this guide!
Just found a "typo"
ii) Now with your phone on and plugged in, enter recovery by opening adb as before and entering "adb fastboot recovery". (You will need to enable USB debugging again)
I'm sure it should say "adb reboot recovery" : )
It could be worth saying that after installing root, there will be a boot loop or two, it even say so when you install the latest SuperSU.

I am also interested in your battery optimization, the most I've done so far is to disable NFC and location and disable some of my google account syncs that I don't use or use very rarely.
Thanks for the correction.

In addition to what you've done, I have installed greenify and hibernated Snapchat, Viber and Facebook apps. WhatsApp isn't hibernated.

I have the donate version and xposed so till gcm push notifications.

I haven't done anything else. I had better battery stats installed for a few days and I kept checking it and was annoyed that I'd always have ~30% awake time with the screen off. There were no kernel wake locks, it was just app alarms mainly from android and Google.
 

htr5

Senior Member
May 18, 2014
358
238
I was getting 4 hours SOT and 20 hours use out of the box. Now I'm down to 3 hours 30.
I really wish the Autostarts app would work but it has no effect: https://play.google.com/store/apps/details?id=com.elsdoerfer.android.autostarts
This would allow me to stop many apps from waking up everytime the connectivity changes or the screen is unlocked.

I have Greenify with the donate Xposed settings. Coalescing, Deep Hibernation and GCM push enabled only. Here are the apps I have greenfied:
  • Maps
  • Skype
  • Viber
  • Messenger
  • Snapchat

Whatsapp
Gmail with 1 Google and 1 Yahoo account
CF.Lumen
Lux Autobrightness
Spotify
Viper4Android in High quality mode. Enabled are playback gain control; Equalizer; Dynamic System; Fidelity Control; Auditory System Protection and gain limiter.
 
Last edited:

joriq

Senior Member
Aug 11, 2009
826
210
Podgorica
i am wondering: if I go to settings / general / backup&reset, and then LG backup and perform a full backup on my SD card, will I be able to restore it all after rooting and get the system as it was previously?
 

htr5

Senior Member
May 18, 2014
358
238
i am wondering: if I go to settings / general / backup&reset, and then LG backup and perform a full backup on my SD card, will I be able to restore it all after rooting and get the system as it was previously?

I haven't tried it myself but have gone with the tried and trusted TWRP backup: http://www.howtogeek.com/240582/how-to-back-up-and-restore-your-android-phone-with-twrp/
And ADB backup which also works without root: http://forum.xda-developers.com/galaxy-nexus/general/guide-phone-backup-unlock-root-t1420351

These work great; you end up booting exactly where you left off and even with browser tabs still open as you left them.

From my understanding, you would need to boot into the phone and then perform the restore in the LG app. So this would require a bootable phone. The only times I restore would be after bootloops. For general app restore and settings, I use Titanium Backup. This provides the added benefit of being able to restore on different phones.
 

joriq

Senior Member
Aug 11, 2009
826
210
Podgorica
just to update all of you: I did root my 20d g4 and LG backup managed to restore almost everything. All apps are back, but I needed to agree to permissions for all of them and some returned with saved data, some did not. For example, none of my BT devices were recognised, so I have to pair all of them, which is tricky for moto 360, since it needed to be factory reset. However, I am very pleased with how things went in the end.

Also, my phone was not recognised when rebooting to fastboot, it took me an hour of changing ports and drivers, but then I decided to install the driver manually via device manager (win 7). I made an educated guess and nailed it :D
Also, I had a really hard time unlocking the bootloader, because LG site kept providing "service unavailable" message, so I had to fool the server that I am in Singapore (like in this guide https://youtu.be/O64GfQORCaE )...
 
  • Like
Reactions: htr5

htr5

Senior Member
May 18, 2014
358
238
I've updated the Viper4Android install method. You can flash this zip file: http://forum.xda-developers.com/showthread.php?p=61242973#post61242973

This will allow you to run Viper4Android without having to set SELinux to permissive. This is better for security but I also had issues with the SELinux mode changing back so would sometimes have to reboot or reinstall the viper driver to get it to work again. After doing this, you don't need the SELinux mode changer app.
 

Top Liked Posts

  • There are no posts matching your filters.
  • 53
    Disclaimer and Warning: By attempting any of the processes outlined below, you accept full responsibility for your actions. Neither the contributors of this thread or XDA are responsible for any damage caused. Some of the actions may void your warranty.
    I recently went through all of this and it took me quite a while to dig through dozens of threads so I decided to make a new one bringing all of these great things together specifically for the H815. Brace yourselves for the Android right of passage...

    LG G4 H815 Marshmallow 6.0 Guide.
    1. Unlock the Bootloader
    2. Install the custom recovery: TWRP
    3. Root
    4. Install Xposed
    5. Install Viper4Android
    6. Unbrick Guide
    7. Debloat
    8. Battery Optimisations


    - Quicklinks:

    IMPORTANT | IMPORTANT | IMPORTANT | IMPORTANT | IMPORTANT
    Backup any personal files because everything will be deleted! Make sure you have at least 50% battery remaining.

    1. Unlocking the bootloader officially
    This is the first step in voiding your warranty so is the point of no return. I've read in some places that you may be able to do this without voiding your warranty but I did not look into this.

    WARNING - This will delete everything on the phone so make sure to backup important personal files.
    i) Visit the official LG website to obtain a bootloader unlock file. First click the 'How to Unlock the Bootloader' tab and then the button 'Starting Unlocking the Bootloader' at the bottom of the page: https://developer.lge.com/resource/mobile/RetrieveBootloader.dev
    ii) Sign up to a free developer account using a real email address (it's needed)
    iii) Enter your IMEI number which you can find on your box, under the battery or by dialing *#06# on the phone. Keep this tab open
    iv) On your phone, go to settings -> About phone -> Software info and then tap on Build number 7 times. Go back to Developer options under general settings and enable 'USB debugging' and 'Enable OEM unlock'.
    v) Install the LG G4 drivers from here: http://oceanhost.eu/e4h2px4e0hkd/LGMobileDriver_WHQL_Ver_4.0.4.exe.htm
    vi) Download and install minimal adb 1.4 from here: https://www.androidfilehost.com/?fid=24521665358595410
    vii) Browse to where you installed this and then right click and select 'Open command window here'. By default, this is in C:\Program Files (x86)\Minimal ADB and Fastboot
    viii) Plug in your phone to your computer using a reliable USB port and cable (USB 3.0 doesn't seem to work). Enter "adb reboot bootloader" into the command window without quotations. Wait for it to reboot and then type "fastboot oem device-id"
    ix) This fastboot command will return a character string. This is the Device ID which is needed to generate your unique unlock key. It will look like this:
    Code:
    Example Device ID (PC User)$ fastboot oem device-id
    (bootloader)-----------------------------------------------------------------
    (bootloader) Device-ID
    (bootloader) CD58B679A38D6B613ED518F37A05E013
    (bootloader) F93190BD558261DBBC5584E8EF8789B1
    (bootloader)-----------------------------------------------------------------
    To generate your unlock key, you will need to paste together the 2 lines of output into one continuous string without "(bootloader)" or white spaces. In the example above, the Device ID would be:
    CD58B679A38D6B613ED518F37A05E013F93190BD558261DBBC5584E8EF8789B1
    Paste this into the LG website form and confirm. It will email you an unlock.bin file which you need to put in the same folder as your adb.exe file.
    x) Now enter "fastboot flash unlock unlock.bin" into the command window. This should take seconds.
    xi) Now check it is unlocked. By entering “fastboot reboot” and waiting for it to reboot. Then enter "adb reboot bootloader" again and then "fastboot getvar unlocked" and verifying that the response is "unlocked: yes".
    Your bootloader should now be unlocked.Keep this command window open for the next step.

    Thanks to shimp208 for minimal adb http://forum.xda-developers.com/showthread.php?t=2317790


    2. Installing TWRP Custom Recovery
    This will install a custom recovery allowing you to make backups and flash zip files.

    i) With your bootloader freshly unlocked, you can boot up the device and set it up. Go through the startup guide thoroughly without skipping as these settings are going to stay.
    ii) Download the latest TWRP img file from https://forum.xda-developers.com/attachment.php?attachmentid=4387389&d=1515789045 and place it in the same folder as your adb.exe file and unlock.bin. Now rename it to lgg4-twrp.img without changing the file extension!
    iii) Now also copy the lgg4-twrp.img file to your phone's SD card using a USB cable.
    iv) Enable USB debugging again
    v) Open up a command window again by Shift+Right clicking in the folder with adb.exe.
    vii) In the command window, type "adb reboot bootloader". Wait to enter the bootloader and then type "fastboot boot lgg4-twrp.img" and hit enter. The device should now restart in TWRP but it is not installed yet.
    vii) Once TWRP starts, select 'install' and then tick 'images' at the bottom.
    viii) Find the lgg4-twrp.img file and select it. Then in the next menu select 'recovery' and swipe the bar at the bottom to confirm flash.
    ix) You should then see 'Image Flash Complete' so can select back then reboot and system.

    (If installing from an external SD card, go to 'mount' from the main screen and then tick to mount your ext SD card. Go back and continue as normal)

    Thanks to TeamWin for TWRP https://twrp.me/
    Thanks to Adam Myczkowski for TWRP install corrections.



    3. Root
    By now, you should have an unlocked bootloader and a custom recovery installed.

    If you use snapchat, you won't be able to log in with a rooted phone. So it would be a good idea to install it now and log in. You remain logged in rooting and installing Xposed. Quicklink: https://play.google.com/store/apps/details?id=com.snapchat.android
    i) Download SuperSU from https://www.androidfilehost.com/?fid=24369303960690845 and place it on your phones internal storage.
    (this works fine but you can get the latest from here: http://forum.xda-developers.com/showpost.php?p=64161125&postcount=3
    ii) Make sure you have USB debugging enabled again.
    iii) Now with your phone on and plugged in, enter recovery by opening adb as before and entering "adb reboot recovery".
    If you have problems, see the end of this section​
    iv) Once in the recovery, hit install and browse to the SuperSU file we just downloaded.
    vii) Swipe flash and then reboot into the system.
    The phone should now boot and be rooted. If not, see the notes at the end of this section.
    You can use https://play.google.com/store/apps/details?id=com.joeykrim.rootcheck to verify if you have root.

    • If your phone does not turn on then pull out the battery and USB cable and then put just the battery back in. Now Press and hold the volume down and power buttons together. Then first LG logo should appear. Now continue holding the down button but release the power button for one second and then press it again and hold.
    You should now see a screen asking you to wipe everything. Navigate with the down arrow and press the power button for both screens. This should now take you to TWRP recovery and NOT actually wipe the phone.
    • If you had a bootloop then follow the above steps to get into the recovery and then you will need to download the following onto the phone: http://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503 [1.5GB]
    Once in the recovery, you are able to connect the phone to the computer for regular data transfer in order to transfer the file. (I had problems with the microSD card so I would avoid it).
    This system image seems to be missing the FM Radio, LG Remote and SmartSettings, Voice Recorder and Quickmemo apps. To get these back, go to general settings -> About phone -> Update centre -> App updates and download/install as necessary.​
    • If you still could not get into the recovery at all then follow the unbrick steps below in section 6.​

    Thanks to autoprime for the system images [url[http://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503[/url]
    Thanks to Chainfire for SuperSU http://forum.xda-developers.com/showpost.php?p=64161125




    4. Installing Xposed

    i) Download Xposed from here: https://forum.xda-developers.com/attachment.php?attachmentid=3848457&d=1471691646 and place it on your phone or SD card
    ii) Enter recovery using the methods shown before. (You can also now enter recovery using this root app: https://play.google.com/store/apps/details?id=com.antaresone.quickreboot)
    iii) Use the recovery menus to flash the zip file. Reboot.
    iv) Download and install the Xposed installer app, XposedInstaller_3.0_alpha4.apk, from the post attachment here: http://forum.xda-developers.com/showthread.php?t=3034811

    Thanks to rovo89 for Xposed and Follow_and_Feel for sharing the G4 Xposed link http://forum.xda-developers.com/showthread.php?t=3034811


    5. Installing Viper4Android (this breaks FM radio!)


    WARNING - The FM radio app will not work after installing this.

    i) Download Viper4Android from here: https://www.dropbox.com/s/lvcxffdqimbi78b/V4A_Poweramp_Lollipop_v3.zip?dl=0
    ii) Place the zip file on your phone or SD card and flash it in recovery. Reboot.
    iii) Open the ViperFX app. From the menu and install the driver.
    iv) You need to get Viper4Android to run in enforcing mode so flash this zip in recovery: https://www.dropbox.com/s/k9cnruw2e1t1d4t/ViPER4Android-supolicy.zip?dl=0
    Install it. Open the app and set selinux to permissive. Reboot.
    v) Install BusyBox from here: https://play.google.com/store/apps/details?id=stericson.busybox

    Thanks to the ViperFX developers and zhuhang for Viper4Android http://forum.xda-developers.com/showthread.php?t=2191223
    Thanks to Choristav for the Viper4Android file http://forum.xda-developers.com/lg-g2/general/guide-poweramp-viper4android-lollipop-t3133935
    Thanks to maximumentropy for the SElinux enforcing zip http://forum.xda-developers.com/showthread.php?p=61242973#post61242973



    Once all this is done and you're happy. It would be a good idea to enter recovery and make a full backup so that you can restore to the clean rooted state.

    6. Unbrick Guide

    If something messed up while flashing something and can't boot. Open up the recovery and restore your backup. If you don't have one, flash the v20d system image from an external SD card [1.5GB]. Download here: http://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503

    If you cannot get to the recovery then follow these steps:
    i) Make sure you have the LG Drivers installed from here: http://oceanhost.eu/e4h2px4e0hkd/LGMobileDriver_WHQL_Ver_4.0.4.exe.htm
    ii) Download the LG Bridge software from here: http://www.lg.com/us/support/product-help/CT10000025-1438110404543-preinstall-apps
    iii) Remove the battery and reinsert it so the device it is fully off.
    iv) While holding the up volume button, insert your USB cable.
    v) You should enter download mode. Go to the Software Update tab of the LG Bridge. It will say connecting and then should say your device is up to date. Click on the recovery text on the bottom right and then follow the instructions. The software will download the system image for you and this is roughly 1.6GB so make sure your firewall doesn't block this connection.

    This shouldn't delete your data (no guarantees) but you will have to grant app permissions again and reapply any changes to system files e.g. root, viper4android, xposed ect.

    If you have problems try this method instead:
    http://forum.xda-developers.com/g4/general/guide-lg-g4-stock-firmware-to-stock-kdz-t3107848



    7. Debloat

    Here is a list of apps and services an XDA user has suggested removing: https://forum.xda-developers.com/g4/general/bloatware-tool-t3141890/post61509537#post61509537

    Removing these won't break the phone but of course be smart about it; removing Weather will mean you don't have the weather app. I only removed Google apps I don't use and redunadant apps from LG.
    You can remove bloat apps using the Titanium Backup app from here: https://play.google.com/store/apps/details?id=com.keramidas.TitaniumBackup
    I would advice you to make a backup of them first in case you want them back. It's the easiest way to get the apps back.
    If you do need a guide for using Titanium Backup, head over to this excellent guide: http://forum.xda-developers.com/showthread.php?t=2717159



    8. Battery Optimisations


    The aim is to get maximum battery life without compromising speed, user experience, features or notifications.
    (I'm just going to use the following space as a log of things I've done. I will tidy this up when complete. Please do suggest if any of these things are ineffective or detrimental.)
    Read through this guide: http://forum.xda-developers.com/g4/general/guide-g4-lag-free-marshmallow-t3327878
    1. Disable Activity Logs: General Settings -> About phone -> Activity Logs at the bottom.
    Also try following the steps on here; users report better battery life: https://www.reddit.com/r/lgg4/comments/4fb4uf/psa_free_up_some_ram_up_to_300mb_and_maybe_gain_a/
    2. Disable Smart Settings under General Settings
    3. Disable Bluetooth and Wi-Fi scanning location service: General Settings -> Location -> Menu -> Scanning -> Untick both. (I honestly can't believe these exist. I wondered why I have bluetooth wakelocks)
    4. Disable Open Wi-Fi scanning: Network Settings -> Wi-Fi -> Menu -> Advanced -> Untick Wifi notification. Toggle this on and off as it should also fix random white LED blinking.
    5. Greenify 2.9 beta to enable aggressive doze.
    6. Follow this guide for processor tweaks http://forum.xda-developers.com/nexus-5x/general/guide-advanced-interactive-governor-t3269557


    Please note that this is my first thread and I'm not a developer. I hope the instructions are as complete and accurate as possible and they are what I followed for my H815 602. If there are any things I forgot or updates, please do let me know.
    3
    Superb guide. Thanks. Should be stickied.
    3
    I tried but I think I was unsuccessful.. I did first -adb reboot bootloader then -fastboot flash recovery and then -fastboot reboot. when I tried the comand -adb reboot recovery it went to a black screen saying only "no comand". Did I make any mistake?

    I can try the suggestion from @whitewolf1608 with an Oreo version of TWRP, what do you think @ThePiGuy? Thank you a lot for all the help!

    Oreo version will make no difference.

    By the sound of things you are flashing twrp --> rebooting to the os --> then using adb to reboot to recovery. Correct?

    If so, then your LG software is overwriting the custom recovery as it has not been patched.

    So...how to fix it?

    1) reboot to bootloader and flash twrp as before
    2) Get your fingers on the power and volume down buttons ;)
    3) Type fastboot reboot. When you press enter (initiating the reboot), press and hold the power and volume down buttons.
    4) When the device shows the lg logo, release ONLY the power button and then immediately press it back down again
    5) Keep holding until it asks if you would like to factory reset. (make sure you have a backup in case this goes wrong but if you have done this properly it shouldn't actually factory reset)
    6) Select yes twice. It should now boot into twrp
    7) Allow system modifications - this patches your os so twrp will not be wiped
    8) Enjoy :)
    3
    I seam to allways get stuck on "< waiting for any device >" after running the "fastboot oem device-id" command.
    I have installed the LG drivers linked in the original post. I also tried the latest drivers from LGs support page.
    I'm using a usb 2.0 port and an original usb cable.
    I have tried adb and fastboot through android studio, sdkmanager as well as Minimal adb.

    What else can i try?

    Edit:
    I have H815 model.
    I tried on my laptop too. Same problem there. Both my machines are running up to date Windows 7.
    When the phone is in fastboot mode running "fastboot devices" returns no results. The phone can also only be restarted by pulling the battery. There is an instruction on screen that says to hold the power button for 10 seconds. But that does not work.
    When in fastboot mode Windows device manager lists the devce as "Android" and there are no drivers loaded for it.
    I have tried to factory reset the phone.

    Solution: I downloaded the Google USB Drivers. Then i manually picked the "LGE Mobile Sonner Single ADB Interface" driver for my Android device. When i did that fastboot immediately delivered my Device-id. I have no clue if this really is the correct driver for my device though.
    I'm unsure if this driver might have poped up in the list as a result of me installing "LG Mobile support tool".
    2
    So now their webpage bootlooping lol :D