yashsingh1/xdaforums huggingface dataset:
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Yeah I did misunderstand. The way you wrote it implied you were trying to ota after unlocking the bl. I don't use AT&T but I'm pretty sure they don't release kdz. You might want to look into crossflashing to the US unlocked. I can't right now but maybe later I can post up a backup of a laf partition from us unlocked pie. Not sure if it will work on your AT&T oreo system. You may need to ask around and find one from somebody that backed up their system.... Or go return your phone to AT&T and then make a backup before you mess with it.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
Thanx for the response. Returning to AT&T is not an option since I bought the phone used, and I don't want to do business with those crooks anyways ;)

Right now I made the mistake of flashing the "pie" bootloader (to see f it solved the kernel crash issue, it didn't). Now I don't have EDL so i can't re-flash the v35 bootloader. DAMN!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Awesome. Sorry I wasn't clear about just checking and unchecking vendor/system to make sure they were mountable... Another thing to keep in mind is that weird things (like the /system_root busy error) can be resolved by just rebooting to recovery... but anyways enjoy the phone. Glad its working now.

---------- Post added at 16:13 ---------- Previous post was at 16:10 ----------

Surprised that flashing the wrong bootloader could kill 9008 mode... maybe keep trying?

What do you have? You nuked your lafs, so do you still have fastboot? Things can be flashed with fastboot.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
Right now what I have is working v35 bootloader and fastboot command prompt. Nothing else. I can't boot into system (LGE Kernel crash), and booting recovery either b using fastboot boot <twrp.img> or by flashing twrp into first will also result in an LDE kernel crash. I have no idea how to recover from this.

I tried to extract the contents of the lineageos 17 payload.bin and doing a fastboot flash system <system.img> and I go a "invalid sparse file format at header magi"
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Sorry man, sounds like you need to find someone that backed up the partitions from their AT&T V40 Oreo and can share them with you. Then hope that you can restore the needed partitions via fastboot. You should be able to restore laf_b (I wouldn't restore laf_a just yet to keep fastboot). Set active slot to b, get into download mode and crossflash the US Unlocked kdz. I'd need to read up on crossflashing the V40 first, but pretty sure thats the way I'd go.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
Thank you. Unfortunately I don't know of a way to get laf_a or laf_b restored since this particular device is very lackluster in terms of software support. Furthermore, no KDZ's for AT&T seem to exist ANYWHERE on the net or xda. I am not sure how practical or do-able cross flash is anyways :( Thank you for all the help. If you think of anything else, please do let me know!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] xaxxelous:
Search the forums or create a thread asking for help. Most people that tinker with their phones do a backup first so somebody has a backup of what you need. You just need to find that person. AT&T doesn't release kdzs, thats why people do backups and you'll never find an AT&T kdz... Also why you need to crossflash. It is possible:

https://xdaforums.com/lg-v40/help/cross-flashing-lg-v40-att-to-korea-ver-t4023293

He wants to crossflash to Korean firmware but he gets a response saying that it's possible to crossflash US Unlocked and European. The instructions are for the european, but just use a US kdz. Do a search and you'll easily find threads about crossflashing sprint to us unlocked. Its all the same principle (except t-mobile). Don't give up so easily.... or do give up and send the brick to me ;)
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
Thanks for the ideas. Unfortunately since I dont have download mode (laf_a and laf_b partitions had been nuked) I can't even cross-flash. My hope is to get an Oreo-based TWRP image, boot it, then flash LineageOS 17.1. Unfortunately this particular device is not officially supported by TeamWin, and the build by SGMarkus is Pie-based :(
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] KouaV1:
OP did not explain clearly about the side effects of nuking laf except for showing to make a backup and restore but no warnings. As I messed up my first LG V40 by nuking it and restoring laf_a resulted in phone in black screen but you can see display on.

To be safe never never nuke your laf or anything and always make a backup so someone can help you
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
If I am reading this correctly, you managed to restore your laf_a ? If so, how? Is your device a V40, or a V40 "Thinq"? Is it a US variant? Do you mind sharing your backed up partition(s)?

yes I know lots of questions but I need this phone back up and running.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] kodein:
In twrp cannot mount partition vendor and system .... Does not format data and restart...
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] Ainz_Ooal_Gown:
With V35 bootloader you can restore anything...as long as you have a backup of said partition...you can even restore with dd commands from PC as long as your phone is booted in TWRP....
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] shassouneh:
Thanx, but TWRP is what started this mess. I can't boot into TWRP at all. Only the V35 bootloader
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] rjcarter3:
I tried to follow these instructions, but I got stuck on step 3 if anyone can help.

I'm bootloader unlocked but otherwise stock everything - stock recoveries and US unlocked 20e firmware. If I run adb reboot bootloader, it just keeps booting back into Pie. The other workarounds mentioned didn't work either. It seems that I can force booting into the stock bootloader by holding power and volume down while powering up, but when I plug up to USB I still don't have access to fastboot in order to flash TWRP.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
What happens with hold volume up while inserting USB?
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] rjcarter3:
holding vol+ while inserting USB -> download mode

holding vol- while inserting USB -> charging screen

holding vol- and power (no USB) -> stock recovery (selecting "reboot to bootloader" option boots back to PIE)

holding vol+ and power (no USB) -> boots PIE
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
When I got into something like this condition, I followed the suggestion here <https://xdaforums.com/showpost.php?p=82203003&postcount=102>. The key to getting fastboot back was to nuke laf_a.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] Redacted Kaos:
Any other LM - V405 user use the 9008 method to unlock bootloader
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] banesi:
How's everyone here mounting /system or /vendor as rw, it keeps saying resource or device busy?
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
I was only able to mount properly after jumping through hoops. See here <https://xdaforums.com/showpost.php?p=82206107&postcount=115>. I did this to defeat encryption. I have not otherwise been able to mount/modify vendor (although I'd like to). Seems related to dm_verity (or something like that, I have been told).
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] banesi:
yes I see, a complete horror story as this phone itself :eek:

I'm on 20f fw, all stock, using twrp only temporary when needed with fastboot boot twrp.img

on 20e I was able to mount /vendor but never /system

I have disabled verity and have no idea what else to try and I don't want to format storage and start all over again
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
I am not convinced (yet) that the phone is itself a horror show. It has not been easy for me. And I am very picky - want things my way. And I am new to Magisk (versus SuperSu). So I am no expert.

But once I managed to get unlocked bootloader, TWRP, defeated encryption, Magisk, and EdXposed I have managed to bend this mostly to my will. And I have not suffered crashes, etc. It has remained stable, smooth, and quite fast compared to my old Note 3.

I would appreciate knowing how you got vendor, disable verity, etc. Thanks
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] willow_:
question

does this work on the v40 thin q? LM-v405UA
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] ctl999999:
Just wondering if there any proper way to update the phone firmware without losing the old data/root/trwp after installing this ?

I tried to update by flashing kdz with partition DL option ( deselect boot_a,boot_b,user_data), but still losing all the data after that....
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] banesi:
I updated from 20e to 20f using LGUP v1.14 and Upgrade option.

You loose root and twrp but I don't need that at the moment.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] zfk110:
I followed this guide here

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

deto to step 4a. Reboot right back into fastboot (hold volume down after rebooting) and run: fastboot oem unlock

I didn't nuke my lafs

Then I tried to fastboot boot TWRP-judypn-boot.img while still in fast boot.

It bootup the phone and then it will stuck into LG logo screen, nothing else happens, I have to force restart the phone.

When I try to go back to fastboot it's not there anymore, I can only go into download mode. Still, no sign of TWRP. I got ATT convert into V405QA720e_01_NAO_US_OP_1230

Read more at: https://lg-firmwares.com/downloads-file/21672/V405QA720e_01_NAO_US_OP_1230 running with Pie.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] NGOwner:
This may be worth a try.

Boot the phone into download mode, and load up the US Pie KDZ again. Get through enough of the bare bones setup of Pie to get to developer options and enable OEM unlock and ADB/USB debugging.

Since you have enabled OEM unlock, you do not need to flash the frp file. Skip that step.

The other thing to keep in mind is that once you flash the ablpiestock.img, you lose fastboot (that's my recollection, which isn't perfect, just so you know). If you want fastboot back, you either have to nuke the laf partitions, or reload the v35 engineering bootloader.

[NG]Owner
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] SGCMarkus:
You tried to boot it with the engineering bootloader?

that wont work, that one is oreo, the kernel in twrp is for pie
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] zfk110:
I did flash the pie, which is step 3 on the guide then I went to fastboot and then tried to boot into TWRP from there.

While you're still in the v35 engineering bootloader flash back the stock pie bootloader (If originally on pie firmware) with:

Code:

fastboot flash abl_a ablpiestock.img
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Not sure about your case. But I found I was not on slot A even though I thought I was.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] zfk110:
So encryption won't go away if I stay with Stock base firmware? Because once I go into TWRP I can't mount system/data only way I can do if I format, but then when I go back after reboot device get encrypted again.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
You CAN defeat the encryption. I have on my 405QA with 20e firmware. You need to deal with it as part of the TWRP install. It was not easy for me but I got help in the thread that is linked from the TWRP thread. After reading in that thread, you can see what I ended up having to do here <https://xdaforums.com/showpost.php?p=82206107&postcount=115>.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] zfk110:
I will this tonight btw what does this do then?

https://xdaforums.com/lg-v40/how-to/guide-twrp-data-access-stock-t3970149
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
No, I have defeated encryption on my 405QA with stock 20e firmware - with root, TWRP installed and working fine. To accomplish this was not easy. You can see a link about how to do this within the first post in this thread under the heading Infos. Please read that and this thread carefully.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
My V40 is performing nightly TWRP backups using OpenRecoveryScript. For the first several weeks I have been doing this, all has been great. Suddenly in the last 2 days, my backup folders/files are being created with really incorrect dates/times - today's and yesterday's are Feb 3, 2018 for example.

As part of my routine that validates the backups, I do a check for these dates - especially that of the recovery.log file. I do not understand why this should have been working but has now started to fail like this.

I know that date/time in TWRP has long been an issue. And I have found some references - especially here and have tried the "fix" of deleting the ats* files in /persist/time which seems to have worked for some. No joy for me in recovery although I do note that Android creates new files there when I reboot. And I note that /persist is not mounted when I enter recovery (although I can mount it manually and, when I do I I see the newly-created files in the time folder).

In the recovery.log I see:

I:PatchLevel:New product: judypn
I:Attempt to load settings from /persist settings file...
I:InfoManager loading from '/persist/.twrps'.
__bionic_open_tzdata: couldn't find any tzdata when looking for PST8PDT,M3.2.0,M11.1.0!
__bionic_open_tzdata: couldn't find any tzdata when looking for posixrules!
I:TWFunc::Set_Brightness: Setting brightness control to 130
I:TWFunc::Fixup_Time: Pre-fix date and time: 2018-02-04--00-32-10
I:TWFunc::Fixup_Time: Setting time offset from file /sys/class/rtc/rtc0/since_epoch
I:TWFunc::Fixup_Time: Date and time corrected: 2018-02-04--00-32-10

This is not what is shown in the "fix" suggested above and tried/failed. So perhaps this is why. In recovery I see there are no files at all in /sys/class/rtc/rtc0 as it is a link. But if I follow it, I do fnd some files. But they contain the date/time data that is wrong. So it is no help. Should these files be updated by the kernel or system? If so, why would they not be?

Are others seeing this? Have you found a work-around? Is there any insight into why this was not an issue initially but seems to be now?

Thanks for your time and help.

PS - I have not found the reason or anything like a true fix. But as a work-around, I have the shell script that creates the OpenRecoveryScript file that is used for running the backup capture the current date/time using

UT=$(toybox date -u '+%m%d%H%M%Y.%S')

and then running the date command inside of recovery before the backup is started using

echo "cmd date -u $UT" >> /data/cache/recovery/openrecoveryscript
echo "backup DB DailyBackup" >> /data/cache/recovery/openrecoveryscript

I can see that the time displayed in TWRP during the backup is now correct (or close enough for my needs). And the dates of the backup files match the expected values.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Please add support for backing up /system in OpenRecoveryScript

First, I really want to thank the dev for doing this and making it possible for me to even consider an LG V40. For the most part, everything I need/want is working well. I have no idea how someone could have done this. It is amazing!

But I do have a stumbling block when it comes to performing backups using OpenRecoveryScript. I am able to backup boot and data by providing "DB" on the ORS backup command. While I have not tried to restore boot, I have restored data and it has been a real life-saver. However, I am not able to backup system by putting an "S' on the backup command. I get the message "unable to locate /system partition for backup calculations". I am not sure if this is related to another message I see right at the top "failed to unmount '/system_root' (device or resource busy)". If I try to explicitly mount /system in the ORS prior to the backup command, it fails "Unable to find partition for path '/system'".

What is strange is that when inside of TWRP and manually performing a backup, I can backup up system (as well as several other partitions not available to ORS's backup command). So I know the capability to do this is in there somewhere. Could it be simply that the code that interprets the ORS backup command should simply backup /system_root instead of /system? Since /system is a subfolder of /system_root, that might be a sensible thing to do.

As I use my device, I am constantly making changes, adding mods, etc trying to bend this device to my will. Many of these changes impact the system partition. Of course, all of this can be dangerous to my device's health and I never know when I will massively screw something up and need to restore. So having regular, fresh backups is really essential to me. And the most solid way for me to accomplish this is to run nightly backups using ORS. As my old saying goes "if something is worth doing, it is worth programming".

So the inability to backup system and restore that backup later is really key. Is there some way to do this using ORS?

Thanks
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
I do see this and am not sure how/if it applies to my phone. But in the comments for twrp-functions.cpp it speaks to oddball handling of the RTC on Qualcomm 800 series devices. The code seems to be working with ats* files in these locations: "/data/system/time/" and "/data/time/". However, I am finding nothing in those locations. I do find some ats* (and other) files at /data/vendor/time. Files ats_1 and ats_2 have dates of May 1, 2020 and this MAY be the point at which this started. But most of them have today's date. There is one file named moved which has the date Jan 3, 2018 and that is suspicious to me given that the dates I am seeing in TWRP have been in Feb, 2018. And they seem to change forward in time (always lagging behind significantly).
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] SGCMarkus:
Yeah, you need to backup /system_root

The V40 uses a system-as-root layout, that means that the kernel mounts the system partition (which you want to backup) to / (rootfs), instead of like previous devices, to /system

/system is a link to /system_root/system in TWRP, and the Backup option for System backs up /system_root (i just renamed it for better displaying).

Having it mounted on /system works too (older TWRP version does that), but caused more issues than now, thats why its done this way currently.

Never worked with OpenRecoveryScript myself, so cant give answers on that.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
Hi and thanks for your TWRP and your support in responding. And I appreciate your explanation as I am still quite new to all of this. I have to presume that you compiled this TWRP from sources that were then modified for the V40.

In looking at some source code for the ORS processing here and searching for "run_script_file()" and for "strcmp(command, "backup") == 0" in that routine, I see that if the backup command issued via ORS contains "S" the path "/system" is added to the list of paths to be backed up when the "Backup_Command()" is invoked. This in turn invokes "Run_Backup()" in the PartitionManager code here. And that code invokes "Find_Partition_By_Path()" which tries to find a mount point "/system". But this is not found. So it returns a failure and the attempt to backup /system is skipped.

As a newbie here, it is hard for me to be sure. But I suspect that if the code for ORS processing's "Backup_Command()" was modified to use the path "/system_root" in place of "/system" when the backup command contains "S", the desired result would be achieved. And while I am less confident in my comprehension, it would seem that if a similar change were made to the ORS processing's "run_script_file()" after "strcmp(command, "restore") == 0" were made that restoration of this would also be possible.

Thanks for all!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] jerrycbrowne:
Query

Awesome work man. One question though. I'm on LMV405EBW I'm wondering whether TWRP-judypn-boot.img is the only image I need? Am I loading this image from LG's recovery, ie, pre TWRP? Apologies if this is obvious. I want to get this right!
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] NoburtM:
I'm attempting to install TWRP onto my phone, but if I try to get into either fastboot or bootloader it doesn't work

It just won't go to it through either adb or button combos

Any tips?
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] BadToThePhone:
[MENTION=3475147]SGCMarkus[/MENTION] would you consider making twrp for oreo? Thanks
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] tgurnz:
I have installed paranoid android and followed all steps during the install process laid out by sgcmarkus as well as the paranoid android team. My problem is i cannot boot into twrp no matter what i try after my install. I injected it when installing pa, i installed to ramdisk as well. I cannot fastboot into it using the file it just goes into download mode....
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] R800x_user:
Well as far as I know to get to recovery for lg devices, you have to hold volume down +power and as soon as the LG v40 splash screen shows up let go, press again and hold the power button. All while holding the volume down. Alternatively when in the system hold the reboot option. It should transition to advance reboot menu.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] vizagi:
Had the same problem with paranoid android. In my case, I still had stock lg on my opposite partition. I simply switched partitions in fastboot mode and was able to access twrp. If you have paranoid on both partitions, then restore your laf partition and flash your phone back to stock.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] NGOwner:
This doesn't work on mine. Android 9.0, crossflashed Sprint. Holding the Power off and Restart doesn't launch a new menu.

[NG]Owner
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] treesap:
T-Mobile?

Is the T-Mobile variant compatible with this TWRP installation method? Or is it independent of vendor image?
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] tech_infinity:
T mobile users can't unlock bootloader so I'm gonna say no.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] R800x_user:
I mean hold the reboot option not the power button. It should prompt you for an extended reboot on paranoid Android. Once you get that you should get a recovery option.
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] basmeuter:
Hello all! I was reading all posts and saw many people with problems. I am from the Netherlands and in planning to buy a V40, so European version, but can I install TWRP and just use stock (with magisk for systemless root) without a problem? Are there people on this forum where everything just worked fine?

I have had a OnePlus One, and now LG G6. Installing TWRP went pretty straight forward with a guide on these phones, but reading this forum I'm afraid this is gonna be much more difficult..
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] whitedavidp:
I don''t think you can root or TWRP the T-M variant at all. In this thread it says "The reason you can't unlock your T-Mobile device is because no other bootloader/firmware will work with T-Mobile devices. Only T-Mobile firmware will work on it. If you're looking for root, avoid V405TA (T-Mobile) phones. Any other model will work for this."
[LG V40 ROMs, Kernels, Recoveries, & Other Developm] basmeuter:
And is unlocking the V40 breaking widevine L1?