[ROOT] EU LMV405EBW - Magisk

nnamless

Senior Member
Jan 17, 2018
95
24
8
Thanks for this.
Please can you make a patched boot.img for the last update V405EBW10f_00_OPEN_EU_DS_OP_0307.kdz?
I tryed it but i had no success.
 

daphix

Member
Mar 13, 2009
49
7
0
Thanks for this.
Please can you make a patched boot.img for the last update V405EBW10f_00_OPEN_EU_DS_OP_0307.kdz?
I tryed it but i had no success.
Don't complicate yourself by trying this thread instructions; are full of mistakes, contradictions and the most important fact: instead to deliver a clear procedure for noobs, claim to be adressed to experts, without having real backgound on it;

No one have rooted LG V40 yet;
 
  • Like
Reactions: Einsteindks

Einsteindks

Senior Member
Feb 10, 2011
838
192
0
I'm sort of a passive expert at rooting the few phones I've owned. I've yet to see a procedure, here, for the v40, comparable in clarity and cohesiveness to other root methods. Granted, it would be great to be rooted, but most/many of the reasons I've rooted are covered by features within the stock ROM, or 3rd party apps that don't need root.

Sent from my LM-V405 using Tapatalk
 
  • Like
Reactions: serpent android

nnamless

Senior Member
Jan 17, 2018
95
24
8
Thats not right. I had my U405EBW rooted succesful with this guide, but after the last firmware update root was gone and I can not downgrade the firmware. So i need a new patched boot.img.
 

jtsurfs

Senior Member
Jul 30, 2007
409
34
0
I'm sort of a passive expert at rooting the few phones I've owned. I've yet to see a procedure, here, for the v40, comparable in clarity and cohesiveness to other root methods. Granted, it would be great to be rooted, but most/many of the reasons I've rooted are covered by features within the stock ROM, or 3rd party apps that don't need root.

Sent from my LM-V405 using Tapatalk
Can't load any new security releases with stock rom and 3rd party apps. LG is slow to update security releases. That is 1 LARGE reason to want root.
 

Einsteindks

Senior Member
Feb 10, 2011
838
192
0
Coming from slower-than-molasses Motorola, I've never had a security patch issue because of late/no updates. But, I also had anti-viral apps on the phone as well. As I see it, if you want root, security patches are vital. If not rooted, the patches are still needed, just not as critically.

Sent from my LM-V405 using Tapatalk
 

dwaradzyn

Senior Member
May 12, 2008
223
8
0
I tried to follow the guide in first post for Pie, but looks like kdztools is not able to cope with that ROM yet. I did not have to alter kdztool as described in OP - that code has been changed already in git. undz.py is giving me lots of warnings like this:
Code:
[!] Warning: extraneous data found IN version
[!] Warning: pad is not empty
[!] pad contains: DS
[!] Warning: Chunk is part of "OP_S", but starts in front of slice?!
[!] Warning: Chunk is part of "OP_S", but starts in front of slice?!
[!] Warning: Chunk is part of "xbl_a", but starts in front of slice?!
[!] Warning: Chunk is part of "xbl_config_a", but starts in front of slice?!
[!] Warning: Chunk is part of "BackupGPT", but starts in front of slice?!
[!] Warning: Chunk is part of "xbl_b", but starts in front of slice?!
and it eventually fails with the following error:
Code:
[+] Extracting single slice / partition!

[+] Extracting boot.img_65286 to boot_a.image
Traceback (most recent call last):
  File "../undz.py", line 1069, in <module>
    dztools.main()
  File "../undz.py", line 1065, in main
    self.dz_file.saveHeader(cmd.dzfile)
  File "../undz.py", line 839, in saveHeader
    params.write("factoryversion={:s}\n".format(self.ro_lge_factoryversion.decode("utf8")))
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 128: invalid continuation byte


---------- Post added at 10:16 AM ---------- Previous post was at 09:48 AM ----------

Oh wait, somebody already succeeded in creating patched boot image for Pie! Here is the link to post: https://forum.xda-developers.com/showpost.php?p=79764186&postcount=10
Using patched image linked in that post I was able to root my V40 using instructions in OP. Victory!
 

Ainz_Ooal_Gown

Senior Member
Feb 3, 2013
3,841
1,716
0
26
Los Osos
I tried to follow the guide in first post for Pie, but looks like kdztools is not able to cope with that ROM yet. I did not have to alter kdztool as described in OP - that code has been changed already in git. undz.py is giving me lots of warnings like this:

and it eventually fails with the following error:


---------- Post added at 10:16 AM ---------- Previous post was at 09:48 AM ----------

Oh wait, somebody already succeeded in creating patched boot image for Pie! Here is the link to post: https://forum.xda-developers.com/showpost.php?p=79764186&postcount=10
Using patched image linked in that post I was able to root my V40 using instructions in OP. Victory!
And you can look at my thread under themes for what Magisk Moduels are currently working.
 

DLS123

Senior Member
Aug 20, 2013
77
66
0
Thanks for this.
Please can you make a patched boot.img for the last update V405EBW10f_00_OPEN_EU_DS_OP_0307.kdz?
I tryed it but i had no success.
I'll post the one for 20a which I already have and used but I forgot to upload. I'll try to make it for 10f too.
EDIT: added 10f to 1st post too.
 
Last edited:
  • Like
Reactions: nnamless

DLS123

Senior Member
Aug 20, 2013
77
66
0
Don't complicate yourself by trying this thread instructions; are full of mistakes, contradictions and the most important fact: instead to deliver a clear procedure for noobs, claim to be adressed to experts, without having real backgound on it;

No one have rooted LG V40 yet;
I have not claimed anything, only that I basically pasted the command lines and the tools I used and that I don't have the time to write stuff in a form that everyone can easily understand. Also I'm under no obligation to provide noobs with a one click solution or teach them basic Linux so they can follow the kdz extraction procedure (which isn't really necessary, btw).

Just booting a patched image and installing Magisk should be pretty simple for any noob who's not computer illiterate. Those should probably stay away from rooting the V40 anyway, since making the slightest mistake with Magisk (installing a bad module) will make the phone bootloop. And there's no way to recover it except factory reset given the lack of a TWRP release for the V40 that can work with LG's encryption.
 
Last edited:
  • Like
Reactions: gazzacbr

daphix

Member
Mar 13, 2009
49
7
0
I have not claimed anything, only that I basically pasted the command lines and the tools I used and that I don't have the time to write stuff in a form that everyone can easily understand. Also I'm under no obligation to provide noobs with a one click solution or teach them basic Linux so they can follow the kdz extraction procedure (which isn't really necessary, btw).

Just booting a patched image and installing Magisk should be pretty simple for any noob who's not computer illiterate. Those should probably stay away from rooting the V40 anyway, since making the slightest mistake with Magisk (installing a bad module) will make the phone bootloop. And there's no way to recover it except factory reset given the lack of a TWRP release for the V40 that can work with LG's encryption.
Thank you for all of your instructions, is not complicated;
provided image who work now is the one for Pie:
https://forum.xda-developers.com/showpost.php?p=79764186&postcount=10
 

Baribor

New member
Oct 11, 2017
1
1
0
Shillong
Forgive my lack of knowledge, but any help is appreciated. I have a LM-V405EBW with Android version 9 (Pie), security patch level 1 July 2019. My software version is V20a-IND-xx. Which patched boot image should I use?
 
  • Like
Reactions: Eisen4x4

smartybro7788

Member
Jul 30, 2019
15
6
0
I couldn't find any guide for rooting the V40, so I thought I'd write down the steps I took to root my new EUR V40 - LMV405EBW. Maybe it will help others. Sorry if this is somewhat confusing, I didn't have time to make a polished version. It's basically made from my notes during the process with the commands copied from bash history.

-First, unlock the bootloader following LG's instructions here: https://developer.lge.com/resource/mobile/RetrieveBootloader.dev
There's no TWRP for the V40 and the one made for G7 doesn't work. I don't have the time and knowledge to even attempt to compile TWRP for the V40, so I proceeded with just patching an original boot image with Magisk.
You can get the patched boot images that I used from here:

Oreo 10e: boot_a_magisk_patched_10e.img
Oreo 20f: boot_a_magisk_patched_10f.img
Pie 20a: boot_a_magisk_patched_20a.img
Pie 20b: boot_a_magisk_patched_20b.img

You can try to boot it with with fastboot if you have a LNV405EBW and skip the KDZ extraction part.

Installing Magisk:
Flashing this image isn't necessary, just straight boot should be sufficient and safe.
First install Magisk Manager 7 on the phone then connect the phone to the PC and run:
Code:
adb reboot bootloader
fastboot boot boot_a_magisk_patched_10e.img
After the phone boots the OS with the external boot image, open Magisk Manager and tap on Install. Select the option to Direct install to the active slot. I played it safe and decided to NOT flash also on the inactive slot. I've left it alone so I can use it in case of need of recovery.
You'll probably notice that you don't have a connection to the carrier. Just ignore it, it will back once the phone is booted normally.
Reboot and you will have permanent root until you switch the A/B slots.

In case my patched boot image doesn't work, you can just make your own.

Tools needed:
  • Magisk Manager 7.0.0 installed on the phone
  • LG Bridge installed on a Windows machine.
  • a Linux machine or VM (I used the latest ubuntu desktop), python3 with the zstandard module installed and kdztools from steadfasterX's repo. Maybe kdztools would work on Windows too, I haven't tried it.
  • adb, fastboot

You need to procure an original ROM file for your phone model. It can be downloaded easily with LG Bridge. Just connect the phone to a Windows PC, start LG bridge, go to the Software update tab and click on Update error recovery. Wait for the download to start and disconnect the phone. Ignore LG Bridge complains about not being able to flash after the downloading stage is completed. Don't click anything in Bridge and before closing it go to C:\Users\<your_username>\AppData\Local\LG Electronics\LG Bridge\SWUpgrade and copy your KDZ somewhere else. Preferably send it to the Linux VM to the LG work folder, it'll be needed there.

On Linux open a terminal:
Code:
cd ~/Documents
mkdir LG
cd LG
git clone https://github.com/steadfasterX/kdztools.git
cd kdztools
nano undz.py -c
For kdztools to be able to extract the V40 images, I needed to edit undz.py and comment the lines 88-90. So, this block should all be commented or undz will fail to extract the boot partitions.
Code:
                #if len(dz_item['pad']) != 0:
                #        print("[!] Error: pad is not empty", file=sys.stderr)
                #        sys.exit(1)
To extract, with the KDZ copied to ~/Documents/LG/
Code:
cd ~/Documents/LG/kdztools
./unkdz.py -f ../V405EBW10e_00_OPEN_EU_DS_OP_0109.kdz -x
cd kdzextracted/
List the partitions contents and look for the IDs of boot_a and/or boot_b. In my case they were 44 for boot_a and 63 for boot_b
Code:
../undz.py -f V40510e_00.dz -l
Extract boot_a or boot_b or both, they're identical:
Code:
../undz.py -f V40510e_00.dz -s 44
../undz.py -f V40510e_00.dz -s 63
You can find the extracted boot images in the dzextracted subfolder. Get boot_a.image or boot_b.image or both from there and send them to the phone in a location accessible by Magisk Manager. The Download folder should do fine.
Open Magisk Manager and tap Install, select Patch Boot Image file and patch the image file(s) you extracted. Get the patched_boot.img that Magisk Manager saves in the Download folder and send it to a PC where you have adb and fastboot.

Go to the beginning of the post to the Installing Magisk section.
Can you please provide us with original boot.img of Pie 20a version.
It will be helpful in restoring boot image while getting future update.
It will immensely save data as well as time.

The peoples like you make the XDA what it is today.
Thanks :)

---------- Post added at 03:35 PM ---------- Previous post was at 03:33 PM ----------

Forgive my lack of knowledge, but any help is appreciated. I have a LM-V405EBW with Android version 9 (Pie), security patch level 1 July 2019. My software version is V20a-IND-xx. Which patched boot image should I use?
Pie 20a : https://drive.google.com/open?id=1iJmZV4-t6rBCMve29cqP0wWoWk4gCYB3 <-- this one
 
Last edited:
  • Like
Reactions: drfranz and Baribor

tpetris

Member
Jun 12, 2020
6
1
0
vo_config.xml

Hi all, i have the following situation:

- I've unlocked an LG V40 EBW with LG unlock;
- Extracted boot_a, boot_b image from latest kdz ( 20f) in a Linux VM
- Installed Magisk Manager, patched boot_a with Magisk Manager
- Booted in ADB from magisk_patched.img
- Installed magisk_patched.img in Magisk Manager on slot 1

I have obtained permanent root on the stock rom.

I'm trying to edit vo_config.xml from /oem/OP/OPEN_EN_DS/config for VoWiFi/VoLTE.
It seems this is mounted on /dev/block/dm-0.

Even if i can write to the file, change permissions etc. , the changes are reset after a reboot.

I have already HEX edited magisk_patched.img "judypn androidboot.product.lge.op_verity=0" and flashed it in ADB and it didn't solve my problem.

How could this be done? I'm on Android 9, stock rom ( 20f)

Help would be appreciated.

I can confirm this method still works, but can't edit the vo_config.xml to stick.

P.S.
For the banking apps, once you edit the files, you can relock the phone and i guess it would be fine.
 
  • Like
Reactions: basmeuter

3c

Senior Member
Jul 19, 2005
2,727
1,854
193
www.3c71.com
I downloaded firmware V405EBW20g_00_OPEN_EU_DS_OP_0520, which is Pie 20g, but I'm unable to extract the .dz file as per OP instructions. Also tried a Windows app, didn't work either.

All I get is this error:
python ..\kdztools-master\undz.py -f .\kdzextracted\V40520g_00_OPEN_EU_DS_0520.dz -l
[!] Error: extraneous data found IN version

I'm on Windows if it matters, or is it that newer kdz/dz files are not compatible?

Anyone managed to extract the pie 20g boot image?

---------- Post added at 03:01 PM ---------- Previous post was at 02:52 PM ----------

Hello , one question ... If I do Root , Could I pay with NFC or i will lost NFC payment?? Thanks
FWIW, on a S10+, I enabled Magisk hide and select *all* apps (400+ took quite some time), rebooted and then configured my G account, pay etc. It was working fine for a few months.
There's trick about modifying a DB content and I applied it (sorry can't remember the post).

Then came an update (store or pay, can't tell) and it stopped working complaining device was insecure or something similar. I just gave up as I have a watch that works for payment.

So, short answer is you'll likely loose ability to pay with NFC.

---------- Post added at 03:04 PM ---------- Previous post was at 03:01 PM ----------

Hi all, i have the following situation:

- I've unlocked an LG V40 EBW with LG unlock;
- Extracted boot_a, boot_b image from latest kdz ( 20f) in a Linux VM
- Installed Magisk Manager, patched boot_a with Magisk Manager
- Booted in ADB from magisk_patched.img
- Installed magisk_patched.img in Magisk Manager on slot 1

I have obtained permanent root on the stock rom.

I'm trying to edit vo_config.xml from /oem/OP/OPEN_EN_DS/config for VoWiFi/VoLTE.
It seems this is mounted on /dev/block/dm-0.

Even if i can write to the file, change permissions etc. , the changes are reset after a reboot.

I have already HEX edited magisk_patched.img "judypn androidboot.product.lge.op_verity=0" and flashed it in ADB and it didn't solve my problem.

How could this be done? I'm on Android 9, stock rom ( 20f)

Help would be appreciated.

I can confirm this method still works, but can't edit the vo_config.xml to stick.

P.S.
For the banking apps, once you edit the files, you can relock the phone and i guess it would be fine.
Would that modification allows for using Google Pay while rooted?

Wondering if we can edit /oem/ path content using a magisk module, or is magisk only capable of modifying /system content? Or is it /system/oem/... ?

What about creating a script that would run on boot and make the modification of yours?
 

tpetris

Member
Jun 12, 2020
6
1
0
Hey,

i have managed to extract pie 20g version, in a Linux virtual machine, had some setback but I've managed.
 
Last edited: