Bootloader-Relock LG G4 (H815) No Wipe, No Backups, All Versions

MathiasR33

Member
Sep 28, 2017
5
7
0
Relock LG G4 Bootloader easily

First of all, I'm new here. So please tell me if I broke any rules or if I made any english mistakes.

Warning:

This guide will show you how to easily Re-Lock your Bootloader. Your Bootloader is then Locked! So, it's not really clever to lock the Bootloader when a Non-Stock-Rom is installed...

Requirements:

- LG G4 (H815) [This probably works with other LG's too]
- TWRP-Recovery installed or temporary booted using "fastboot boot"
- Stock-Android installed (Any Version)
- Flashable Bootloader/Boot Zip's for your Android-Version

For Android 6.0 you can get them here: https://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503

How to Relock:

Step 1: Boot into TWRP
Step 2: Copy the Zip-Files to internal storage
Step 3: Go to Advanced/Terminal
Step 4: Perform this command:

Code:
dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
Your bootloader is Non-Functional now... Don't reboot until the next steps are completed!

Step 5: Flash both Zip-Files using TWRP
Step 6: Reboot

You now have a G4 with stock ROM and locked bootloader. If you wish to uninstall TWRP (Its no longer working) just Flash a Stock kdz-File using LGUP

Hope I was able to help someone...
 

ghepardus

Member
May 4, 2013
24
12
0
in dd command are 2x //, is the corect command ? or just one / ?

dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
to
dd if=/dev/zero of=/dev/block/bootdevice/by-name/misc


for me misc is /dev/block/mmcblk0p22
 
Last edited:

MathiasR33

Member
Sep 28, 2017
5
7
0
in dd command are 2x //, is the corect command ? or just one / ?

dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
to
dd if=/dev/zero of=/dev/block/bootdevice/by-name/misc


for me misc is /dev/block/mmcblk0p22
The command is correct... If you perform it, it will make the bootloader crash. If you flash a clean bootloader now ur device is locked again.

Mathias
 

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
Relock LG G4 Bootloader easily
I ...
... Thx for your thread even if it is known that the unlock state is handled by misc partition but it's good to have an own thread for it now. Latest TWRP beta can save the unlock state since a while.

Just wanted to add: if you made a misc backup before unlock you can just restore your backup. You can even flash a misc of an extracted kdz.

And another thing: if you zero out it like described you may loose your WiFi Mac and you can loose your imei. So before using this it's better to backup your current unlocked misc e.g. with the latest TWRP beta (select BL unlock state).

Backup before unlock is possible with SALT DLM backup ( https://tinyurl.com/dlbackup )




Sent from my LG-H815 using XDA Labs
 
Last edited:
  • Like
Reactions: nkirk

freno25

Member
Jul 10, 2012
23
0
0
Relock LG G4 Bootloader easily

First of all, I'm new here. So please tell me if I broke any rules or if I made any english mistakes.

Warning:

This guide will show you how to easily Re-Lock your Bootloader. Your Bootloader is then Locked! So, it's not really clever to lock the Bootloader when a Non-Stock-Rom is installed...

Requirements:

- LG G4 (H815) [This probably works with other LG's too]
- TWRP-Recovery installed or temporary booted using "fastboot boot"
- Stock-Android installed (Any Version)
- Flashable Bootloader/Boot Zip's for your Android-Version

For Android 6.0 you can get them here: https://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503

How to Relock:

Step 1: Boot into TWRP
Step 2: Copy the Zip-Files to internal storage
Step 3: Go to Advanced/Terminal
Step 4: Perform this command:

Code:
dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
Your bootloader is Non-Functional now... Don't reboot until the next steps are completed!

Step 5: Flash both Zip-Files using TWRP
Step 6: Reboot

You now have a G4 with stock ROM and locked bootloader. If you wish to uninstall TWRP (Its no longer working) just Flash a Stock kdz-File using LGUP

Hope I was able to help someone...
you said temporary booted using "fastboot boot", which is the method with just fastboot? and second thing the command :

Code:
dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
need any substitution?
 

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
you said temporary booted using "fastboot boot", which is the method with just fastboot? and second thing the command :

Code:
dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
need any substitution?
u can now re-lock your device with fastboot

important: you device must be FULLY STOCK BEFORE you lock it again! That means no TWRP, no custom ROM etc! otherwise you will brick the device

if you still want to use that method mentioned here:

Make a backup with SALT (basic mode is enough)

boot into fastboot:
Code:
[B]fastboot erase misc[/B]
is doing the same then the above mentioned way.
the misc partition contains also your IMEI, your MAC (wifi) and Bluetooth address. Those SHOULD be re-generated once you boot Android again but if not you will have the backup you created with SALT before.

.
 
Last edited:

freno25

Member
Jul 10, 2012
23
0
0
u can now re-lock your device with fastboot

important: you device must be FULLY STOCK BEFORE you lock it again! That means no TWRP, no custom ROM etc! otherwise you will brick the device

if you still want to use that method mentioned here:

Make a backup with SALT (basic mode is enough)

boot into fastboot:
Code:
[B]fastboot erase misc[/B]
is doing the same then the above mentioned way.
the misc partition contains also your IMEI, your MAC (wifi) and Bluetooth address. Those SHOULD be re-generated once you boot Android again but if not you will have the backup you created with SALT before.

.
wow perfect you was very clear, and OMG I didn't saw your projects man, you rock! another and last questions(after the cmd "fastboot erase misc" I should use the cmd mentioned in your first link? so "fastboot oem lock" (because i tried this cmd with fastboot and my phone is recognized I checked with "fastboot devices" but my try failed maybe I miss something? I unlocked bootloader 1 year ago now I want to relock it so I refurbished the stock kdz with lgup and try the cmd but the console said to me FAIL (unknown command remote) somethings like that)? otherwise What I should do? just flash bootloader and boot zips?
EDIT:
What I've done:
-Refurbished with LGUP last version of KDZ STOCK of my country
-Now I have my device STOCK but with bootloader to relock
-I downloaded your os
-I downloaded the zip bootloader and boot of my KDZ from this site
-I made a backup basic with your software SALT (just in case)
-I have just to erase misc part (don't reboot before I haven't done last flash for rebuild misc partition)
-But my last doubt is which cmd I have to do with SALT for reflash the two zip and if this zip containg the misc partition (because inside I did found misc bin or img)
 
Last edited:

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
wow perfect you was very clear, and OMG I didn't saw your projects man, you rock! another and last questions(after the cmd "fastboot erase misc" I should use the cmd mentioned in your first link? so "fastboot oem lock" (because i tried this cmd with fastboot and my phone is recognized I checked with "fastboot devices" but my try failed maybe I miss something? I unlocked bootloader 1 year ago now I want to relock it so I refurbished the stock kdz with lgup and try the cmd but the console said to me FAIL (unknown command remote) somethings like that)? otherwise What I should do? just flash bootloader and boot zips?
EDIT:
What I've done:
-Refurbished with LGUP last version of KDZ STOCK of my country
-Now I have my device STOCK but with bootloader to relock
-I downloaded your os
-I downloaded the zip bootloader and boot of my KDZ from this site
-I made a backup basic with your software SALT (just in case)
-I have just to erase misc part (don't reboot before I haven't done last flash for rebuild misc partition)
-But my last doubt is which cmd I have to do with SALT for reflash the two zip and if this zip containg the misc partition (because inside I did found misc bin or img)
I meant that you can also go the new way which is less risky by flashing the nougat bootloader in my mentioned link. Then you don't need to erase anything.
 

mrbelou

Senior Member
Dec 25, 2008
59
6
0
Hello,
thanks for the tuto.
With this method, will the message on the top left corner "bootloader unlocked" no longer appear?
 

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
how do I restore the backup created with salt? Unfortunately my IMEI & MAC won't restore >.<
manually with fastboot or in TWRP. Both require an unlocked device though.
SALT will allow restore in a future release in download mode too.



Sent from my LG-H815 using XDA Labs
 

Koile

Member
Oct 11, 2009
49
6
0
manually with fastboot or in TWRP. Both require an unlocked device though.
bootloader is unlocked again, but TWRP won't show the bin-files created and fastboot just returns:
Code:
> .\fastboot flash misc E:\salt_backup\misc.bin
target reported max download size of 536870912 bytes
sending 'misc' (16384 KB)...
OKAY [  0.375s]
writing 'misc'...
FAILED (remote: cannot flash this partition in unlocked state)
finished. total time: 0.406s
 

Spaceboy60

Senior Member
Dec 22, 2014
706
82
48
u can now re-lock your device with fastboot

important: you device must be FULLY STOCK BEFORE you lock it again! That means no TWRP, no custom ROM etc! otherwise you will brick the device

if you still want to use that method mentioned here:

Make a backup with SALT (basic mode is enough)

boot into fastboot:
Code:
[B]fastboot erase misc[/B]
is doing the same then the above mentioned way.
the misc partition contains also your IMEI, your MAC (wifi) and Bluetooth address. Those SHOULD be re-generated once you boot Android again but if not you will have the backup you created with SALT before.

.
C:\Windows\system32>fastboot erase misc
erasing 'misc'...
FAILED (remote: cannot erase this partition in unlocked state)
finished. total time: 0.031s
 

steadfasterX

Recognized Developer
Nov 13, 2013
5,593
14,810
263
bootloader is unlocked again, but TWRP won't show the bin-files created and fastboot just returns:
Code:
> .\fastboot flash misc E:\salt_backup\misc.bin
target reported max download size of 536870912 bytes
sending 'misc' (16384 KB)...
OKAY [  0.375s]
writing 'misc'...
FAILED (remote: cannot flash this partition in unlocked state)
finished. total time: 0.406s
in twrp:

Code:
adb push misc.bin /tmp/
adb shell
dd if=/tmp/misc.bin of=/dev/block/bootdevice/by-name/misc
sync
Can I restore a stock image i backed up with with twrp and go from there or will I need to reflash a tot/kdz and reflash twrp first?
really reflashing a kdz is your best option. everything must be stock (no twrp or other mods are in place) so flashing a kdz ensures you are good.

C:\Windows\system32>fastboot erase misc
erasing 'misc'...
FAILED (remote: cannot erase this partition in unlocked state)
finished. total time: 0.031s
that happens when you are on v29a.
on v29a its just a fastboot cmd to lock again: https://forum.xda-developers.com/g4/general/managed-to-relock-bootloader-t3660282
keep in mind that your phone is better pure stock before doing this and it will 100% brick your phone when you have UsU'd your device.

.
 

Spaceboy60

Senior Member
Dec 22, 2014
706
82
48
u can now re-lock your device with fastboot

important: you device must be FULLY STOCK BEFORE you lock it again! That means no TWRP, no custom ROM etc! otherwise you will brick the device

if you still want to use that method mentioned here:

Make a backup with SALT (basic mode is enough)

boot into fastboot:
Code:
[B]fastboot erase misc[/B]
is doing the same then the above mentioned way.
the misc partition contains also your IMEI, your MAC (wifi) and Bluetooth address. Those SHOULD be re-generated once you boot Android again but if not you will have the backup you created with SALT before.

.
in twrp:

Code:
adb push misc.bin /tmp/
adb shell
dd if=/tmp/misc.bin of=/dev/block/bootdevice/by-name/misc
sync

really reflashing a kdz is your best option. everything must be stock (no twrp or other mods are in place) so flashing a kdz ensures you are good.



that happens when you are on v29a.
on v29a its just a fastboot cmd to lock again: https://forum.xda-developers.com/g4/general/managed-to-relock-bootloader-t3660282
keep in mind that your phone is better pure stock before doing this and it will 100% brick your phone when you have UsU'd your device.

.
I'm on marshmallow, not 29a

EDIT:reflashed back to stock, but command fastboot erase misc still comes up with an error about not being able to flash in an unlocked state.
 
Last edited:

whitewolf1608

Senior Member
Nov 15, 2014
196
8
0
32
Relock LG G4 Bootloader easily

First of all, I'm new here. So please tell me if I broke any rules or if I made any english mistakes.

Warning:

This guide will show you how to easily Re-Lock your Bootloader. Your Bootloader is then Locked! So, it's not really clever to lock the Bootloader when a Non-Stock-Rom is installed...

Requirements:

- LG G4 (H815) [This probably works with other LG's too]
- TWRP-Recovery installed or temporary booted using "fastboot boot"
- Stock-Android installed (Any Version)
- Flashable Bootloader/Boot Zip's for your Android-Version

For Android 6.0 you can get them here: https://forum.xda-developers.com/g4/development/stock-h815-20g-images-kdz-flashable-t3450503

How to Relock:

Step 1: Boot into TWRP
Step 2: Copy the Zip-Files to internal storage
Step 3: Go to Advanced/Terminal
Step 4: Perform this command:

Code:
dd if=/dev/zero of=/dev/block//bootdevice/by-name/misc
Your bootloader is Non-Functional now... Don't reboot until the next steps are completed!

Step 5: Flash both Zip-Files using TWRP
Step 6: Reboot

You now have a G4 with stock ROM and locked bootloader. If you wish to uninstall TWRP (Its no longer working) just Flash a Stock kdz-File using LGUP

Hope I was able to help someone...
Hello, dear MathiasR33

I am asking you with a very polite request for technical support. I upgraded after OTA Wi-Fi to the latest version of Android MarshMallow 6.0.
Please help me in the next steps.
The fastboot devices command does not work for me.
I post a screen showing the version of my Firmeware in the LGUP.
And Screen from the CMD console saying that the fastboot devices command does not work.

Please, help me, I am waiting for your answer.
 

Attachments