[! DISCONTINUED !] [TUTORIAL][LOCKED][UNLOCKED][ANY G4] DLM Backup

Status
Not open for further replies.
Search This thread

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
This thread is superseeded by: https://tinyurl.com/SALTatXDA

NO FURTHER SUPPORT HERE!

DLM Backup is a NANDROID BACKUP IN DOWNLOAD MODE!
(DLM Backup = [D]own[l]oad [M]ode Backup)

The following does not require an unlocked device and so even no TWRP.
Believe it or not but you are able to backup full partitions nevertheless!!! :victory:
.. and all this even for partitions you usually have NO ACCESS TO (e.g. laf, aboot etc) and all this even without root ! wtf its not a dream its true! :victory:

It's really awesome especially for those having a locked device but still wanted to have a nandroid backup
or for those encountering the ILAPO (Infinite Loop Auto Power off or just called "bootloop issue") wanting to save their data!

The following will make full disk dumps of all or only the system essential ones of your device. Choose whichever option you need.

Preparation

First of all you should download FWUL ( https://tinyurl.com/FWULatXDA ).
Every other Linux is fine as well as long as you can handle it! (do not expect support from me then - I support FWUL only)
You may still should consider FWUL as it has everything onboard and is preconfigured to work with Android devices out-of-the-box.

Keep in mind the FWUL password as you need it for the sudo commands within the terminal later.

Once FWUL is running open a terminal (little black icon in the panel):

Code:
git clone [url]https://github.com/steadfasterX/lglaf.git[/url] 
cd lglaf

Leave this terminal window open - we need it in the next step.

Then boot your phone into download mode --> the following guide is 100% working and bulletproof:
  1. take out battery and unplug USB cable
  2. plugin USB cable to your PC (while battery ist still out)
  3. wait until you see the missing battery icon (question mark within a battery symbol)
  4. press Volume up and while keeping it pressed put battery in (take care that you do not press the power button)
  5. keep pressing Volume up until you see "Download mode"

If that does not work for you try it this way instead:
  1. unplug USB cable
  2. power down device or pull out battery
  3. put battery back
  4. press Volume up and while keeping it pressed plugin USB cable to your PC (take care that you do not press the power button)
  5. keep pressing Volume up until you see "Download mode"

Your phones screen should look similar to this afterwards:
LG-G4-enter-download-mode-2.jpg

You need a USB stick or disk which is big enough to hold the backup.
Depending on the method you need either a ~8 GB one or a 64 GB..

Plugin the USB stick and find out the path to it by just double clicking on the USB stick icon which appears on the desktop after plugging in the stick.
Then write down / copy the path to the stick as shown in the screenshot:

screenshot_001.png

If you encounter problems with the above (e.g. no icon appears after plugging in the USB stick) you can do this in a terminal instead:
Code:
df
Filesystem                         1K-blocks      Used Available Use%[COLOR="Red"] Mounted on[/COLOR]
dev                                 16439340    264744  16174596   2% /dev
[............]
/dev/sdd3                            2978320      9532   2797780   1%[COLOR="red"] [B]/run/media/android/myusb-stick[/B][/COLOR]

When you are running LL you can skip this step but when you are on MM (or higher...) you need to do the following:

Execute this in your terminal left open from the "Preparation" topic:
Code:
sudo python2 auth.py
you should see something like:

LGLAF.py: DEBUG: Detaching kernel driver for intf 0
LGLAF.py: DEBUG: Using endpoints 83 (IN), 02 (OUT)
auth: DEBUG: Challenge: c0:45:6c:78
auth: DEBUG: Response: b4:1d:1e:cd:e8:f1:5f:b5:fa:78:9e:f8:2d:c6:83:86

Now you are authenticated with the download mode and we can continue:


Option A) FULL backup (includes everything e.g. system, cache and userdata / internal storage)

When to use:
  • if you want to flash new ROMs or bootloader stacks
  • if you want to backup all your internal storage (e.g. pictures, videos and stuff) - keep in mind TWRP does NOT backup your internal storage!!
  • if you want to have a real FULL NANDROID (e.g. TWRP will not backup partitions like misc, persistent, persistent-lg etc)

Requirements:
- FWUL
- a 64 GB or bigger USB stick / disk

Execute this in your terminal left open from the "Preparation" topic:

Code:
sudo python2 extract-partitions.py --max-size 0 -d [I]YOURUSBSTICKpath[/I]
(replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

Be patient.. this can take a loooong time!

You can watch the progress e.g with executing this in a NEW terminal (just click the terminal icon in the panel again):
Code:
watch 'ls -lathr [I]YOURUSBSTICKpath[/I] | tail '
(replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

Once finished you can reboot by either taking out the battery or typing:
Code:
sudo python2 lglaf.py --skip-hello -c '!CTRL RSET'



Option B) system essentials backup (does *NOT* include system, cache and userdata / internal storage!!)

When to use:
  • if you want to flash new bootloader stacks
  • if you want to backup your current lock/unlock state
  • if you want to backup your IMEI and EFS

Requirements:
  • FWUL
  • a 4 - 8 GB or bigger USB stick / disk

Execute this in your terminal left open from the "Preparation" topic:

Code:
sudo python2 extract-partitions.py -d [I]YOURUSBSTICKpath[/I]
(replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

Be patient.. this can take some time!

You can watch the progress e.g with executing this in a NEW terminal (just click the terminal icon in the panel again):
Code:
watch 'ls -lathr [I]YOURUSBSTICKpath[/I] | tail '
(replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

Once finished you can reboot by either taking out the battery or typing:
Code:
sudo python2 lglaf.py --skip-hello -c '!CTRL RSET'


... and the last 2 things which need to be done

1) Click the thanks button here ;)
2) Enjoy :)


Restore a DLM Backup

Checkout Post #2 for the restore howto


Credits




.
 
Last edited:

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
Restore a previously taken backup or partitions of an already extracted KDZ

There are 2 methods available - choose the one matching your needs:

  • A) Restore a previously taken DLM Backup
  • B) Flash a KDZ / LGUP NG by sfX

Unfortunately this may not work on every firmware so you may try different firmwares then and you will receive the same error regarding communication port closing but in general it should work this way.


A) Restore a previously taken DLM Backup / Restore partitions from an extracted KDZ


To restore single partitions use the following

sudo python2 auth.py
sudo python2 partitions.py --restore /path/to/dumpfile partitionname

e.g.
sudo python2 auth.py
sudo python2 partitions.py --restore /tmp/misc misc
(would restore the misc partition)


To restore ALL partitions in a folder

For this the best is to use the new LGUP NG kdzmanager which is explained in the next topic.

Install LGUP NG but skip the steps to extract a KDZ if you don't need it.

Then:
bash kdzmanager.sh --test --flash /path/to/imagefiles
(/path/to/imagefiles must contain your previously taken DLM backup files or an extracted KDZ)

This will just test flashing and not actually flash.

If that looks fine do it again but without --test parameter:
bash kdzmanager.sh --flash /path/to/imagefiles



B) Flash a KDZ / LGUP NG (next generation) by sfX

Forget LGUP to flash a KDZ from now on!
Just use my KDZManager ;)

Features:
  • No worries anymore about those crappy DLL issues
  • Extract a KDZ
  • Test flashing partitions (dry run without actually flashing anything)
  • Flash partitions from a KDZ
  • when flashing avoid erasing/wiping userdata (keep your data between KDZ flashes)
    Hint: not wiping userdata can occur in a bootloop when its not compatible with the ROM! So use that option with care.
  • will work on any Linux (but FWUL is the only supported)

Keep in mind that this is an early release and there are NO CHECKS like ARB or even if the device model matches with the KDZ but THIS WILL ALL COME (even with an option to override and flash regardless) :)

Roadmap:
  • GUI
  • Check for matching device model
  • Check for ARB


Instructions:

  • Boot FWUL (or your Linux but keep in mind that only FWUL is supported), choose language & login
  • Download the KDZ file you want to flash (we need to know the path later e.g. /home/android/Downloads/)
  • Open the folder LG
  • Connect device in download mode to the PC
  • Double click "LG laf NG" icon

Type in the new opened terminal:
  • sudo python2 auth.py
    [*]sudo python2 partitions.py --list

    If this lists your partitions then we can proceed with flashing.

Download my brand new kdzmanager tool in FWUL: (right click and save as)
  • When you are not using the persistent mode of FWUL: plug in a big USB stick (e.g. 32 GB or more) into FWUL and extract the attached file there
  • When you are using the persistent mode of FWUL: just extract it in your download folder
  • You need to know the full path so best is copying the path from the file manager (e.g. /home/android/Downloads/ ) or leave the file manager open there

Open another terminal (black little icon in the panel)
  • cd and directly behind this paste the path you copied (e.g. cd /home/android/Downloads/ )
  • press ENTER
  • bash kdzmanager.sh -x FILLINFULLPATH-TO-DOWNLOADED-KDZ
    (e.g. bash kdzmanager.sh -x /home/android/Downloads/h811blablubb.kdz)
  • WARNING-1: Keep in mind that atm kdzmanager is not able to proof if you choose a compatible KDZ file for your device!
    Check your device model and the KDZ twice!


    WARNING-2: Keep in mind that atm kdzmanager is not able to proof your current ARB version so flashing an smaller ARB then your current one will BRICK your device.
    Check ARB first: CLICK


    If you understood the above 2 warnings proceed like this:
    bash kdzmanager.sh --test --flash extracteddz/
    (just like this as "extracteddz" is the path generated by the kdzmanager)
    This will just test flashing and not actually flash. Let me know the results of this (copy & paste output)
  • if you can't wait the next step would be actually flashing ofc:
    WARNING: by default the kdzmanager will not overwrite userdata (which would be like a factory reset) and I would recommend to leave it out always and better choose the LG factory reset menu (after flashing completed) if required. If you still want to flash it use --with-userdata as a parameter (can take a loooong time then btw).
    bash kdzmanager.sh --flash extracteddz/
  • last step ( will be included in the next release): wipe your userdata:
    sudo partitions.py --wipe userdata
    Or just use the factory reset hardware key combo to do the same.
    If you skip this step you may encounter a bootloop. If that happens you can at any time use the hardware key combo to boot into factory reset to fix that.

sfX
 
Last edited:

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
FAQ

1. Q: You get the error message: "Expected arrow in ls output" when executing lglaf
A: update to the latest version of lglaf (thx to @tulen_kobi for this patch!). For updating lglaf on FWUL check Q4.
If the error still persists your download mode version is not supported by lglaf. Its very likely that your carrier has a very strict policy activated in download mode. The only chance is to try other download mode version meaning to flash different KDZ files (on locked devices) or just the laf.img in fastboot (on unlocked devices).
On Nougat and when unlocked it is enough to just flash the laf.img of MM and you can use lglaf again.


2. Q: You get not an error but messages or files containing just "Hello, I am LAF. Nice to meet you."
A: your download mode version is not supported by lglaf. Its very likely that your carrier has a very strict policy activated in download mode. The only chance is to try other download mode version meaning to flash different KDZ files (on locked devices) or just the laf.img in fastboot (on unlocked devices).
On Nougat and when unlocked it is enough to just flash the laf.img of MM and you can use lglaf again.


3. Q: All seems fine but at the end of a command you see: "comm.call(close_cmd) [....someotherstuff...] Command failed with error code 0x8000010a"
A: This is known and not a serious issue. Once I have the time I will fix it but in the meanwhile pls ignore..
This has been fixed. please update your LGlaf like described in the next FAQ


4. Q: I want to update lglaf on FWUL v2 or higher
ok here is the correct way to achieve this on FWUL v2:
cd ~programs/lglafng/
git pull
git checkout g4

then you're up2date and can try again while in this folder!



sfX
 
Last edited:

chrisyroid

Member
Jan 21, 2012
23
10
I'm so happy that you were able to finally get this working. It's dumping my system partition right now. I'll report back when it's done. :)

Also. You should note that the sudo password is "linux" and to view progress on the dump, you should specify that the command should be opened in a new terminal window.

Over all. Awesome tutorial!

EDIT: Was able to retrieve 7gb of lost pictures thanks to this method! Thank you!
 
Last edited:
  • Like
Reactions: steadfasterX

OllieD

Senior Member
Mar 22, 2007
217
40
38
North Yorkshire
www.Krew-13.Net
what Android version is installed currently?

.

20G Stock Locked Bootloader.

Rebooted into live environment and worked.
Extract partitions errored out


Traceback (most recent call last):
File "extract-partitions.py", line 63, in <module>
main()
File "extract-partitions.py", line 60, in main
dump_partitions(comm, disk_fd, args.outdir, args.max_size * 1024)
File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/android/lglaf/partitions.py", line 78, in laf_open_disk
comm.call(close_cmd)
File "/home/android/lglaf/lglaf.py", line 176, in call
raise RuntimeError('Command failed with error code %#x' % errCode)
RuntimeError: Command failed with error code 0x8000010a

After Dumping, Option B

Also the Firefox installer although it installs Firefox it wont launch and gives a SQLite Version Error so it will not run.
Chromium works fine.

Now i've backed up i can try and install V29 :)
 

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
20G Stock Locked Bootloader.

Rebooted into live environment and worked.
Extract partitions errored out


Traceback (most recent call last):
File "extract-partitions.py", line 63, in <module>
main()
File "extract-partitions.py", line 60, in main
dump_partitions(comm, disk_fd, args.outdir, args.max_size * 1024)
File "/usr/lib/python2.7/contextlib.py", line 24, in __exit__
self.gen.next()
File "/home/android/lglaf/partitions.py", line 78, in laf_open_disk
comm.call(close_cmd)
File "/home/android/lglaf/lglaf.py", line 176, in call
raise RuntimeError('Command failed with error code %#x' % errCode)
RuntimeError: Command failed with error code 0x8000010a

After Dumping, Option B

Also the Firefox installer although it installs Firefox it wont launch and gives a SQLite Version Error so it will not run.
Chromium works fine.

Now i've backed up i can try and install V29 :)

well it sounds like u have not much RAM attached to your VM then. 4 GB are recommended.
The dump error can be ignored as long as auth.py has worked before and everything gets dumped..



.
 

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
what if .. i dont have USB.? am planning of backing up my IMEI. as i been reading this on the new N roms..
what can i do.?

If you have an unlocked device you have luck and you could use dd commands in TWRP. I know that yours is unlocked so you could use dd on every partition available on your device.
Tbh the most important seems to be persistent, fsg, misc but until I know for sure I would just backup EVERY partition. It's only needed once in the phones life usually so it doesn't hurt..

I need to have my device repaired before I can test it further so this can take a while.. Until then the backup of every partition is the best choice.

if the device is locked and on LL then TWRP in FIsH plus the mentioned dd commands can be used as well. I would still recommend the download mode backup though..

if the device is locked and on MM or N (haven't tested N in download mode though) then USB plus download mode is the only choice.



.

Sent from my LG-H815 using XDA Labs
 
  • Like
Reactions: sdembiske

mateus.sc

Senior Member
Aug 10, 2014
130
77
If you have an unlocked device you have luck and you could use dd commands in TWRP. I know that yours is unlocked so you could use dd on every partition available on your device.
Tbh the most important seems to be persistent, fsg, misc but until I know for sure I would just backup EVERY partition. It's only needed once in the phones life usually so it doesn't hurt..

I need to have my device repaired before I can test it further so this can take a while.. Until then the backup of every partition is the best choice.

if the device is locked and on LL then TWRP in FIsH plus the mentioned dd commands can be used as well. I would still recommend the download mode backup though..

if the device is locked and on MM or N (haven't tested N in download mode though) then USB plus download mode is the only choice.



.

Sent from my LG-H815 using XDA Labs

OMG so basically if this works in locked N, can I flash the korean v30 kdz and then restore a backup the modem.img from v29a made for my H815 with this method?

The possibilities are amazing
 

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
Similar question. What's the quick and dirty way to backup these partitions from terminal app / busybox?

Dd if=??? Etc

not sure if different between models but mines h815 international running 'stock' nougat :)
I will add it in the TWRP thread ASAP

OMG so basically if this works in locked N, can I flash the korean v30 kdz and then restore a backup the modem.img from v29a made for my H815 with this method?

The possibilities are amazing
Technically this method can provide that (as said I can't test N atm though so I don't know if this works in general for N but if LG hasn't changed anything.. )

but:

keep in mind that cross flashing partitions can result in a soft brick on locked devices!! I don't know how N behaves here tbh so it may just work or it may soft brick in the specific case of modem.


So it would be nice to have someone trying to use the auth command on a N bootloader stack. This will not harm anything but then we know for sure if this is usable for N or not



.

Sent from my LG-H815 using XDA Labs
 
  • Like
Reactions: mateus.sc

raptorddd

Senior Member
Jun 13, 2013
6,485
2,328
culiacan
If you have an unlocked device you have luck and you could use dd commands in TWRP. I know that yours is unlocked so you could use dd on every partition available on your device.
Tbh the most important seems to be persistent, fsg, misc but until I know for sure I would just backup EVERY partition. It's only needed once in the phones life usually so it doesn't hurt..

I need to have my device repaired before I can test it further so this can take a while.. Until then the backup of every partition is the best choice.

if the device is locked and on LL then TWRP in FIsH plus the mentioned dd commands can be used as well. I would still recommend the download mode backup though..

if the device is locked and on MM or N (haven't tested N in download mode though) then USB plus download mode is the only choice.



.

Sent from my LG-H815 using XDA Labs
yes unlocked.. i downloaded FWUL but on step to place the command for python i had directiry not found and gave up use twrp for EFS.
for DD what are commands is this using ternimal? where can i find all the command to extract say boot ,system modem ect.?
 

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
yes unlocked.. i downloaded FWUL but on step to place the command for python i had directiry not found and gave up use twrp for EFS.
for DD what are commands is this using ternimal? where can i find all the command to extract say boot ,system modem ect.?

just try my new twrp version which will be uploaded in 5 minutes..


.
 
Last edited:

ReeS86

Senior Member
Oct 5, 2008
126
98
Kitchener ON
Hey I'm getting an error in running this - phone is in download mode and connected. Using FWUL on my machine and trying to dump to an extrernal HD (path below in first line).

Code:
[android@fwul lglaf]$ sudo python2 extract-partitions.py --max-size 0 -d /run/media/android/16a064ee-96de-4c4d-8c30-29cbcc2e5441/
Traceback (most recent call last):
  File "extract-partitions.py", line 63, in <module>
    main()
  File "extract-partitions.py", line 60, in main
    dump_partitions(comm, disk_fd, args.outdir, args.max_size * 1024)
  File "extract-partitions.py", line 24, in dump_partitions
    parts = partitions.get_partitions(comm)
  File "/home/android/lglaf/partitions.py", line 41, in get_partitions
    assert arrow == '->', "Expected arrow in ls output"
AssertionError: Expected arrow in ls output
 
  • Like
Reactions: steadfasterX

steadfasterX

Recognized Developer
Nov 13, 2013
6,257
15,488
127.0.0.1
OnePlus 7T Pro
Hey I'm getting an error in running this - phone is in download mode and connected. Using FWUL on my machine and trying to dump to an extrernal HD (path below in first line).
Yea... I saw that on another phone as well. Weird.
I need your help to fix it..

Could you come into IRC on Monday?


sfX

Sent from my LG-H815 using XDA Labs
 
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 42
    This thread is superseeded by: https://tinyurl.com/SALTatXDA

    NO FURTHER SUPPORT HERE!

    DLM Backup is a NANDROID BACKUP IN DOWNLOAD MODE!
    (DLM Backup = [D]own[l]oad [M]ode Backup)

    The following does not require an unlocked device and so even no TWRP.
    Believe it or not but you are able to backup full partitions nevertheless!!! :victory:
    .. and all this even for partitions you usually have NO ACCESS TO (e.g. laf, aboot etc) and all this even without root ! wtf its not a dream its true! :victory:

    It's really awesome especially for those having a locked device but still wanted to have a nandroid backup
    or for those encountering the ILAPO (Infinite Loop Auto Power off or just called "bootloop issue") wanting to save their data!

    The following will make full disk dumps of all or only the system essential ones of your device. Choose whichever option you need.

    Preparation

    First of all you should download FWUL ( https://tinyurl.com/FWULatXDA ).
    Every other Linux is fine as well as long as you can handle it! (do not expect support from me then - I support FWUL only)
    You may still should consider FWUL as it has everything onboard and is preconfigured to work with Android devices out-of-the-box.

    Keep in mind the FWUL password as you need it for the sudo commands within the terminal later.

    Once FWUL is running open a terminal (little black icon in the panel):

    Code:
    git clone [url]https://github.com/steadfasterX/lglaf.git[/url] 
    cd lglaf

    Leave this terminal window open - we need it in the next step.

    Then boot your phone into download mode --> the following guide is 100% working and bulletproof:
    1. take out battery and unplug USB cable
    2. plugin USB cable to your PC (while battery ist still out)
    3. wait until you see the missing battery icon (question mark within a battery symbol)
    4. press Volume up and while keeping it pressed put battery in (take care that you do not press the power button)
    5. keep pressing Volume up until you see "Download mode"

    If that does not work for you try it this way instead:
    1. unplug USB cable
    2. power down device or pull out battery
    3. put battery back
    4. press Volume up and while keeping it pressed plugin USB cable to your PC (take care that you do not press the power button)
    5. keep pressing Volume up until you see "Download mode"

    Your phones screen should look similar to this afterwards:
    LG-G4-enter-download-mode-2.jpg

    You need a USB stick or disk which is big enough to hold the backup.
    Depending on the method you need either a ~8 GB one or a 64 GB..

    Plugin the USB stick and find out the path to it by just double clicking on the USB stick icon which appears on the desktop after plugging in the stick.
    Then write down / copy the path to the stick as shown in the screenshot:

    screenshot_001.png

    If you encounter problems with the above (e.g. no icon appears after plugging in the USB stick) you can do this in a terminal instead:
    Code:
    df
    Filesystem                         1K-blocks      Used Available Use%[COLOR="Red"] Mounted on[/COLOR]
    dev                                 16439340    264744  16174596   2% /dev
    [............]
    /dev/sdd3                            2978320      9532   2797780   1%[COLOR="red"] [B]/run/media/android/myusb-stick[/B][/COLOR]

    When you are running LL you can skip this step but when you are on MM (or higher...) you need to do the following:

    Execute this in your terminal left open from the "Preparation" topic:
    Code:
    sudo python2 auth.py
    you should see something like:

    LGLAF.py: DEBUG: Detaching kernel driver for intf 0
    LGLAF.py: DEBUG: Using endpoints 83 (IN), 02 (OUT)
    auth: DEBUG: Challenge: c0:45:6c:78
    auth: DEBUG: Response: b4:1d:1e:cd:e8:f1:5f:b5:fa:78:9e:f8:2d:c6:83:86

    Now you are authenticated with the download mode and we can continue:


    Option A) FULL backup (includes everything e.g. system, cache and userdata / internal storage)

    When to use:
    • if you want to flash new ROMs or bootloader stacks
    • if you want to backup all your internal storage (e.g. pictures, videos and stuff) - keep in mind TWRP does NOT backup your internal storage!!
    • if you want to have a real FULL NANDROID (e.g. TWRP will not backup partitions like misc, persistent, persistent-lg etc)

    Requirements:
    - FWUL
    - a 64 GB or bigger USB stick / disk

    Execute this in your terminal left open from the "Preparation" topic:

    Code:
    sudo python2 extract-partitions.py --max-size 0 -d [I]YOURUSBSTICKpath[/I]
    (replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

    Be patient.. this can take a loooong time!

    You can watch the progress e.g with executing this in a NEW terminal (just click the terminal icon in the panel again):
    Code:
    watch 'ls -lathr [I]YOURUSBSTICKpath[/I] | tail '
    (replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

    Once finished you can reboot by either taking out the battery or typing:
    Code:
    sudo python2 lglaf.py --skip-hello -c '!CTRL RSET'



    Option B) system essentials backup (does *NOT* include system, cache and userdata / internal storage!!)

    When to use:
    • if you want to flash new bootloader stacks
    • if you want to backup your current lock/unlock state
    • if you want to backup your IMEI and EFS

    Requirements:
    • FWUL
    • a 4 - 8 GB or bigger USB stick / disk

    Execute this in your terminal left open from the "Preparation" topic:

    Code:
    sudo python2 extract-partitions.py -d [I]YOURUSBSTICKpath[/I]
    (replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

    Be patient.. this can take some time!

    You can watch the progress e.g with executing this in a NEW terminal (just click the terminal icon in the panel again):
    Code:
    watch 'ls -lathr [I]YOURUSBSTICKpath[/I] | tail '
    (replace YOURUSBSTICKpath with the path you discovered in the Preparation topic!)

    Once finished you can reboot by either taking out the battery or typing:
    Code:
    sudo python2 lglaf.py --skip-hello -c '!CTRL RSET'


    ... and the last 2 things which need to be done

    1) Click the thanks button here ;)
    2) Enjoy :)


    Restore a DLM Backup

    Checkout Post #2 for the restore howto


    Credits




    .
    12
    Restore a previously taken backup or partitions of an already extracted KDZ

    There are 2 methods available - choose the one matching your needs:

    • A) Restore a previously taken DLM Backup
    • B) Flash a KDZ / LGUP NG by sfX

    Unfortunately this may not work on every firmware so you may try different firmwares then and you will receive the same error regarding communication port closing but in general it should work this way.


    A) Restore a previously taken DLM Backup / Restore partitions from an extracted KDZ


    To restore single partitions use the following

    sudo python2 auth.py
    sudo python2 partitions.py --restore /path/to/dumpfile partitionname

    e.g.
    sudo python2 auth.py
    sudo python2 partitions.py --restore /tmp/misc misc
    (would restore the misc partition)


    To restore ALL partitions in a folder

    For this the best is to use the new LGUP NG kdzmanager which is explained in the next topic.

    Install LGUP NG but skip the steps to extract a KDZ if you don't need it.

    Then:
    bash kdzmanager.sh --test --flash /path/to/imagefiles
    (/path/to/imagefiles must contain your previously taken DLM backup files or an extracted KDZ)

    This will just test flashing and not actually flash.

    If that looks fine do it again but without --test parameter:
    bash kdzmanager.sh --flash /path/to/imagefiles



    B) Flash a KDZ / LGUP NG (next generation) by sfX

    Forget LGUP to flash a KDZ from now on!
    Just use my KDZManager ;)

    Features:
    • No worries anymore about those crappy DLL issues
    • Extract a KDZ
    • Test flashing partitions (dry run without actually flashing anything)
    • Flash partitions from a KDZ
    • when flashing avoid erasing/wiping userdata (keep your data between KDZ flashes)
      Hint: not wiping userdata can occur in a bootloop when its not compatible with the ROM! So use that option with care.
    • will work on any Linux (but FWUL is the only supported)

    Keep in mind that this is an early release and there are NO CHECKS like ARB or even if the device model matches with the KDZ but THIS WILL ALL COME (even with an option to override and flash regardless) :)

    Roadmap:
    • GUI
    • Check for matching device model
    • Check for ARB


    Instructions:

    • Boot FWUL (or your Linux but keep in mind that only FWUL is supported), choose language & login
    • Download the KDZ file you want to flash (we need to know the path later e.g. /home/android/Downloads/)
    • Open the folder LG
    • Connect device in download mode to the PC
    • Double click "LG laf NG" icon

    Type in the new opened terminal:
    • sudo python2 auth.py
      [*]sudo python2 partitions.py --list

      If this lists your partitions then we can proceed with flashing.

    Download my brand new kdzmanager tool in FWUL: (right click and save as)
    • When you are not using the persistent mode of FWUL: plug in a big USB stick (e.g. 32 GB or more) into FWUL and extract the attached file there
    • When you are using the persistent mode of FWUL: just extract it in your download folder
    • You need to know the full path so best is copying the path from the file manager (e.g. /home/android/Downloads/ ) or leave the file manager open there

    Open another terminal (black little icon in the panel)
    • cd and directly behind this paste the path you copied (e.g. cd /home/android/Downloads/ )
    • press ENTER
    • bash kdzmanager.sh -x FILLINFULLPATH-TO-DOWNLOADED-KDZ
      (e.g. bash kdzmanager.sh -x /home/android/Downloads/h811blablubb.kdz)
    • WARNING-1: Keep in mind that atm kdzmanager is not able to proof if you choose a compatible KDZ file for your device!
      Check your device model and the KDZ twice!


      WARNING-2: Keep in mind that atm kdzmanager is not able to proof your current ARB version so flashing an smaller ARB then your current one will BRICK your device.
      Check ARB first: CLICK


      If you understood the above 2 warnings proceed like this:
      bash kdzmanager.sh --test --flash extracteddz/
      (just like this as "extracteddz" is the path generated by the kdzmanager)
      This will just test flashing and not actually flash. Let me know the results of this (copy & paste output)
    • if you can't wait the next step would be actually flashing ofc:
      WARNING: by default the kdzmanager will not overwrite userdata (which would be like a factory reset) and I would recommend to leave it out always and better choose the LG factory reset menu (after flashing completed) if required. If you still want to flash it use --with-userdata as a parameter (can take a loooong time then btw).
      bash kdzmanager.sh --flash extracteddz/
    • last step ( will be included in the next release): wipe your userdata:
      sudo partitions.py --wipe userdata
      Or just use the factory reset hardware key combo to do the same.
      If you skip this step you may encounter a bootloop. If that happens you can at any time use the hardware key combo to boot into factory reset to fix that.

    sfX
    8
    FAQ

    1. Q: You get the error message: "Expected arrow in ls output" when executing lglaf
    A: update to the latest version of lglaf (thx to @tulen_kobi for this patch!). For updating lglaf on FWUL check Q4.
    If the error still persists your download mode version is not supported by lglaf. Its very likely that your carrier has a very strict policy activated in download mode. The only chance is to try other download mode version meaning to flash different KDZ files (on locked devices) or just the laf.img in fastboot (on unlocked devices).
    On Nougat and when unlocked it is enough to just flash the laf.img of MM and you can use lglaf again.


    2. Q: You get not an error but messages or files containing just "Hello, I am LAF. Nice to meet you."
    A: your download mode version is not supported by lglaf. Its very likely that your carrier has a very strict policy activated in download mode. The only chance is to try other download mode version meaning to flash different KDZ files (on locked devices) or just the laf.img in fastboot (on unlocked devices).
    On Nougat and when unlocked it is enough to just flash the laf.img of MM and you can use lglaf again.


    3. Q: All seems fine but at the end of a command you see: "comm.call(close_cmd) [....someotherstuff...] Command failed with error code 0x8000010a"
    A: This is known and not a serious issue. Once I have the time I will fix it but in the meanwhile pls ignore..
    This has been fixed. please update your LGlaf like described in the next FAQ


    4. Q: I want to update lglaf on FWUL v2 or higher
    ok here is the correct way to achieve this on FWUL v2:
    cd ~programs/lglafng/
    git pull
    git checkout g4

    then you're up2date and can try again while in this folder!



    sfX
    6
    Introducing the first version of LGUP NG (next generation) by sfX

    Forget LGUP to flash a KDZ from now on!
    Just use my KDZManager ;)

    Features:
    • No worries anymore about those crappy DLL issues
    • Extract a KDZ
    • Test flashing partitions (dry run without actually flashing anything)
    • Flash partitions from a KDZ
    • when flashing avoid erasing/wiping userdata (keep your data between KDZ flashes)
      Hint: not wiping userdata can occur in a bootloop when its not compatible with the ROM! So use that option with care.

    Keep in mind that this is an early release and there are NO CHECKS like ARB or even if the device model matches with the KDZ but THIS WILL ALL COME (even with an option to override and flash regardless) :)

    Checkout LGUP NG by sfX here: https://xdaforums.com/showpost.php?p=73462610&postcount=2

    Cheers
    sfX
    5
    How to restore? Is it possible?
    Yes even that.. I will write down a restore guide soon.




    .

    Sent from my LG-H815 using XDA Labs