yashsingh1/xdaforums huggingface dataset:
[LG V20 Guides, News, & Discussion] emdroidle:
You're correct that `kdzwriter` is an ELF executable, at which point that error message is unexpected. That error message does clearly indicate it got handed over to a shell.

Most likely the shell in TWRP is using execvp() or execvpe() which first try an execve() on the file and then fall back to using /sbin/sh to interpret the file (nowadays this is a misfeature and the standards really need to be fixed). Did you miss the `gunzip` step?

May be possible, though the results are uncertain. Please be careful if you try this. Be prepared to have your device out of commission for a bit if you try this. Backup cust, modem and system beforehand and know how to restore them.

KDZ Writer was released under GPLv3. I place very few limitations upon its usage. Notice that I pointed to its source code in the opener (though it is mixed in with a few other V20 utilities). You're welcome to package it in with something else.

The existing version of KDZ Writer doesn't have the ability to write the data elsewhere, though you could add this feature yourself. I'm unsure how much /cust and /firmware (modem) get accessed after the phone has booted. Might well be possible to `umount /firmware ; kdzwriter -m something.kdz` even when Android was running normally.

While I reserved -O for writing /OP, due to lack of need I never finished implementing writing of /OP. The problem is writing /OP is complicated. Of particular note, one of the parts of writing /OP is potentially /OP gets resized larger and /data gets resized smaller. /OP mostly contains extra programs preloaded by LG and those seemed too low-value (most appeared to be bloatware) to bother with.

Removing the `ln -s` step is on my list too. The underlying issue is the linking step in the NDK's build process lists /system/bin/linker64 as the runtime linker. Whereas TWRP installs that in /sbin/linker64. If TWRP wanted to make things simple for developers, they really should add a symbolic link along those lines. Mounting a filesystem on a non-empty directory is a perfectly legal operation (no matter what the fuse utilities suggest), so mounting /system makes the link disappear.

I've got two approaches to fixing the issue, first is to add an invocation of:

perl -w -e "while(<>) { s,/system/bin/linker64,/sbin/linker64\\0\\0\\0\\0\\0\\0,; print;}" < kdzwriter.orig > kdzwriter

to the build process. This is a hack, but testing indicates it will work. The better approach is there should be some flag to `ld` to override the default interpreter and tell it to use /sbin/linker64 instead.
[LG V20 Guides, News, & Discussion] sim590:
May be I should rather run `adb root; adb shell` when the phone is in debugging mode. Then, the shell I'd end up in wouldn't be TWRP's, but Lineage OS / Android? Is that right?

No, I didn't. I acknowledge from your point of view, it could explain the message, but I know what `gzip` compression algorithm is. ;)

However, I forgot to mention that I'm trying to use the binary on a LG G3 (d852g). I assumed that the binary would be compatible between recent LG devices. I'm reading the OP again and I'm finding that my device is not listed, but I was led to believe by the two first sentences of the OP that it would be compatible. That may be the proof that it is not...
[LG V20 Guides, News, & Discussion] iammk_19:
i have h990ds

i mean how to use this tool do i need pc? nd where to extract kdz writer i want to go on lastest software without losing root! I was xiaomi user that's why this all is very new for me!
[LG V20 Guides, News, & Discussion] emdroidle:
That is a crucial detail. I was suggesting there should be forward compatibility, not backward compatibility. :(

There are two crucial assumptions built into `kdzwriter` which break on a G3. The milder assumption is use of UFS, which causes device names to be "/dev/block/sda" ... "/dev/block/sdg"; whereas a G3 it would be eMMC which would be "/dev/block/mmcblk0". This is pretty simple to fix.

The assumption which requires rather larger changes to "kdz.c" is that of being a 64-bit processor, which makes mmap() of the KDZ file and the on-board storage feasible. Using mmap() significantly simplified the code, but won't work on an ARM-v7 processor.

The error message you saw was due to the latter assumption. The TWRP kernel attempted to execute `kdzwriter`, but as `kdzwriter` is a 64-bit executable that fails at which point the tradition it to hand it over to the shell (which fails).

The changes needed to work on a G3 shouldn't be that large, but right that is way down on my todo list. My source code is available (opener), so if you're up for modifying "src/kdz.c" to work, feel free.

Being able to attach your phone to a computer is helpful, but is in no way required. Typing the commands into your phone via software keyboard could be slow. The `gzip` format is a well known compressed format, TWRP includes the program to uncompress it.
[LG V20 Guides, News, & Discussion] NotYetADev:
Awesome tool! You've done the LG community a great service.

I used this after the dirtysanta exploit to update my stock firmware without setting off Anti-Rollback

However, I had problems with 1.3 saying the KDZ wasn't applicable to my device (it is) so I had to use 1.2. This failsafe is a good idea, but there should be a flag with a disclaimer to over ride it. I'm 100% sure this KDZ matches my model, and it boots perfectly.

Works like a charm, otherwise!

For anyone who is using this for the same purpose as I: BE SURE TO DISABLE AUTOMATIC SYSTEM UPDATES IN DEVELOPER OPTIONS!! IF A NEW UPDATE IS RELEASED IT CAN UPDATE ANTI-ROLLBACK! If you want root, make a manually patched bootimage in magisk then flash it in the dirtysanta fastboot. For some reason TWRP is overwritten and doesn't support the proprietary filesystem in the newer Verizon updates. Be sure to have an oldoldold KDZ around in case something goes wrong.
[LG V20 Guides, News, & Discussion] musclebodyguard:
I unlocked bootloader..I'm sorry but I can't use kdzwriter...anyone can make a video with explanations step by step please? what should I do ? Help !!
[LG V20 Guides, News, & Discussion] sh525:
Thank you for such a good tool.

I had problems with 1.3 saying "this KDZ file does not appear to be applicable to this device", My device is US996, KDZ is "US99610n_00_1116.kdz" and downloaded from "https://lg-firmwares.com/lg-us996-firmwares/ ".

1.3 is normal to write "US99610l_05_1031.kdz"
[LG V20 Guides, News, & Discussion] musclebodyguard:
Rename the file to us99610l.kdz
[LG V20 Guides, News, & Discussion] sh525:
Thanks for your reply,Renaming can't solve this problem!
[LG V20 Guides, News, & Discussion] Redline:
What software version does your phone have currently?
[LG V20 Guides, News, & Discussion] sh525:
US99610L
[LG V20 Guides, News, & Discussion] Redline:
I'd re-download the KDZ to be sure. Make sure you have the right region KDZ for your phone, or perhaps try another.
[LG V20 Guides, News, & Discussion] sh525:
Thanks for your help! I'll try the other KDZ again.
[LG V20 Guides, News, & Discussion] emdroidle:
This is likely the best first thing to try in case of failure. Even mild corruption of the KDZ files can cause failures. Worse, I'm pretty sure this program could miss corruption if it doesn't effect portions of the file `kdzwriter` checks. :(

If redownloading the file doesn't work, then we've got an interesting situation. Before writing KDZ files, `kdzwriter` does some sanity checking as to whether the file is likely to successfully apply to the device. This message indicates the checking failed, so if this is a correct file then some investigation is needed (crossing my fingers that this isn't the situation).
[LG V20 Guides, News, & Discussion] sh525:
I've redownloaded the file “US99610n_00_1116.kdz”, and I'm sure there's no problem. It's normal to use LGUP.
[LG V20 Guides, News, & Discussion] 3mL:
Anyone have the latest H990DS update available to download?

LG-Firmwares website are updating their servers and won't be available for at least 3-4 days.

My backup is on a hdd which I do not have access to. :(

Cheers

Emil.
[LG V20 Guides, News, & Discussion] Redline:
Which update is that?
[LG V20 Guides, News, & Discussion] Vernox701:
About to try this I am using Vs995 on 13a and wanted to update to 18a and keep using the 1.3 restock kernel

do I use the -ak or just -s

I am getting a prompt with a 10 second count down if I type [y] for yes operation aborts,

when I proceed it says this file does not appear to be for your device and aborts operation
[LG V20 Guides, News, & Discussion] will5:
Can we have more examples to upgrade h990ds to latest firmware and keep root and kernel?

twrp should be on sideload? Im getting error: closed at sending the kdzwriter file.

Thanks

Edit. Nevermind, reboot and changing adb drivers did the trick

For me, this worked fine to update from 10d to 10g in case anyone needs to know:

C:\Users\Myself>adb reboot recovery

C:\adb>adb push kdzwriter.gz /

C:\adb>adb shell

gunzip -c /kdzwriter.gz >/sbin/kdzwriter

chmod 755 /sbin/kdzwriter

umount /system

ln -s /sbin /system/bin

kdzwriter -a external_sd/update.kdz
[LG V20 Guides, News, & Discussion] Arfzck:
can anyone tell me about the latest h990ds firmware checksum? i have downloaded it for 6 hours and i'm afraid of corruption.. thank in advance
[LG V20 Guides, News, & Discussion] AlfaM03:
I'm at the last part.

did the 755 for KDZWRITER

then opened terminal to enter ln -s /sbin /system/bin

but when I entered kdzwriter -a etc it gave me a "not found"

what am I doing wrong?
[LG V20 Guides, News, & Discussion] emdroidle:
Thing is there are several differing KDZ files, and each has a different valid checksum. One of the simpler checks is to run `kdzwriter -t -a` which goes through all the steps except for writing the data. Any problem with a downloaded KDZ file should show up during "test mode".

Did you perhaps capitalize it as "KDZWRITER" during one of the steps? Unix distinguishes between uppercase/lowercase, so that could mess things up. I'm pretty sure I've managed to cause that error, but I'm spacing on which goof tends to cause it. Rerunning from the start should get it for you.
[LG V20 Guides, News, & Discussion] will5:
I think he is not using the correct path for the kdz file.

[MENTION=6984210]emdroidle[/MENTION]. Do you know how to get a stock kernel twrp flashable?

Is not possible switching from supersu to magisk, cause even using unsu, magisk complain of modded boot image. So I have to run kdzwriter with -k to get back to stock kernel and then flash custom kernel and magisk again.

Running kdzwriter just for this, is a pain. There is a way to obtain stock kernel? My phone is 990ds ARE region running v10g.

I dont want to run supersu, but its the only way to get sixaxis app working on 990ds. With magisk it wont sync. So, i have to switch back and foward supersu/magisk when I need this.

Thanks
[LG V20 Guides, News, & Discussion] AlfaM03:
Quote:

Originally Posted by xdav20

1. Extract kdzwriter binary from kdzwriter-1.3.gz with your preferred file manager. Ensure you will copy the .gz file to internal storage to avoid the write permission with the external storage in nougat

2. Copy kdzwriter binary to your external SD card

3. Copy your .kdz file to the root of your external_sd card and then rename it lg.kdz

4. Reboot to recovery

5. Tap on Advanced button, then File Manager

6. Point the file manager to where you copied kdzwriter binary in step 2

7. Tap the name once and you will be taken to another window. One of the operations/options presented to you is Copy File. Tap Copy File button. The file manager would then redirect the path to the root of your device. Find sbin directory and open it by taping it once. On the very right bottom corner of the screen there is button with folder icon with a check symbol in the center of it. Tap it to paste the file. Don't worry about the sbin directory being shown blank. Swipe to confirm.

8. Navigate back to sbin directory and find kdzwriter and tap it. You will be presented with the operations you can perform. One of which being to set the right permission to make kdzwriter to become executable. Tab on chmod, then in next screen type 0755 the tap on Enter button followed by a swipe to confirm.

9. Go back to Advanced screen and tap on Terminal and type and run the following:

ln -s /sbin /system/bin

10. You are ready to execute kdzwriter as however you wish. This is how you would point to lg.kdz in the root of your external SD Card in terminal,

kdzwriter -[options] /external_sd/lg.kdz

Good Luck!

^ I followed the above steps. Every thing was working well so far until number 10.

Is there anything wrong with it?
[LG V20 Guides, News, & Discussion] will5:
Why dont you put the exact lines you typed? It will be easier to help you.
[LG V20 Guides, News, & Discussion] AlfaM03:
ok I will follow the steps.

I copied kdzwriter.gz to my internal storage along with my kdz which I renamed to up.kdz

rebooted to twrp

typed adb push kdzwriter.gz/ done

typed adb shell

but when i type gunzip -c /kdzwriter.gz >/sbin/kdzwriter it says /kdzwriter.gz does not exist -- skipping
[LG V20 Guides, News, & Discussion] will5:
Kdzwriter should be on a pc folder. Not on phone. It could be on phone, but instructions probably wont be the same as the first post.

And you can do every steps from pc with adb, no need to type anything on phone.
[LG V20 Guides, News, & Discussion] xdav20:
Patched TWRP Recovery for H990DS

The attached twrp recovery has kdzwriter included in it. I have previously discussed how to do this in details but never uploaded the patched version until now.

The twrp version is for h990ds that was given to us by [MENTION=6984210]emdroidle[/MENTION]. All you have to do, after booting to twrp recovery, to execute the following code in twrp's terminal before using kdzwriter:

ln -s /sbin /system/bin

It couldn't be easier to use kdzwriter now.

Edit: This is my first post using my LG V20. Finally setup one of them to use it as my daily driver after months of owning them. So far so good.
[LG V20 Guides, News, & Discussion] shomi1417:
Hi,

i upgrde my v20 to 10h with security from 01.01.2018. ;)

I install several apks but now i have some spare time and i want to do it from beginning and set up v20 right :)

Before upgrade i try factory reset with twrp and it mess up everything... phone went to twrp bootloop and i have to start everything again (dirtysanta, twrp, kernel, root....).

How to do factory reset with new upgrade?

I have magisk root, dots kernel, twrp, xposed...

Thanks in advance

ps. Sorry for bad english ;)
[LG V20 Guides, News, & Discussion] xdav20:
H990DS: Info Bank thread should had been pinned by the moderators as over 90% of its content is relevant to all LG V20 users. All you need to know is well documented in above thread.
[LG V20 Guides, News, & Discussion] shomi1417:
ok, thank you
[LG V20 Guides, News, & Discussion] will5:
Why cant you do factory reset with twrp?

I didnt find any relevant info about this. And I think I did it many times without problem.
[LG V20 Guides, News, & Discussion] shomi1417:
I try and phone went into twrp bootloop...
[LG V20 Guides, News, & Discussion] sptw:
Is this kdzwriter operation erase all the user data files and programs, or just update the system/firmware?
[LG V20 Guides, News, & Discussion] Usernamereg:
Successfuly updated indian 10j with system of 10K indonesia

Just updated Indian version 10J(H990ds10j_00_OPEN_ESA_DS_OP_0923.kdz dt. 2017-10-12) with only system of indonesia 10K(H990ds10k_00_OPEN_ESA_DS_OP_0117.kdz dt.2018-02-16). using jhalex kernel 1.4....on xposed

command used

kdzwriter -s /external_sd/lg.kdz

Thanks emdroidle :good:
[LG V20 Guides, News, & Discussion] Redline:
Read the first post. It lists the commands and what they update. No, this doesn't wipe anything.
[LG V20 Guides, News, & Discussion] sptw:
Thanks for your input IDefalt.

Edit: Done. Kdzwriter -a works flawless. It does not wipe data user. Perfect !!!

LG V20 H990DS, 10G AME for the latest 10H AME 0117.
[LG V20 Guides, News, & Discussion] elcanela:
Hi, all. I'm getting a weird issue that I haven't seen anyone else report/mention. I have a VZW LGV20 (VS995), that I rooted with Dirty Santa. For KDZwriter, I am using the method that involves using the handset exclusively. The error i get when I type in "kdzwriter1.3 -a /external_sd/lg.kdz" is "kdzwriter1.3: this KDZ file does not appear to be applicable to this device, abandoning operation". I have downloaded the KDZ file 3 times, placed it on my sdcard, but am still unsuccessful in getting the write to execute. Is it somehow checking/verifying the device even though I don't type "-t" ? I have attached a pic of the screen if it helps narrow down the issue.
[LG V20 Guides, News, & Discussion] sptw:
Please, take an attention for the correct name are you using for the kdz file. Unless you modified it, the correct one is kdzwriter-1.3.gz . You have to type in this way.

By the way, take care using the other comands on adb and the kdz file on your sd card. You have to follow exactly the name and the explanation there.

Hope this help you.
[LG V20 Guides, News, & Discussion] elcanela:
I have changed the name to something i find easy to type. I get the kdzwrIter to run, it counts down, when it reaches "0" it gives me that error. I am definitely using the right kdz (Verizon 1AA). Thanks.
[LG V20 Guides, News, & Discussion] ROTORGAMES:
Hi!

I'm not able to find H91010P Kdz to update my ATT phone, i leve outside USA, no way to force OTA.

The https://lg-firmwares.com do not provide any firmware can anyone help me?

Thanks!
[LG V20 Guides, News, & Discussion] shouk_1987:
Updated from 10g to 10h UAE region using -a option then flashed magisk and kernel

Data was not wiped but first boot took about 30 minutes to boot ( 20 minutes LG logo screen + 10 minutes android is upgrading screen with percentage )

Everything is smooth and working fine
[LG V20 Guides, News, & Discussion] sajadzarepour:
I want to update my h990ds from 10b to 10h version ,

1)can i update from 10b to 10 h ? or first update from 10b to another version like 10g and update from that version to 10 h?

2) please tell me what flags must be use after kdzwriter for update and my root keeps

---------- Post added at 09:52 AM ---------- Previous post was at 09:45 AM ----------

i rooted my h990ds UAE version in 10b , and i use kdzwriter for update to 10 h , but -a flag was unsuccessful than i use -sM flag for update, now in settings and software info my version write 10b yet !!!!

please help me , i have10b and 10g and 10h firmwares for use.
[LG V20 Guides, News, & Discussion] shouk_1987:
Always include first -t in your options so that you can simulate writing before performing a real write

I used -a and it worked fine with me from 10g to 10h

One time when i was changing from supersu to magisk i used -aM to disable preserving older root

Not sure the exact process though

You can check Info Bank thread which is a library for our device
[LG V20 Guides, News, & Discussion] sajadzare:
Thanks dear friend, i update my v20 h990ds from 10b to 10g and then 10g to 10h. With -a flag.

One problem still yet : my phone is not smooth and hang on programs. Can i wipe cache and dalvik and format data ?
[LG V20 Guides, News, & Discussion] funguru:
Successfully Updated to H990ds10h using kdzwriter.gz in twrp ln -s /sbin /system/bin kdzwriter -s /external_sd/lg.kdz ! UAE H990!
[LG V20 Guides, News, & Discussion] oscarmaldonado:
Hello everyone, I'm having problems trying to update my phone using a kdz file.

I have a H990DS

Renamed the KDZ file to lg.kdz

I have the kdz writer binary in sbin

I already used chmod to make kdzwriter executable

I'm using this in teminal:

ln -s /sbin/system/bin

And then:

I was looking at a previous post:

kdzwriter -s /external_sd/lg.kdz

(the previous post: kdzwriter -[options] /external_sd/lg.kdz.

CAN YOU PLEASE TELL ME WHAT I'M DOING WRONG. Thanks in advance.
[LG V20 Guides, News, & Discussion] MaZeNsMz:
Hi there,

KDZ writer is just a waste of time, I spent three days trying more than five roms, all of the failed to flash.

However, I found another tool, within 10 minutes I flashed the latest rom without touching the root.

https://xdaforums.com/v20/how-to/guide-patch-lgup-to-unlock-features-t3652222

I had H990ds10e and I flashed H990ds10h.

The security patch is showing 1 January 2018.

The only issue is the Android Software Version still showing V10e > any suggestions here ?!

I flashed only /System partition.

Note:

after the flash I got no touch screen response (No touch) so I flashed this kernel and the problem solved

https://xdaforums.com/v20/development/kernel-t3726416
[LG V20 Guides, News, & Discussion] speculatrix:
I finally got round to upgrading my version h990ds10c version. I had to delete the /system/bin directory in the twrp shell before I could do the "ln -s /sbin /system/bin" command, otherwise I ended up with a symlink at /system/bin/sbin to /sbin and kdzwriter didn't work.
[LG V20 Guides, News, & Discussion] legedug:
Finnaly using kdzwriter -aM got upgrade from 10d OPEN_AME to 10k OPEN_ESA

Thanks
[LG V20 Guides, News, & Discussion] will5:
Dont you get some warning about region missmatch after android boots?
[LG V20 Guides, News, & Discussion] legedug:
Yes but I managed to change in /cust folder.
[LG V20 Guides, News, & Discussion] p7810456:
I tried going from V10h OPEN-AME-XX to V10k OPEN-ESA using the -aM option like you, but it still shows OPEN-AME-XX in settings. Also, it didn't work but the phone still boots, but now when I go into TWRP to flash Magisk it asks me for the encryption password, how do I remove this and do I need to format data again? Any suggestions? Thanks in advance!
[LG V20 Guides, News, & Discussion] will5:
Yes. You have to format data.

Why did you use other region firmwares? If they were released on the same date, they are probably the same. Having a newer naming like 10k vs 10h means nothing.
[LG V20 Guides, News, & Discussion] Phoenix591:
Either format data or install a build of TWRP that supports encryption (afaik only mine ATM)
[LG V20 Guides, News, & Discussion] p7810456:
It had newer security patches and OPEN-ESA supports VoLTE where OPEN-AME does not for some reason...
[LG V20 Guides, News, & Discussion] p7810456:
Dude thanks so much, you just saved me from having to make an LG Backup, along with my launcher and maybe other stuff, format, and then wait 1.5 hours for everything to restore! and you also got me to update my TWRP from 3.0.2-1 in the process! The H990 version of the recovery works perfectly BTW on my H990DS, including the battery and the time.
[LG V20 Guides, News, & Discussion] will5:
Hi. Could you explain a little more how this works?

Since we dont set any encryption, there is really an encryption? Lg set this by default? Or twrp does a false detection of encryption?

Your build of twrp ignores encryption? Since old twrp asked for a password, I dont know how this works, we never set any password.

Thanks.
[LG V20 Guides, News, & Discussion] Phoenix591:
By default Android requires encryption of /data if possible (where all apps that arnt preinstalled and regular storage is). By default in stock ROMs it's encrypted without a password during setup, and checking the require pin at startup option changes the encryption password to match the lockscreen password.

When installing magisk in twrp, if /data isn't already readable and encrypted it disables mandatory encryption which is why most rooting instructions have you flash magisk/SuperSU then format data, to disable encryption since those old twrp can't read encryption properly and then format to remove any existing encryption.

If you set the require pin at startup option (or encrypted the phone in lineageos) twrp will ask for the password/pin preventing any theoretical person from removing the lockscreen password in twrp if they don't know it without formatting away your files and apps.
[LG V20 Guides, News, & Discussion] will5:
Hi. Thanks for your answer.

So, I had set a pin at startup. Twrp should ask me for the pin? It didnt ask when changed kernels. In this case since I formatted data when root, encryption is permanetly disabled and there is no way to turn it on?