yashsingh1/xdaforums huggingface dataset:
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Possible Bugs?

First off, thanks for this TWRP for my new phone.

I want to first answer my own question above and report this as a bug, I guess... I am not able to trigger the running of my open recovery script for doing a backup automatically when I have placed it into /cache/recovery. When I reboot into recovery mode, I just see the normal TWRP interface and nothing else happens. When I go into the file manager within TWRP and navigate to /cache, I do not see the recovery folder or the script file I have put into it. However, when I return to the normal system, both are there. This makes me wonder if I must place the files somewhere else? But I have no idea where. Any suggestions?

I also note that when I choose to copy logs to sdcard it says it has copied to /data/media. But when I reboot to system there is nothing in there to see. Where are the files to be found?

One other little think I have noted: in settings, when I tick reverse navbar, this does in fact happen. However, this setting does not seem to stick between invocations of TWRP. Other settings, such as time zone and using md5 instead of sha2 for digests seem to stick. Is this by design? My earlier phones did not have navbars but physical buttons.

Thanks for any tips/suggestions. Cheers

PS - found problems with backup as well. Posted these on the github site for this project. Thanks!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] KouaV1:
You can also contact the devs of these op as they respond to emails as well
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] SGCMarkus:
On A/B devices /cache is a link to /data/cache, its not its own seperate partition anymore.

Also according to the logs, it seems youre encrypted, which explains why you cant access anything in /data (and TWRP cant deal with that)

And vendor and vendor image and system and system image backups are redundant. System/vendor backups copy the actual files and compress them, while the image backups are plain dumps of the partition.

And yeah, i know that sometimes theres this "nice" red error that says "Device or resource busy (/system_root)", just reboot recovery there...
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Oh, I see how to decrypt in your first post (and I also see the points about redundant partitions. Sorry I did not catch this. So it appears I must wipe data and start anew (again). Thanks

Hello and thanks for this TWRP and your help.

I am not sure that I really am encrypted. I certainly did not turn that on myself. And I use only a swipe lockscreen, never had anything else. And when I check under security settings->encryption -> credentials -> encryption, encrypt SD card shows it is not yet encrypted. But I am assuming that you are talking about internal storage and I have no view into that. Can you tell me how to know if I am encrypted and how to decrypt? So far, google hasn't helped.

So I should put my openrecoveryscript into /data/cache/recovery? If so, that's easy enough. Cheers
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] kodein:
I would also like to know how to get into twrp from the switched off phone .... I haven't figured it out yet ...
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] SGCMarkus:
Internal storage is forceencrypt (be it FDE or FBE) since i think Lollipop when the device is released with the play store.

Just external isnt by default (no other device would then be able to read it).

Thats why theres a guide by xsavi to get to encryptable

In power off state:

Hold vol- and power

V40 splash appears

release power, and immediatly hold again

factory reset menu appears

confirm twice

TWRP boots
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
I would never have figured that out! I have put together a document of how to enter/exit all these modes from your info here and from elsewhere.

Can you possibly tell me when in this process I need to perform the guide by xsavi to get to rid of encryption? Following his guide, I have booted into TWRP but cannot select vendor to mount it. Everything except system and vendor (and USB-OTG because there is not attached) will let me check them. But not vendor.

Do I have to go all the way back and re-install TWRP and to this before I do ANYTHING else? Do I have to do this while I am still in TWRP loaded from the image on my PC? Thanks
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Well I must be doing something wrong. I have performed this guide and xsavi's multiple times and I still seem to end up in an encrypted state - as indicated by a basically empty /data in the TWRP file manager and backup for /data shows 0 MB - after completing things and doing a basic Android setup. I have no idea what it is I am not doing correctly. Any tips/hints?

Thanks again
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
[MENTION=3475147]SGCMarkus[/MENTION] is there full exfat support in this version?

Edit: Nevermind, it seems to be working. Thanks so much for this!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] SGCMarkus:
so it loads a modified vendor, disable vbmeta

mount vendor

edit the fstab from forceencrypt to encryptable

format data (confirm with yes)
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Thanks for your help. Sadly, I have little idea what you are saying.

What is loading modified vendor?

How disable vbmeta?

Mount vendor using checkbox in TWRP? In all previous attempts, tapping the checkbox for this did nothing but vibrate.

Edit the fstab.judypn on my PC before adb push? If so, the only references in that file currently to "encrypt" are these (I see no forceencrypt):

/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noatime,noauto_da_alloc,errors=continue wait,check,formattable,encryptable=/dev/block/bootdevice/by-name/encrypt,quota,reservedsize=128M

and

/dev/block/bootdevice/by-name/userdata /data ext4 nosuid,nodev,barrier=1,noatime,noauto_da_alloc,errors=continue wait,check,formattable,encryptable=/dev/block/bootdevice/by-name/encrypt,quota,reservedsize=128M

/devices/platform/soc/8804000.sdhci/mmc_host* auto auto nosuid,nodev wait,encryptable=footer,voldmanaged=external_SD:auto

And at what point in the process I am doing these things?

I apologize for all the newbie questions. But this is all quite confusing to me. Thanks!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] SGCMarkus:
Step 1: reboot to bootloader

fastboot --disable-verity --disable-verification flash vbmeta_a vbmeta.img (and for b)

boot to twrp

mount vendor (yes, by ticking that)

edit the fstab in vendor/etc/fstab.judypn (if its already encryptable, then its good to go)

format data (if not done already, with the new bootable TWRP version (the old one has a few issues there), preferable injected to you boot images if you want that)

boot system
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Thanks so much for the details and help. I think I understand. But from where do I get vbmeta.img? Before I started the bootloader unlock process, I used QFIL to backup all my partitions (except userdata). As a result, I have two files which MIGHT be right for this job. They were both in LUN#4 - vbmeta_a.bin and vbmeta_a.bin. I am not if/how they might differ. But their sizes are identical. Should I use one of these (and the a on slot a/b on slot b)?

Again, sorry for all the newbie questions.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
I ran into similar issue not being able to mount vendor, etc... I have fastboot in laf_a and I had already injected TWRP into boot a and b per the instructions. So I basically started over from (almost) scratch...

1. In TWRP set active slot to b then shutdown

2. Hold Vol+ and plug in usb cable to get into download mode on slot b

3. Use LGUP to flash via Partition DL the kdz you want to use. (Mine is V405QA720e)

***Check all then uncheck laf_a to keep fastboot, also boot_a and boot_b to keep TWRP

4. My phone rebooted to TWRP, you may have to force that with hardware keys or whatever.

5. Once in TWRP I followed the last half of Markus' installation instructions (step 5 on) just because. Maybe not necessary.

6. After reboot to recovery I could mount all partitions so I followed Xsavi's instructions.

7. Reboot to recovery and do a full backup minus the redundant image partitions.

Now I can mount all partitions and seem to have no problems. Going to set up Android now...
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Thanks for your help. I tried to do this and not sure how but now I am pretty messed up. I can no longer get into the bootloader/fastboot. Somehow, I lost TWRP. So I have no idea what slot am I on. I can get into Android and go into dev settings. But before it showed OEM Unlock with a blue button locked into the ON position, now it is OFF and below it reads "Bootloader is already unlocked". Never seen that before. So I now really don't know what to do. Yikes!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] smariob:
Wops. Not meant to post un this thread. Apologies
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Sounds like you are still bootloader unlocked. I'd guess after a few reboots the dev settings would look like you expect. When you reboot do you get the screen with the orange triangle saying your device can't be checked for corruption?

What happens when you power off then hold vol+ and plug in the usb cable? Do you get download mode or fastboot?

You are probably on slot a, but we need to know if you have fastboot or download mode when you power off, hold vol+ and plug in the usb cable.

I assume you say you lost twrp because when you do the hardware key combo you don't get into twrp. Does it do a true factory reset when you do that key combo?
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Hello and thanks again.

I definitely do see the unlocked bootloader warning. But you can see he developer settings page with OEM unlock in one of the attached photos. It is now in the off position and entirely grayed-out - although it does read "bootloader is already unlocked". Until now, this was a blue switch in the on position but tapping it did nothing. So something has definitely changed.

I cannot get into fastboot/bootloader at all. I have tried Volume Down while inserting the USB cable (this always worked in the past) as well as adb reboot bootloader (which also worked in the past). Doing either of these causes what looks to be a brief series of boot loops ultimately yielding "normal" Android.

I cannot get into any form of recognizable recovery. You can see the "no command" in the other photo. This happens with both hardware buttons and adb reboot recovery.

I definitely CAN get into download mode using the Volume Up and plugging in USB.

I have tried about a dozen times to get into Engineering Mode without success - always ending up with a "normal" Android start. This has always been finicky so I don't know if this is "permanently" gone or if I am just screwing up trying to get into it. I will continue to try.

Edit: Just managed to reach engineering mode. I do have backups of all partitions taken with QFIL before I started the unlocking process. Not sure how/if that helps. Or if there is a way in this mode to see what slot is current and/or to change the current slot.

Any suggestions are greatly appreciated. Cheers
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Yeah, you are definitely still bootloader unlocked, so thats good. Don't worry about what the dev settings look like right now. Go to this guide:

https://xdaforums.com/lg-v40/development/unlock-lg-v40-via-9008-root-t-mobile-t4042207

Flash the V35 bootloader, skip the frp/unlock stuff, nuke laf_a to get fastboot back and you should be back on track to reinstall TWRP. Restore your abl_a if you're on pie. I have stock laf_b on my phone so if I want download mode I switch to slot b and can get it there. So its up to you if you want/need to nuke both laf partitions or not.

Edit: It might not hurt to flash a full kdz or restore stock partitions first so you are starting fresh.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Thanks once again. It seems from the thread (which is what I used to unlock in the 1st place) that if I nuke the laf_a I will get back fastboot but somehow loose access to download mode. It that right? Going to re-flash the 20E .kdz once again since I still have download mode. Cheers
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
If you nuke laf_a you will loose dl mode on slot a, but gain fastboot. Same on slot b.

What I currently have is a "broken" laf_a and a stock laf_b. So I have fastboot in slot a and download mode in slot b. I can switch slots via fastboot or TWRP. I also have TWRP in both a and b. I generally stay in slot a, but yesterday I wanted to use lgup, so I booted to recovery, switched slots, powered down, then used vol+ and usb to boot to download mode. Once I was done with the flash, I switched back to slot a in TWRP to get Data access. Of course when I flashed the kdz I unchecked laf_a, boot_a, and boot_b. Thats how I kept TWRP and fastboot after the kdz flash.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Ok, flashed the full .kdz using LGUP in download mode. Makes not difference (did not really expect it to).

I thought the current slot was B because that was the last thing I did in TWRP before things went haywire. Because I was thinking it was B, I flashed the V35 bootloader there first. When rebooting and trying to enter the V35 bootloader I just ended up in Android. So I flashed abl_b with stock and abl_a with V35. That got me into V35 fastboot. Once there I:

1. Used fastboot getvar all and confirmed that I was indeed on slot a.

2. Used fastboot erase laf_a in an effort to get back fastboot on slot a.

3. Used fastboot flash abl_a stock pie image.

I tried pressing both power and volume down and then releasing power to try and get into stock fastboot on slot a. This yielded nothing but a bootloop of some sort.

I tried just booting Android with just the power button and that worked.

I tried pressing volume up and inserting the USB. I briefly saw "download" but it ended up in fastboot. It does look different than fastboot looked before. Before where there was large, colored font on type indicating if pressing power would restart or power off. Now I only see a green, dashed line. until I actually push vol up/down. I think I saw something mentioning this somewhere a while back. Also, fastboot getvar all now produces a mode complete output as it did earlier. And it still shows I am in slot a.

So on to trying to get TWRP. Doing fastboot boot twrp.img briefly shows "download" but ultimately gets me to TWRP. I cancel password and accept system mods. Then finished the TWRP install without bothering on the procedure to defeat encryption (which is very important to me but not yet achieved despite lots of attempts). Finally booted into normal Android. Finally, rebooted to TWRP using hardware keys and that seemed to work like before. So then flashed Magisk (but not tested it yet as I have not completed Android setup).

So then to see if I could indeed get download mode in slot b I returned to TWRP, in the Reboot I changed to slot B and powered off. This started some form of bootloop but by holding power up and inserting USB I seem to have managed download mode and LGUP "sees" the device. So I again managed to enter TWRP via hardware buttons, changed back to slot a, and rebooted into Android. After minimal Android setup, I see no Magisk and the Dev Options OEM unlock are unchanged from the photo attached earlier.

So thanks to your help, I am ALMOST back to where I was when the poop hit the fan. Whew! and thanks.

If you have any suggestions on how to get things back to where they originally were (1) with fastboot AND download mode available in both slots and (b) with the OEM unlock switch looking as they did that would be appreciated. I could live without as you seem to be doing. But I have to achieve non-encrypted /data for sure.

Cheers and thanks again for everyone's patience with me as I churn through all this.

Edit: no have managed Magisk again. I ended up formatting /data before trying to flash Magisk. Cheers
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Sounds to me like everything is working as it should. You cannot have both fastboot and download mode on the same slot. You are "nuking" download mode to have fastboot. The best you can do to have both is fastboot in one slot and download mode in another, which is what you have. Vol+ and usb is the way to get to dl mode once switched to slot b, and its how you get to fastboot in slot a. Use the Magisk app or hardware keys for recovery. In slot a you've "replaced" dl mode with fastboot, so keep that in mind if you ever try to use some type of "reboot bootloader" command, it won't work because your fastboot is where dl mode is supposed to be.

When you are in TWRP if you go to the Mount screen and can click on vendor and system you are good to go.

Now just follow Xsavi's guide to get data. Make sure your .magisk file has the . because if you are using windows, it tends to want to change it to just magisk. I think I browsed the zip file with 7zip and just dragged and dropped it, or maybe 7zip extracted it properly. I don't remember for sure.

Anyways, follow that guide closely. I put the fstab and .magisk files in the same folder as adb to make flashing easier. No /path/to to worry about. You'll be reflashing Magisk at the end of that guide anyways...

If you have success with getting data access then just go ahead and do your Android setup. Eventually the dev options will look like you want them to. Mine were greyed out for the first day or so, but now look normal. It was the same with the V30. It just takes time and/or some reboots and it'll be ok.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Thanks for all the time and help. I am sure I can live with the either/or fastboot/download situation as I have now and as you describe. It is just odd that for the first few days after I waded into this pool I really did have BOTH fastboot and download mode in the same slot. Oh well.

I have tried and tried again to defeat the encryption following the guide.

In no case, from any slot or in any condition, does tapping the vendor under TWRP mount turn on its checkbox. All I get is a vibration. I do not again and again that I see red messages about vendor saying it is busy. Even without mounting vendor, it seems I can push the fstab file into the vendor folder as I can see the new file called etc in there using the TWRP file manager just after the push.

I note that after I do the format of data in TWRP and push the .magisk (and yes the . is there) in the TWRP file manager I can actually see something in /data - including the .magisk file. But after installing magisk and rebooting first to system (and doing nothing but power off at the Android start page) and then back into TWRP, the only thing in /data is cache and backup shows a zero size for data.

I don't know what I am doing wrong. After several falst-starts, it was suggested that I do the encryption steps from within the TWRP that I entered from fastboot (and before I did any reboot at all - even back into recovery). Same result. Hmmm.

I saw one reference to using Magisk 20.3 somewhere and I have been using 20.4 so I wonder if that makes any difference? I cannot quite recall where I got this Magisk download but am pretty sure I got it here <https://github.com/topjohnwu/Magisk>.

I can keep trying but they say that one definition of insanity is doing the same thing over and over again expecting a different result :)

Cheers and thanks!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
That definition doesn't apply in the IT world, lol. I used 20.3, so maybe its worth trying.

At this point you can easily start from (almost) scratch as far as getting data. Since you have all the hard stuff done and every mode you need available. Now that you are where I was yesterday, try what I did even though it may seem a little redundant: Switch to slot b, go into download mode, flash a kdz with partition dl (uncheck laf_a, boot_a, and boot_b). You will still have fastboot in a, dl mode in b, and TWRP in both. It automatically rebooted to TWRP, I switched to slot a and installed recovery ramdisk again (just because). Rebooted to recovery, went to mount and verified I could mount vendor and system. Then proceeded with Xsavis guide with Magisk 20.3. I never let it boot to Android at any point before I was done with Xsavi's guide and at that point I did a full Android setup and then a TWRP backup. I just went to recovery and confirmed I can still mount vendor and system.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] kodein:
Hello. I need some advice. After installing magisk or restoring a backup, twrp throws an error every time: failed to unmount '/ system root' (device or resource busy) ...

Please someone would not help me by stimto problem?

And also my settings / phone info / hardware information disappeared SN
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
Can someone help me out here? I unlocked the bootloader via the 9008 method. I am on stock Oreo (more on that in a bit). When I try the fastboot boot <TWRP.img> command, I get a message about being unable to check for corruption ans asking me to-lock the bootloader. If I ignore the message, the phone reboots, shows the message again, and then I get a Kernel crash (barely readable as the phone is dim).

Adding insult to injury, for some reason, I cannot do an OTA as it never seems to find an update, and as such I am stuck on Oreo! Also, I did nuke laf_a, and laf_b, and I did try manually flashing via fastboot flash recovery <TWRP.img> but I get a message about recovery_a partition doesn't exist. What the heck? Can someone please help? I want TWRP so I can unlock this badboy and root and try different ROMS! THanks!

PS: i also verified the active slot is A. I tried fastboot flash boot_a twrp.img, and when I try to reboot recovery, i get the same kernel crash problem.

Any ideas?
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
See post #85 from the OP... in fact you should read pretty much all the posts.

---------- Post added at 14:52 ---------- Previous post was at 14:39 ----------

First of all never attempt an OTA on a modded phone... smh! The warning about corruption is normal when you unlock the bootloader. Restore your laf partitions from your original backups so you have download mode. Upgrade to pie with lgup and a kdz using partition dl. Then go back to the 9008 thread and do everything except unlock the bootloader (its already unlocked) Then come back here and read the instructions in the OP. You don't flash TWRP to recovery, there is no recovery partition. The instructions tell you how to install it and where it gets installed to. I would also recommend reading all the related threads all the way through so that you understand what you are doing and not just purely following instructions. If this is your first A/B phone then a lot has changed that you should understand before you try different ROMs or you'll have a lot of headaches.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
I think you misunderstood what I said. The phone, even BEFORE any modding of any kind, never recevied any OTA updates and seems stuck on Ore.

Now the phone is in a worse state. Booting the system OR recovery results in a kernel crash (enter sahara mode) in very dim text. Unfortunately I have not backed up laf_a or laf_b and the only thing that's working is fastboot / bootloader. Any ideas on how to get this back into working order, with TWRP installed if at all possible?

Note: I scoured the net and XDA and couldnt find a SINGLE kdz file fot the At&T V40 Thinq!

Thank you