yashsingh1/xdaforums huggingface dataset:
[Asus ZenFone 3 Questions & Answers] alecxs:
no worry, just follow the install instructions, then follow above steps. you can also do it on windows. but when it comes to loop-mount partition images it's far more easier to do it in linux (viewing logs in cache partition). another reason is you don't have to struggle with Qualcomm HS-USB QDLoader 9008 Drivers as linux fully handle all usb drivers automatically.

Prerequisites Step 1

(linux)

open terminal with CTRL + ALT + T and navigate to any directory on your hard disk with cd

cd /media/xubuntu/*

Prerequisites Step 2

install dependencies

# Debian/(X)ubuntu/Mint/etc
sudo apt update
sudo apt install adb fastboot python3-dev python3-pip liblzma-dev git

(optional) disable mobile broadband communication (skip this)

sudo apt purge modemmanager
sudo systemctl stop ModemManager
sudo systemctl disable ModemManager
sudo apt purge ModemManager

Prerequisites Step 3

download build and install edl.py

# edl.py (required)
git clone -b 3.52.1 https://github.com/bkerler/edl.git
cd edl

# common firehose programmer collection = factory loaders (optional)
git submodule update --init --recursive

# build + install
python3 setup.py build
sudo python3 setup.py install

(optional) set usb permissions so edl.py can run without sudo

sudo cp Drivers/51-edl.rules /etc/udev/rules.d
sudo cp Drivers/50-android.rules /etc/udev/rules.d

Prerequisites Step 4

connect device in EDL mode and check if linux can see it

lsusb

now ready for installing own loader and backup everything!

(see above)

- fhloaderparse.py

- edl.py

next step can be skipped because I already did it for you (see attachments)

- download and extract AIK-Linux-v3.8-ALL.tar.gz

- copy boot.img into AIK directory

- execute unpackimg.sh shell script

- modify default.prop

- execute repackimg.sh shell script

once you have backup proceed with flashing modified boot, reboot phone and get a logcat.txt

(see above)
[Asus ZenFone 3 Questions & Answers] optimusodd:
Install instructions of what ? Linux or edl.py ? Should I boot into xubuntu via a bootable USB flash drive ? Thank you!
[Asus ZenFone 3 Questions & Answers] alecxs:
- boot into xubuntu via a bootable USB pendrive

- goto - settings - keyboard - add your language and remove english layout

- open your prefered directory on windows hard disk

- right mouse click - open terminal here

- proceed with prerequisites (post #11)

- get a working firehose programmer (trial and error)

- proceed with backup (post #9)
[Asus ZenFone 3 Questions & Answers] optimusodd:
Hello friend,after days of trial and error I managed to take a backup of all the partitions using QFIL.

As I want to do it via edl.py ,I have also set up a persistent Xubuntu USB and completed the Step 4.It looks like Linux has recognized the device in EDL mode ?

View attachment 5544917

If I am correct,in the next step, I need to put "prog_emmc_firehose_8953_ddr.mbn" inside "edl" folder (

xubuntu@xubuntu:/media/xubuntu/New Volume/XB/edl) and open Terminal there and run the following commands one by one which will make backups inside "edl" folder.Correct me if I am wrong.

mkdir ~/tmp
cp -v ./prog_emmc_firehose_8953_ddr.mbn ~/tmp
cd edl
python3 /media/xubuntu/New Volume/XB/edl/Loaders/fhloaderparse.py ~/tmp Loaders
python3 /media/xubuntu/New Volume/XB/edl/edl.py printgpt
python3 /media/xubuntu/New Volume/XB/edl/edl.py r boot boot.img
python3 /media/xubuntu/New Volume/XB/edl/edl.py r system system.img
python3 /media/xubuntu/New Volume/XB/edl/edl.py r cache cache.img
python3 /media/xubuntu/New Volume/XB/edl/edl.py r metadata metadata.bin
python3 /media/xubuntu/New Volume/XB/edl/edl.py r devinfo devinfo.bin
python3 /media/xubuntu/New Volume/XB/edl/edl.py r userdata userdata.img
python3 /media/xubuntu/New Volume/XB/edl/edl.py r ...

Again,there are 67 emmc partitions ( these are the partitions backed up by QFIL) out there.Nothing like "metadata".How do we find the names of the partition on LInux ? And do we need to do it manually one by one or is there any command to dump all the partitions ?

View attachment 5544951

Thank you!
[Asus ZenFone 3 Questions & Answers] alecxs:
yes QDL means EDL...

(paths with whitespaces must be quoted "/media/xubuntu/New Volume/XB/edl" but no need to type the whole path at all, just dot ./ is fine if you already cd'd into directory)

yes you can place prog_emmc_firehose_8953_ddr.mbn inside edl directory, just parse the proper file path as first argument to fhloaderparse.py (like tmp/ in example)

./edl.py printgpt is the initial command it will print you all partition names and some device info. if it fails, maybe EDL got timeout and phone needs to reboot into EDL mode again

yes there is command to dump all partitions at once. you don't need it as you already have done this step from QFIL which is great, it means you found working firehose programmer :p(y)

python3 edl.py printgpt
python3 edl.py rl dumps

your device obviously don't have metadata partition that was just example code

But you already have cache.bin you should loop-mount file and zip the logs from inside recovery directory. I will have a look into it maybe there is something useful inside. it should not contain anything that violates your privacy, however if you are paranoid about wifi/mac address or IMEI you can password protect zip
[Asus ZenFone 3 Questions & Answers] optimusodd:
yes you can place prog_emmc_firehose_8953_ddr.mbn inside edl directory, just parse the proper file path/name as first argument to fhloaderparse.py (like tmp/ in example)

Complete file path is

and I am running terminal inside "edl folder" but despite several attempts I am getting following error.

View attachment 5545497

Am I doing it the wrong way ? Can you please tell me the exact commands to run ?

How do you do that ? By executing Step 4 of Post #9 ?

mkdir ~/cache
sudo -H mount -t ext4 -o loop,ro,noexec,noload,noatime ./cache.img ~/cache
sudo -H thunar ~/cache

Thanks a lot!
[Asus ZenFone 3 Questions & Answers] alecxs:
one of your paths doesn't exist, either edl/Loaders/fhloaderparse.py is missing or it's because whitespaces in path

"/media/xubuntu/New Volume/XB/edl"

cd edl
python3 Loaders/fhloaderparse.py . Loaders

or if the above doesn't work

mkdir ~/tmp
cd edl
cp -v ./prog_emmc_firehose_8953_ddr.mbn ~/tmp
python3 ./Loaders/fhloaderparse.py ~/tmp Loaders

please also double check fhloaderparse.py exist and is spelled correctly and typed case sensitive
[Asus ZenFone 3 Questions & Answers] optimusodd:
Yes,it's missing.There is no file called "fhloaderparse.py" inside "Loaders" folder.

View attachment 5545603

It's also missing in bkerler/Loaders.
[Asus ZenFone 3 Questions & Answers] alecxs:
it is somehow removed from github

this commit is the last including it

https://github.com/bkerler/Loaders/tree/9b90b81

edit: lol it's still there in edlclient/Tools but without .py suffix

that's why the setup.py is needed, it will install the scripts right in environment so fhloaderparse is in $PATH already

this is new usage

mkdir ~/tmp
cd edl
cp -v prog_emmc_firehose_8953_ddr.mbn ~/tmp
fhloaderparse ~/tmp Loaders
[Asus ZenFone 3 Questions & Answers] optimusodd:
_____________________________________________________________________delete___________________________________________________________________________
[Asus ZenFone 3 Questions & Answers] alecxs:
please download file manually
[Asus ZenFone 3 Questions & Answers] optimusodd:
I am sorry but how to download when it's not listed there ?
[Asus ZenFone 3 Questions & Answers] alecxs:
kindly check the link and look for option to download zip. or click on the file and "view raw" then save as...

https://github.com/bkerler/Loaders/tree/9b90b81

(it looks different on mobile but I am back home in 15 min, can make you screenshot from firefox on pc)

edit: https://codeload.github.com/bkerler/Loaders/zip/9b90b81
[Asus ZenFone 3 Questions & Answers] optimusodd:
Oh so it was in Code drop down menu.Thank you man, I have successfully downloaded it. (y)
[Asus ZenFone 3 Questions & Answers] alecxs:
please download version v3.52 to fit with tutorial

https://github.com/bkerler/edl/releases

updated post #11 (my bad)

edit: sorry for confusing, its all there. new usage is only

(no prefix or suffix)

python3 ./edl.py [anycommand]

edl [anycommand]
[Asus ZenFone 3 Questions & Answers] optimusodd:
No problem ,bash command line and edl.py are quite confusing but now I am getting used to it.I managed to setup bkerler edl tool and dump the whole emmc partitions.

I installed edl 3.52 but don't know why it didn't get extracted and installed automatically.I was getting ModuleNotFoundError: No module named 'edl' error.To install it manually I ran pip install edl but it gave ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output,which I finally resolved by running

$ pip install gevent --pre
$ pip install auto-py-to-exe

I flashed image-new.img but device got bricked with ERROR : Can't Load Invalid Boot Image!!.

Update

: Flashing magisk_patched-23000_dAwIq.img is giving the same error.I restored the backed up boot.img.
[Asus ZenFone 3 Questions & Answers] alecxs:
can you try just unpack + repack boot,img from AIK? scroll down to downloads and extract, you will see it's self-explanatory
[Asus ZenFone 3 Questions & Answers] alecxs:
there is a warning post #2410 I never seen before. seems you are right and downgrade is necessary...

edit:

wget http://archive.ubuntu.com/ubuntu/pool/main/c/cpio/cpio_2.12+dfsg-6_amd64.deb
sudo apt purge cpio
sudo apt install ./cpio_2.12+dfsg-6_amd64.deb
[Asus ZenFone 3 Questions & Answers] optimusodd:
Hello,sorry for the delayed response.I was tested COVID positive.Now I am back in business.

So now I have made my PC dual boot (WIndows + Xubuntu) , downgrading cpio resolved the issue and I successfully unpacked + repacked boot,img without any error but now I am facing issue with EDL.Running lsusb shows that Linux has recognized the device in EDL mode but when I run edl printgpt,it says Command "edl" not found. I have tried running

sudo systemctl stop ModemManager
sudo systemctl disable ModemManager
sudo apt purge ModemManager

to no avail. How do I fix it ? THank you!

View attachment 5579145
[Asus ZenFone 3 Questions & Answers] alecxs:
how to run python script?

python3 path/to/file [args...]

edl(.py) is a python script. suffix doesn't matter
[Asus ZenFone 3 Questions & Answers] optimusodd:
Running

python3 setup.py build
sudo python3 setup.py install

ended with following error.

View attachment 5579171
[Asus ZenFone 3 Questions & Answers] alecxs:
maybe dependencies have changed (Prerequisites Step 2)? kindly refer to github instructions (I copy&pasted from)

what Xubuntu exactly? I can install same distro and double check...
[Asus ZenFone 3 Questions & Answers] alecxs:
tried today on Xubuntu 20.04.2.0 LTS (live iso) both versions install fine. it's just that v3.52 script is called edl.py while for v3.60 it is renamed edl

apt may throw errors on fresh install, if you got this error you need to update repos at least only once

$ sudo apt install adb fastboot python3-dev python3-pip liblzma-dev git
[...]
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
$ sudo apt update
[...]

I have added this to post #11
[Asus ZenFone 3 Questions & Answers] optimusodd:
Distributor ID: Ubuntu Description: Ubuntu 20.04.4 LTS

Release: 20.04 Codename: focal

When I run python --version it gives Python 2.7.18

When I run python3 --version it gives Python 3.8.10

I followed #11 step by step once again and installed everything from scratch and python was installed without giving any error but still facing the same Command "edl" not found issue.

I noticed that on running git clone -b 3.52.1 https://github.com/bkerler/edl.git it says You are in 'detached Head' state.

What does that mean ? Again,should I install Xubuntu again ? Is it coz of dual boot system ? Did Xubuntu updates screw anything ? Thank you!

View attachment 5580341 View attachment 5580343
[Asus ZenFone 3 Questions & Answers] alecxs:
as I said for v3.52 it's edl.py (not edl). I don't know why exactly Björn Kerler decided to rename it.

this will work

./edl.py printgpt
python3 edl.py printgpt

in any case, no need to reinstall linux ever. anything can be fixed. detached Head state just means there exist more recent version
[Asus ZenFone 3 Questions & Answers] optimusodd:
Okay,it's working now.Thank you.I was clueless as well,didn't know that bkerler had renamed it to make whole thing more confusing.

If name of the boot image is 123 ,commands for re-packing (without modifying anything) it for Linux should be ./repackimg.sh 123.bin--origsize and for Windows should be .\repackimg 123.img--origsize.Right ?
[Asus ZenFone 3 Questions & Answers] alecxs:
repackimg does not accept file name as argument, it will autodetect folder by itself (refer to AIK instructions step 4)
[Asus ZenFone 3 Questions & Answers] optimusodd:
So it should be simply ./repackimg.sh --origsize (with a gap between repackimg.sh and -- ) for Linux and .\repackimg --origsize (with a gap betweenrepackimg and -- )for Windows ?
[Asus ZenFone 3 Questions & Answers] optimusodd:
Hello,I unpacked and repacked boot image using both Windows and Linux versions of AIK but it doesn’t work.I Used boot.bin retrieved by QFIL and bkerler edl for Windows AIK and Linux AIK respectively.

What I found baffling is flashing image-new.img , created by Windows version and the one by Linux version lead to different outcomes.

In case of image-new.img created by Windows AIK, phone boots up to DM-Verity in EIO mode screen which after few seconds takes you to a screen that says ERROR : Can’t Load Invalid Boot Image!

In case of image-new.img crerated by Linux AIK,phone boots up to Powered by Android screen for an instant and then screen turns black / shut down.

Windows AIK

Executed .\unpackimg boot.bin to unpack and .\repackimg –origsize to repack.It generated image-new.img which I flashed using QFIL.

View attachment 5601535View attachment 5601537View attachment 5601545

View attachment 5601541

Linux AIK

Ran ./unpackimg.sh boot.bin to unpack and ./repackimg.sh –origsize to repack. It generated image-new.img which I flashed using bkerler edl.

View attachment 5601547View attachment 5601549View attachment 5601551View attachment 5601553

Linux AIK Boot

Watch "Linux AIK Boot" on Streamable.

streamable.com

(Keep reloading if it doesn't load in first attempt)

Please correct me if I have missed out anything.Thank you!
[Asus ZenFone 3 Questions & Answers] alecxs:
Hi, glad you succeed! This is great testing, now you know how it looks like when trying to boot invalid boot.bin (windows) compared to valid signed boot.bin (linux).

Unfortunately the boot-loop is a bit short (less than 1 second) I doubt this is enough time to start adbd. Nevertheless you should try. So next modify default.prop and try to get logcat
[Asus ZenFone 3 Questions & Answers] optimusodd:
Thank you but why would you call boot.bin invalid in case of Windows ? After all it's retrieved via QFIL from eMMC and was signed via Windows AIK,doing it via Linux was just a different option just like doing it on MacOS or on Android.

I am sorry but how do you do it ? I have been digging threads to find out but still clueless.Could you guide me on this? Thank you!
[Asus ZenFone 3 Questions & Answers] alecxs:
different OS, different tools, different result. maybe caused by windows antivir, idk. regarding default.prop refer to post #9 (use linux text editor)
[Asus ZenFone 3 Questions & Answers] optimusodd:
I installed Windows 10 specially for AIK and whole process was completed on clean Windows 10 ,after disabling signature verification ,with Windows security turned off and without any Antivirus or third part program installed.Yes that's why I am also perplexed with 2 different results coming on 2 different OS.I will give it one more try on Linux without --origsize argument and check what happens.Thank you for the information regarding default.prop.(y)
[Asus ZenFone 3 Questions & Answers] kidd024:
Hey,

I want to backup my phone with edl due to lost password.

As I understood my only option is to get the data with said method and restore the device to reset the password attempt counter, then restore.

What would be the steps to do the above?

Also if I save the data, then restore, will I be able to use the os for a while, then restore the previous backup to try the password again ?
[Asus ZenFone 3 Questions & Answers] alecxs:
you need python3 for edl tool, I recommend linux for this. you can temporary boot from pendrive without installing. UNetbootin or Rufus is all you need.

for prerequisites follow post #11

steps are tested and confirmed working on Xubuntu 20.04 LTS 64-bit

edit: what you want is impossible btw
[Asus ZenFone 3 Questions & Answers] kidd024:
I see, what part is the impossible ?
[Asus ZenFone 3 Questions & Answers] alecxs:
you can backup and restore android partitions, and even format device, but you cannot use another android "session" in between. there is another OS on device QTEE which is not accessable to user. factory reset will delete everything in keystore. encryption keys will become invalid forever (at least for FBE)
[Asus ZenFone 3 Questions & Answers] optimusodd:
Hello,sorry for the delayed response.I can confirm that removing --origsize argument makes no difference.

I modified default.prop but it still gives same bootloop (less than 1 second).

On executing adb logcat '*:W' -b all | tee ~/logcat.txt shows - waiting for device - forever.

Is there a workaround ? Thank you!

View attachment 5621077View attachment 5621079
[Asus ZenFone 3 Questions & Answers] alecxs:
you could try to get dmesg as early as possible, but there is nothing mounted so no idea where to save log. lets try cache partition. you need to pack some files in boot ramdisk

https://topjohnwu.github.io/Magisk/guides.html#root-directory-overlay-system

myscript.sh

#!/system/bin/sh
/system/bin/dmesg -w >> /cache/recovery/dmesg.log

(magisk patched boot.img required for overlay.d

or

modify init.rc directly, place myscript somewhere else and hardcode path)

on early-init
start myservice

service myservice /sbin/myscript.sh
oneshot

edit: both is needed, any .rc file and any .sh file, which then execute dmesg (it's like logcat) I hope it's not too confusing.
[Asus ZenFone 3 Questions & Answers] optimusodd:
I am sorry,I tried to research about and comprehend it but it completely went over my head.I am not into Linux.Can you please recommend / provide step-by-step tutorial / instructions , which can guide a layman through this complex mess.It will be greatly appreciated!Thank you!
[Asus ZenFone 3 Questions & Answers] alecxs:
do you have init.rc file in your boot ramdisk?
[Asus ZenFone 3 Questions & Answers] optimusodd:
Yeah,after unpacking boot.bin,it can be located inside ramdisk folder.

View attachment 5642957
[Asus ZenFone 3 Questions & Answers] alecxs:
then edit that file and add service on early-init somewhere below.

next create new file somewhere in ramdisk. file name and path in service must match. example see above

don't forget to set .sh file permission executeable
[Asus ZenFone 3 Questions & Answers] optimusodd:
Add service ? What does that mean ? I have opened file with Atom but have no clue what to do next. How do you create a new file ? I am sorry,I tried to comprehend but it completely went over my head. I am sharing a link ( XDA is not allowing to attach it )to init.rc.PLease have a look.Thank you!

Upload files for free - init.rc - ufile.io

Download init.rc for free from ufile.io instantly, no signup required and no popup ads

ufile.io
[Asus ZenFone 3 Questions & Answers] alecxs:
add these lines to init.rc in ramdisk

create new file myscript.sh in sbin in ramdisk (like you do when creating a text file in windows)

set permission executeable from terminal

cd "/media/optimus/01D82E33678EEF20/AIK Linux/AIK-Linux/ramdisk/sbin"
chmod a+x myscript.sh
[Asus ZenFone 3 Questions & Answers] optimusodd:
Thank you for the explaination.I added start myservice under on early-init in CL #32 but I couldn't find service myservice /sbin/myscript.sh anywhere in init.rc Am I supposed to add service myservice /sbin/myscript.sh and oneshot in CL#34 and CL#35 respectively under on early-init ?

View attachment 5646783 View attachment 5646789

Sorry,I don't understand what to do with this code.In Windows you just right click and create a new text file but in Xubuntu it's not giving any such option to create a new .sh file.I did some research on how to create a shell script here and here but they prefer to use Vim text editor ( I believe it can be done using Atom as well), use " /bin/bash” instead of "/system/bin/sh" after shebang, and run commands like echo hello world and bla bla and that's why I failed to understand how to create it.Can't we just launch Atom and open File > New File > Save As and save the file as “myscript.sh” ? If not , can you make things a bit more clear.Thank you for bearing with me! I really appreciate it!
[Asus ZenFone 3 Questions & Answers] alecxs:
1. add all four lines (whole block of code)

2. yes, use atom
[Asus ZenFone 3 Questions & Answers] optimusodd:
1.View attachment 5646961

2. Launched the Atom, went to File > New File > Save As.Saved the file as myscript.sh.

Moved it to sbin folder.

Opened terminal inside sbin and ran chmod a+x myscript.sh.

View attachment 5646965

Have I done it correctly ? Thank you!
[Asus ZenFone 3 Questions & Answers] alecxs:
Yes, looks good. just the start ueventd line looks like it belongs to the other block. just repack and try if it boot-loops.

next you can get a copy of cache.bin and loop mount (you have done it before). if you find any file dmesg.log in cache/recovery you know the script works
[Asus ZenFone 3 Questions & Answers] optimusodd:
There was a gap before and after start ueventd line.I didn't touch it all.I just inserted

on early-init
start myservice

service myservice /sbin/myscript.sh
oneshot

at line #33.

Here is the original setup.

View attachment 5647123
[Asus ZenFone 3 Questions & Answers] alecxs:
okay, maybe I gave bad advice. you can add your own block of code, but do not add lines in other blocks (for now). as you can clearly see line 17 - 33 is one code block ;)
[Asus ZenFone 3 Questions & Answers] optimusodd:
View attachment 5647621

I re-edited it.Is it okay now ?

I hope 2 seperate blocks starting with the same code on early-init won't create any conflict.
[Asus ZenFone 3 Questions & Answers] alecxs:
yes, that's fine. the on condition can exist multiple times. we might change it to late-init later..
[Asus ZenFone 3 Questions & Answers] optimusodd:
_________________________________
[Asus ZenFone 3 Questions & Answers] optimusodd:
Still getting same boot-loop o_O
[Asus ZenFone 3 Questions & Answers] alecxs:
yes, of course you get same boot-loop. this modification is intended to write dmesg log to cache partition, not to fix boot-loop
[Asus ZenFone 3 Questions & Answers] optimusodd:
Restored boot.bin and ran the commands given above.

Here is the outcome.

View attachment 5650641
[Asus ZenFone 3 Questions & Answers] alecxs:
failed to setup loop device - try to setup manually, then mount the loop device. it's purely linux error shoud not happen. for /dev/loop? insert the correct loop device displayed in the previous command.

(use prefix sudo for running commands with root privileges)

losetup -vf cache.img
losetup -a
mount -t ext4 -vo loop,ro,noexec,noload,noatime /dev/loop? ~/cache