Error trying to flash 8.1 factory image - Google Pixel 2 Questions & Answers

I sideloaded the 8.1 OTA yesterday. However, I'm having issues with my finger print sensor and want to do a clean flash of the whole image. I downloaded the Walleye .011 image file from Google's site this morning. When I attempt to flash the image using the flash-all command, I receive the following error:
wiping userdata...
CreateProcess failed: The system cannot find the file specified. (2)
mke2fs failed: -1
error: Cannot generate image for userdata
I have my bootloader unlocked but am not rooted. The phone is currently on the .011 build but it will not let me flash the image. Any ideas? I've also downloaded the latest platform tools in case that was an issue.
Thanks,
Rick

C5Longhorn said:
I sideloaded the 8.1 OTA yesterday. However, I'm having issues with my finger print sensor and want to do a clean flash of the whole image. I downloaded the Walleye .011 image file from Google's site this morning. When I attempt to flash the image using the flash-all command, I receive the following error:
wiping userdata...
CreateProcess failed: The system cannot find the file specified. (2)
mke2fs failed: -1
error: Cannot generate image for userdata
I have my bootloader unlocked but am not rooted. The phone is currently on the .011 build but it will not let me flash the image. Any ideas? I've also downloaded the latest platform tools in case that was an issue.
Thanks,
Rick
Click to expand...
Click to collapse
Are you running it from the directory where the image is?

C5Longhorn said:
I sideloaded the 8.1 OTA yesterday. However, I'm having issues with my finger print sensor and want to do a clean flash of the whole image. I downloaded the Walleye .011 image file from Google's site this morning. When I attempt to flash the image using the flash-all command, I receive the following error:
wiping userdata...
CreateProcess failed: The system cannot find the file specified. (2)
mke2fs failed: -1
error: Cannot generate image for userdata
I have my bootloader unlocked but am not rooted. The phone is currently on the .011 build but it will not let me flash the image. Any ideas? I've also downloaded the latest platform tools in case that was an issue.
Thanks,
Rick
Click to expand...
Click to collapse
I had the same issue with my 2 XL and it was driving me crazy.
The only way I was able to get the factory image to flash is by removing the -w flag near the bottom of the script. I couldn't figure out what was going wrong and have never needed to modify the script for a factory image to flash.

your problem could be easily solved by restoring factory settings.

have you compared the SHA-256 Checksum hashes? It may/might explain or expose if something is missing...
I mean it's doubtful that you've gone this far where it would be something like that, but you never know... small but won't hurt to try and if that ends up being it, then it's a small thing and keeps you from going all too far...

Thanks for all the replies. I have not compared a checksum yet, but will validate they are the same.
I wanted to flash the whole image as a way to completely clean install the system and my apps. Wouldn't a factory reset only remove my data and configuration settings? If there was an issue with the system files, those wouldn't be fixed, correct?
Thanks,
Rick
Sent from my Pixel 2 using Tapatalk

osi13 said:
I had the same issue with my 2 XL and it was driving me crazy.
The only way I was able to get the factory image to flash is by removing the -w flag near the bottom of the script. I couldn't figure out what was going wrong and have never needed to modify the script for a factory image to flash.
Click to expand...
Click to collapse
How I can do that ( removing the -w flag near the bottom of the script ) pls help

zetareticuli said:
How I can do that ( removing the -w flag near the bottom of the script ) pls help
Click to expand...
Click to collapse
You want to remove the -w flag from flashall.sh or flashall.bat.

osi13 said:
You want to remove the -w flag from flashall.sh or flashall.bat.
Click to expand...
Click to collapse
problem solved i found the (-w) but the problem now is i can't flash or install one ROM to start the process to go out of the bootloop problem.. no recovery mode, i can't install TWRP, the phone are connecting with my comp and i has tryied flash many stock rom's and flash the 4 core.img, but nothing works can you help me??

Related

md5 missing

trying to install http://forum.xda-developers.com/showthread.php?t=2181399 and it says my md5 is missing so there for i cant install the rom... cant figure it out and need to have my phone back.. also backup is failing as well
phatryan69 said:
trying to install http://forum.xda-developers.com/showthread.php?t=2181399 and it says my md5 is missing so there for i cant install the rom... cant figure it out and need to have my phone back.. also backup is failing as well
Click to expand...
Click to collapse
leave both those options unchecked when flashing. You check the MD5 on your PC using an md5 checking application or you can do it with an md5 check app on your phone, but not during flash.
exad said:
leave both those options unchecked when flashing. You check the MD5 on your PC using an md5 checking application or you can do it with an md5 check app on your phone, but not during flash.
Click to expand...
Click to collapse
but if my md5 is missing even b4 i flash what must i do then? cause i thought md5's were added in the file itself.
Read what Exad said and try again.
Turn off md5 checking in recovery and do it manually yourself before flashing.
Sent from my Evita
had no idea htc phones were such a PITA to install and such. long time samsung guy... i thought i did everything right but said failed when i tried to install...
Not really a pain in the ass, I've never had an issue.
So you turned off md5 checking and it still failed?
Did it give an error code?
Which recovery are you using?
Sent from my Evita
---------- Post added at 03:46 AM ---------- Previous post was at 03:22 AM ----------
PS. an md5 is not "added to a file", nor is it "a part of a file". An md5 is merely a hexadecimal readout of the contents of that file.
Here's how it works: A file is created, in our case it is a zip file. The creator or publisher of that file uses an md5 generator to generate the md5sum, which as I said before, is just a numerical readout (like a fingerprint) of the contents of that file. Now the end user has a tool to make sure that the file hasn't been compromised during a download or transfer. Using an md5 checker is a simple way to verify that the file is uncompromised. Input the md5 given by the publisher into an md5 checking app, then the app calculates the md5 of the file you've downloaded, if they match you know the file integrity is good.
Sent from my Evita
I don't find it to be a PITA either...
I mean, if you're rooting.. a lot of this stuff should be familiar or already make sense.
Idk just seems like I'm either missing a step or not doing something right.. I've followed everything I can as far as loading ROMs extracting boot.IMG and flashing in fast boot then booting into recov then flashing like u normally would and everything then pops up and says failed missing md5.. I can get root and everything fine but the minute I get to flashing a ROM I have a problem.. Maybe I needs step back and relook over what I'm doin
Using twrp btw
Sent from my SGH-I927 using xda app-developers app
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using?
Sent from my Evita
what ver. of twrp?
timmaaa said:
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using
i have everything unchecked that could be unchecked yes... and 2.5.0.0
Click to expand...
Click to collapse
phatryan69 said:
timmaaa said:
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using
i have everything unchecked that could be unchecked yes... and 2.5.0.0
Click to expand...
Click to collapse
I would recommend upgrading TWRP to 2.6.0.0. 2.5 had some issues with this phone (mostly with Sense ROMs in my experience). In TWRP > Settings make sure "Zip file signature verification" is unchecked. I think that sets the overall default. Otherwise I think you have to uncheck it each time on the screen where you "Swipe to Confirm Flash".
Click to expand...
Click to collapse
phatryan69 said:
timmaaa said:
So you've definitely disabled md5 check in recovery like suggested right? Which recovery are you using
i have everything unchecked that could be unchecked yes... and 2.5.0.0
Click to expand...
Click to collapse
2.5 has issues.
flash 2.6
then fastboot erase cache
then do a factory reset in twrp
Then try again.
Click to expand...
Click to collapse
having alot of problems with my computer nor recognizing my phone as well it seems... just uninstalled and reinstalled all drivers as well but only in bootloader when it says that trying to send commands to the phone.
installing 2.6
idk what i did but i got my phone on that rom and running...is there a list of fastboot commands somewhere?>
Not that I know of. Some that should work don't work also so... Maybe ill write one up later.
Sent from my HTC One X using xda app-developers app
phatryan69 said:
idk what i did but i got my phone on that rom and running...is there a list of fastboot commands somewhere?>
Click to expand...
Click to collapse
exad said:
Not that I know of. Some that should work don't work also so... Maybe ill write one up later.
Sent from my HTC One X using xda app-developers app
Click to expand...
Click to collapse
Just running "fastboot" will give you a list of sorts, but I don't know that most of those should ever be run by most of us. A list of the useful ones and what they do would be awesome, exad!
Code:
C:\Users\username>fastboot
usage: fastboot [ <option> ] <command>
commands:
update <filename> reflash device from update.zip
flashall flash boot + recovery + system
flash <partition> [ <filename> ] write a file to a flash partition
erase <partition> erase a flash partition
format <partition> format a flash partition
getvar <variable> display a bootloader variable
boot <kernel> [ <ramdisk> ] download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] create bootimage and flash it
devices list all connected devices
continue continue with autoboot
reboot reboot device normally
reboot-bootloader reboot device into bootloader
help show this help message
options:
-w erase userdata and cache (and format
if supported by partition type)
-u do not first erase partition before
formatting
-s <specific device> specify device serial number
or path to device port
-l with "devices", lists device paths
-p <product> specify product name
-c <cmdline> override kernel commandline
-i <vendor id> specify a custom USB vendor id
-b <base_addr> specify a custom kernel base address
-n <page size> specify the nand page size. default: 2048
-S <size>[K|M|G] automatically sparse files greater than
size. 0 to disable
Since moving to cwm i haven't had an issue. I had tons of issues with twrp after 2.3.x.x i moved when cwm got official and haven't changed back. We also latest cwm builds from mdmower i believe the alias is, ill post a link when i get home.
DvineLord said:
Since moving to cwm i haven't had an issue. I had tons of issues with twrp after 2.3.x.x i moved when cwm got official and haven't changed back. We also latest cwm builds from mdmower i believe the alias is, ill post a link when i get home.
Click to expand...
Click to collapse
I've always had cwm might have to try that for a while
Sent from my HTC One X using xda app-developers app
Since TWRP 2.6 was released, I would have a hard time switching. They even made Wiping quicker and easier. I'd take a look at it if I was you. I've seen an issue with someone going from CM to TWRP and no longer being able to mount/access there SD card in TWRP. Dunno who's fault that is but they had to flash over an older non touch CWM and then fastboot erase cache and then flash TWRP. What a pain.

[Q] Flashing stock via fastboot error message

Hi, I want to (re-)flash the stock 4.1.2 rom on my Photon Q, because I recently run into some problems of the phone sending messages to the number 8737 even after I had removed the stock sms app.
This should be the right rsd file:
Code:
asanti_c_sprint-user-4.1.2-9.8.2Q-122_XT897_FFW-5-6-release-keys-cid9.xml.zip (MD5: 88f43a03d313bbcc262db78f15ac957c)
I'm on linux and I don't have any Windows system I could install and run RSDLite on. So I decided to take the fastboot way: I unzipped the above file and tried flashing the rom manually. But I always run in to the following error output:
Code:
# fastboot flash cdrom cdrom
(bootloader) Variable not supported!
target reported max download size of 31457280 bytes
Invalid sparse file format at header magi
error: write_sparse_skip_chunk: don't care size 22923264 is not a multiple of the block size 4096
fastboot: ../libsparse/sparse.c:143: write_all_blocks: Assertion `pad >= 0' failed.
Note that "fastboot devices" lists the Photon Q as "T069503UAP fastboot". The same or a similar error messages applies to "fastboot flash system system.img" etc. I use fastboot from the Fedora 20 "android-tools" package (version 20130123git98d0789-2).
Any ideas what's the problem here? Solution?
Thanks in advance!
It's dangerous to try and fastboot the items yourself. Would be better to borrow a Windows PC or something to use RSD (virtual machines are also NOT recommended for this).
But perhaps you should just try to fastboot the other partitions. Not sure 'cdrom' is needed. Either way, I strongly, STRONGLY advise against doing what you are doing.
Okay, thanks for your advice!
The same or similar error messages appear when flashing the other partitions (as already mentioned in the first post). Unfortunately, it's really hard to find somebody with a Windows system, at the moment. I thought RSDLite uses fastboot internally anyway.
I'm not sure if the FXZ images can be flashed as they are, via fastboot.
I believe they should be converted to the standard ext4 format via the simg2img.py pytoon script, before being usable.
I repeat I'm not sure, but I believe that hardly motorola's own format is handled correctly by the fastboot command.
Whatever, for your convenience, I attach the mentioned converter script.
Aside fastboot, can be used for a variety of other purposes, the ext4 images can be mounted straight in Linux via loopback device or extracted in windows with a bunch of tools, personally I use Ftk Imager.
Thanks, that tool is great! After conversion, I was indeed able to mount the system partition as follows:
Code:
# mount -o ro,loop system_converted.img /some/mnt/path
But it doesn't help with the other files (cdrom, boot.img, recovery.img), because they seem to have a different format. However, the system partition was all I wanted. Now, instead of reflashing, I'm going to compare the system partition's files (especially in the "app" folder) and see what might have caused my problem.
tuxor1337 said:
But it doesn't help with the other files (cdrom, boot.img, recovery.img),
Click to expand...
Click to collapse
The boot, recovery and similar partitions aren't written on top of a filesystem like /system or /data.
they are written as they are on top of the physical media.
you can safely flash them in any way: fastboot, restore by recovery and so on.
unlike the filesystem based partitions, they are always in the same format.
If you need to edit the boot or recovery content you need a special script to unpack and repack them, many android kitchens have it
I was just wondering whether flashing on Linux will work when using "moto fastboot" like this one: http://forum.xda-developers.com/showthread.php?t=1138092
I don't really need this functionality anymore. But out of curiosity: What do you think?
My photon has a broken USB connector, so I can't test it in first person.
Btw, I believe that testing is the only way to understand what is flashable and what not, obviously taking handy a good full nandroid backup.

Lost cache partition fixed

Hi,
I got the terrible error "mounting cache failed" blabla and my Nexus 5 was dead. I tried with all ways I could find: fastbook flash cache cache.img; flashing factory image; LG Flashtool and TOT flashing, etc. All did not work.
But finally I found out the reason and made my Nexus 5 back to work.
The reason is simple: my cache partition should be EXT2 (or EXT4) but for some reason its type is unknown. That caused the mounting failed.
You could check your partition tables like:
adb shell parted -s /dev/block/mmcblk0 print
Keep an eye on your cache partition (27) type. Bingo, you can fix it if its type is blank!!
Fix the type (in the shell):
1) boot into recovery mode
1.1) adb shell
1.2) mkfs.ext2 /dev/block/mmcblk0p27
1.3) exit
2) boot into Fastboot
Flash the factory image (flash-all.sh) is the simplest way to make sure all works. Or simply flash the cache.img
fastboot flash cache cache.img
Reboot and you will see your Nexus 5 is back.
Good luck.
Yu
http: // clashin.com/
zhudachang said:
Hi,
I got the terrible error "mounting cache failed" blabla and my Nexus 5 was dead. I tried with all ways I could find: fastbook flash cache cache.img; flashing factory image; LG Flashtool and TOT flashing, etc. All did not work.
But finally I found out the reason and made my Nexus 5 back to work.
The reason is simple: my cache partition should be EXT2 (or EXT4) but for some reason its type is unknown. That caused the mounting failed.
You could check your partition tables like:
adb shell parted -s /dev/block/mmcblk0 print
Keep an eye on your cache partition (27) type. Bingo, you can fix it if its type is blank!!
Fix the type (in the shell):
1) boot into recovery mode
1.1) adb shell
1.2) mkfs.ext2 /dev/block/mmcblk0p27
1.3) exit
2) boot into Fastboot
Flash the factory image (flash-all.sh) is the simplest way to make sure all works. Or simply flash the cache.img
fastboot flash cache cache.img
Reboot and you will see your Nexus 5 is back.
Good luck.
Yu
http: / / justcoolthings.net
Click to expand...
Click to collapse
Just want to say thank you for these steps! It fixed my phone as well and saved my sanity! LOL
5.1 OTA Update Screwed My Nexus 5
zhudachang said:
Hi,
I got the terrible error "mounting cache failed" blabla and my Nexus 5 was dead. I tried with all ways I could find: fastbook flash cache cache.img; flashing factory image; LG Flashtool and TOT flashing, etc. All did not work.
But finally I found out the reason and made my Nexus 5 back to work.
The reason is simple: my cache partition should be EXT2 (or EXT4) but for some reason its type is unknown. That caused the mounting failed.
You could check your partition tables like:
adb shell parted -s /dev/block/mmcblk0 print
Keep an eye on your cache partition (27) type. Bingo, you can fix it if its type is blank!!
Fix the type (in the shell):
1) boot into recovery mode
1.1) adb shell
1.2) mkfs.ext2 /dev/block/mmcblk0p27
1.3) exit
2) boot into Fastboot
Flash the factory image (flash-all.sh) is the simplest way to make sure all works. Or simply flash the cache.img
fastboot flash cache cache.img
Reboot and you will see your Nexus 5 is back.
Good luck.
Yu
http: // clashin.com/
Click to expand...
Click to collapse
Hi Yu,
I have the same problem as you mention above, occured after i had the office 5.1 OTA update 3 days back.
After updating, i was able to play with my phone for a while.. The next day, it was in a boot loop state with the "Google" image on my device.
I am able to ADB into my phone, and adb devices returns me my deviceId and sideload.
But when i attempt this command "adb shell" i get "error: closed".. Been searching the net to find out how to open this so i can do the fix, but none so far....
Any idea how to sort this out? Many thanks in advance.
p/s: my device is stock STOCK... non-unlock and non-rooted.
Cheers,
Keith
I would suggest you do a "flash-all" to your device.
1) Download the factory image ("hammerhead-lmy47i") from https: // developers.google.com /android/nexus/images
2) Boot your device into bootloader mode and run "flash-all.sh" to flash the 5.1 factory rom. It should fix all your errors.
Good luck.
Yu
liquanize said:
Hi Yu,
I have the same problem as you mention above, occured after i had the office 5.1 OTA update 3 days back.
After updating, i was able to play with my phone for a while.. The next day, it was in a boot loop state with the "Google" image on my device.
I am able to ADB into my phone, and adb devices returns me my deviceId and sideload.
But when i attempt this command "adb shell" i get "error: closed".. Been searching the net to find out how to open this so i can do the fix, but none so far....
Any idea how to sort this out? Many thanks in advance.
p/s: my device is stock STOCK... non-unlock and non-rooted.
Cheers,
Keith
Click to expand...
Click to collapse
liquanize said:
Hi Yu,
I have the same problem as you mention above, occured after i had the office 5.1 OTA update 3 days back.
After updating, i was able to play with my phone for a while.. The next day, it was in a boot loop state with the "Google" image on my device.
I am able to ADB into my phone, and adb devices returns me my deviceId and sideload.
But when i attempt this command "adb shell" i get "error: closed".. Been searching the net to find out how to open this so i can do the fix, but none so far....
Any idea how to sort this out? Many thanks in advance.
p/s: my device is stock STOCK... non-unlock and non-rooted.
Cheers,
Keith
Click to expand...
Click to collapse
Keep in mind that STOCK recovery does NOT let you connect to normal ADB, a custom recovery does. Also, you need to be root to 'mkfs.ext2', and the target partition must not be mounted, I believe.
Before attempting the steps @zhudachang posted below, i.e. To flash a factory image, you need to unlock your bootloader.
zhudachang said:
I would suggest you do a "flash-all" to your device.
1) Download the factory image ("hammerhead-lmy47i") from https: // developers.google.com /android/nexus/images
2) Boot your device into bootloader mode and run "flash-all.sh" to flash the 5.1 factory rom. It should fix all your errors.
Good luck.
Yu
Click to expand...
Click to collapse

[TOOL] KDZ Writer

Tool for writing portions of KDZ files to LG devices. As long as KDZ files for the particular device are available and LGE doesn't change the format in an incompatible fashion, this will handle upgrades. Presently this tool targets the format as is used with UFS devices. The LG G5 and LG V20 are examples; the G6 and V30 may turn out to be compatible.
KDZ files are available for several LG V20 variants. Notably H918TN (US T-Mobile), H990 (non-US single-SIM), H990DS (non-US dual-SIM), H990N (Korea dual-SIM), US996 (US unlocked), and VS995 (US Verizon).
The primary goal of this tool is updating /system and /firmware, though updating other areas is in theory possible.
XDA:DevDB Information
KDZ Writer, Tool/Utility for the LG V20
Contributors
emdroidle
Source Code: https://github.com/ehem/lg-v20-tools
Instructions
Boot into TWRP. Upload an appropriate KDZ for your phone somewhere on your phone. This can be on a SD card, since all known KDZ files are just under 3GB even TWRP's in-memory filesystem is sufficient. Download(the Downloads tab, above), and upload kdzwriter to your phone:
Code:
adb push kdzwriter.gz /
Then in a shell (`adb shell`):
Code:
gunzip -c /kdzwriter.gz >/sbin/kdzwriter
chmod 755 /sbin/kdzwriter
[STRIKE]umount /system
ln -s /sbin /system/bin[/STRIKE]
The `umount` command may give an error. If you're on TWRP 3.0.2-1 /system won't have been mounted and you'll get "invalid argument"; if you get an error saying "busy" there is a problem. If using version 1.95 or later, the second two commands are unnecessary.
From here you can invoke `kdzwriter` with various arguments to write /system and /firmware:
-v
Increase verbosity. At lower levels not too much is added, at level 3 `kdzwriter` starts gushing debugging information.
-r
Report mode, tells you about how the chunks in the KDZ file match your phone.
-t
Test mode, tells you whether `kdzwriter` has decided the KDZ is an appropriate match for your phone (safety check). If used with other options, `kdzwriter` will run through the write procedure and tell you whether all the steps succeed.
-a
Write areas known safe to apply to the device. As of right now this is /system, /firmware and /cust. (equivalent to -s -m -a)
-s
Write /system. If you only want to update /system, this is the option for you. By default -s will attempt to preserve the kernel modules present on /system and overwrite the ones on the new /system image with those. This is appropriate if you've installed a custom kernel.
-M
Disables preserving kernel modules from the current /system. If you've got a stock kernel you want this option. If /system has been corrupted, this also avoids mounting /system and ensures -s succeeds.
-m
Write /firmware (aka modem).
-c
Write /cust. Some files of these files appear related to VoLTE. I'm unsure whether they're critical or optional. One (seemingly harmless) error message generated when switching regions can be avoided by writing this area.
-k
Write boot (/dev/block/bootdevice/by-name/boot). If you're opting to stay with the stock kernel then you'll want this option. This can also be used to recover from a failed Magisk/SuperSU/Superuser installation.
-P
GPT restoration mode. If a "ROM" has modified the GPTs this will attempt to restore them closer to stock. There are plans to have LineageOS do just this, so I wanted to be prepared to return to stock.
-R
Modified GPT restoration mode. "userdata" is moved closer to the begining of the device potentially allowing additional data to be merged without needing to wipe.
The most common invocation will be `kdzwriter -a <some location>/<KDZ_for_your_device>.kdz`, as noted you can use "-at" to simulate the process and confirm no errors occur.
The -b option has been allocated, but are not yet implemented. A deliberate attempt to minimize flash wear has been made. Blocks will not be rewritten if possible. Empty areas will be discarded/TRIMed.
`kdzwriter` attempts to preserve some files when writing areas. When writing /system unless -M is specified, `kdzwriter` will attempt to preserve kernel modules. When writing /cust, `kdzwriter` attempts to preserve "official_op_resize.cfg" (see GPT restoration mode for details). There are plans for v2.0 to try to preserve the contents of "open_path_mapping.cfg" and "op_list.cfg".
If you get an error message about "Failed while writing /system, major problem, PANIC!" this is most likely to be caused by a corrupt KDZ file. In this case retrying the download is the most likely solution.
Apparently for some devices/KDZ files it is necessary not to skip too many revisions. Notably going from H990N version 10b to version 10o does not work; instead you need to do 10b -> 10e ->10o. This hasn't yet been observed on other devices, but beware big skips can fail.
GPT Restoration mode
There are plans to have a future version of LineageOS hack off a piece of /system to utilize as /vendor. This is reasonable for LineageOS (or another "ROM"), but a problem if you desire to return to stock. As such v1.95 has been brought out which features the ability to restore the GPTs.
Crucial item: In the interest of safety this operation demands a KDZ which is a better match for your device! You will need to use a KDZ file matching what your device was at when you initially rooted! (H990ds10b* or so for most devices)
You can confirm whether a given KDZ is appropriate using the "-t" option. If `kdzwriter -t <someKDZfile>.kdz` gives the message "KDZ appears applicable to this device" then kdzwriter will not use that file for this operation, that command must give the output "KDZ appears applicable to this device and matches original" in order to be acceptable for this operation.
On the H990 some space is stolen from userdata for use as /OP. Everything in /OP appears to be bloatware, but since I'm trying to make it possible to go back close to stock, I've got to do something about /OP. The size of /OP is controlled by the file "/cust/official_op_resize.cfg". As I didn't have a better way of handling it, I simply grab the first line and use that. If /cust is unavailable (hasn't been restored?) a size of 0 will be assumed. If a size of 0 is found, `kdzwriter` will wipe the slice^Wpartition and the space will in fact end up as part of /data (hint, hint).
Important note: Since the normal order is system, cache, cust, OP then userdata, modifying the size of /OP will require wiping /data!
The -R option restores a modified GPT. The modified GPT mode tries to reorders the slices^Wpartitions as userdata, OP, cust, system, cache. The theory is that if cust isn't needed in LineageOS, cust could be removed from the GPT and the space merged into userdata. Since userdata is then first, it could be enlarged without the need to wipe and restore.
Examples
I expect by far the most common usage to be `kdzwriter -a <somekdz>.kdz`, but as typed there extra flags for certain situations:
Recovering from bad flash attempt -sM
If there was a problem when attempting to write /system there is a decent chance it won't be possible to mount /system for saving kernel modules. In this case using `kdzwriter -sM <somekdz>.kdz` is your need. This skips mounting /system at the cost of being unable to preserve kernel modules, you will need to reinstall whatever kernel you were using.
Partial unrooting -k
If you want to switch between Magisk, SuperSU, and Superuser this is your need. `kdzwriter -k <somekdz>.kdz` overwrites the boot/kernel area with the image from the KDZ file. Your next step will likely be to reinstall whatever kernel you were using. Afterwords all traces of a systemless install will have been wiped and you can install a different `su` implementation.
Going mostly back to stock -ak
For owners of the V20s where the stock kernel works, you can use a combination of these two options to update /system and to a newer kernel (you don't want to be hit by DirtyCOW). After doing this you'll need to reinstall whichever `su` implementation you were using.
Version Information
Status: Stable
v1.98a
Identified which check was preventing installation of 20a KDZ files. That is now disabled. There is also a force option which will override the safety check, but please be careful. That safety check was written to try to make it hard to generate bricks...
v1.98
Implemented modified GPT restoration mode. This mode reorders the slices^Wpartitions during restoration. This allows for potentially merging more space into /data without needing to wipe /data again.
v1.95
Found the appropriate compiler flag for setting the runtime linker. Thanks to the TWRP folks, kdzwriter is now a bit easier to use.
Implemented GPT restoration mode. This allows for restoring modified GPTs back to stock. This is valuable if a "ROM" has modified the GPTs. Given how there are plans to have LineageOS do just that, I'm figuring a number of people may be rather interested in this feature.
v1.3
Fixed testing for whether a KDZ is applicable to the device. This should merely be a safety precaution, but I need it there so I don't get fingers pointed my way on failure.
Finally tracked down the issue with kernel module preservation. This is a really stupid bug. There should no longer be any need to reinstall modified kernels after updates!
v1.2
Added additional debugging information around calls to Zlib. There has been a report of difficulty around Zlib so extra information is available. Some of this is only available at verbosity level 3 though.
Created 2017-07-31
Last Updated 2019-01-02
v1.2
MD5: 49b06410f8f90606f9829cc8ff8ed82a
SHA1: ce1f84f579c94e788539e462febc2f2e293a64ff
SHA512: 47a94ae6c6d1157dd406319d2d44ba72c9f954c3f0ad6b892eafbb818d01a7bf9c14b0a9f01ab6f092c07537d3273f8981b83c80ebf67f2cf9e33c26f8838ad3
v1.3
MD5: a412c7fe58722b6e63560c5074bc59b7
SHA1: 8e7e1fbd2edef0ff10516c57a84b642a1a92a758
SHA512: a5b9d3a66bf4237138264a5756f1637ba849a3aeb78d935e0fe6033486de41ad56a0ca5c62b3d94546fd2b4fe86e9edf7958e80481f1f10ef7ef2b6b562a412a
v1.95
MD5: 5f8797b5829ca5a919d1d685404a2726
SHA1: 62d7476ec50a2ea3a682b86654dd1ddc03da0c24
SHA512: ee717f3803e43862dc6faac3788e16267d9661bf98f8fdeebedd6b871dcd4cadb7dc4ee5208dc6072f5f7ba44e46440a759425536a354b530584f824570283c7
v1.98
MD5: 7dfee90d7e0711f5742b94efb81a8b18
SHA1: f020345935b078ebc336e88e3b0623e0792f71ad
SHA512: 71e82f535d33cc64fe023425db0b6d924c6d11677b04843628a9c6ca90cc6700d0a6c5e868c964e31d54f7d3c835d9ecd3b6c33108926da29e75e3be3e1456b2
v1.98a
MD5: 31f207a865b453472271eed29544833e
SHA1: 42ab0486cfc100b52dde9c6bac9bca684eccfde2
SHA512: fe127bece0e25ae4927f3499d708d1533b5fe0a00513de9cb8565ffc24b3e4ee08e9000d828a0177feb4b3b449137836b63cda72cf178b5cd67ae377997a1d37
@emdroidle I'm getting "permission denied" from KDZWriter when I execute the kdzwriter -a /external_sd/H990_something.kdz command in TWRP Terminal. I noticed that I can't umount /system either, it says it's an invalid argument?
Would this be something to do with the locking of /system I read about earlier? I did try manually mounting /system in TWRP before trying anything too, but that doesn't seem to have helped at all.
I've also tried doing mount -o rw,remount,rw /system
I'm running rooted 10C-TWN firmware with Magisk (interestingly, phone will flat out refuse to boot if I flash SuperSU, so Magisk it is). When I go to install Magisk it says "mounting /system" with no problems at all
Thanks very much for your work.
Iam confused about the instructions im not very familiar with adb shell . can you please elaborate more the steps for easy running of kdzwriter. thank you and let me tell you that you are awesome
Where is kdzwriter.gz? No attachment? Works kdzwriter from Dirty Santa thread?
i am getting kdzwriter: permission denied
iDefalt said:
I'm running rooted 10C-TWN firmware with Magisk (interestingly, phone will flat out refuse to boot if I flash SuperSU, so Magisk it is). When I go to install Magisk it says "mounting /system" with no problems at all
Click to expand...
Click to collapse
My first attempt to install Magisk failed, "Unable to repack ramdisk". At which point I had a problem. Suddenly the "-k" option came into existence and a retry succeeded.
iDefalt said:
@emdroidle I'm getting "permission denied" from KDZWriter when I execute the kdzwriter -a /external_sd/H990_something.kdz command in TWRP Terminal. I noticed that I can't umount /system either, it says it's an invalid argument?
Would this be something to do with the locking of /system I read about earlier? I did try manually mounting /system in TWRP before trying anything too, but that doesn't seem to have helped at all.
I've also tried doing mount -o rw,remount,rw /system
Click to expand...
Click to collapse
Okay, I guess I'm not that great at writing instructions. The added `chmod` will fix the "permission denied" error.
The `umount` is more an issue if you've updated to TWRP 3.1.1-0 which does successfully mount /system, whereas TWRP 3.0.2-1 didn't. The "invalid argument" is saying it isn't mounted and you can simply proceed. It is a problem if it says "busy". In this case you would get an error "Failed mounting system for kmod saving: <message>", then "kdzwriter: Failed while reading kernel modules" and `kdzwriter` wouldn't proceed.
Also replace "/external_sd/H990_something.kdz" with the filename/where you installed it (did you really rename the KDZ file to H990_something.kdz?).
dadme said:
Where is kdzwriter.gz? No attachment? Works kdzwriter from Dirty Santa thread?
Click to expand...
Click to collapse
Notice the "Download" tab at the top of this thread?
does anyone have the link to TWRP 3.1.1-0 for the h990ds? My device didn't seem to like the command 'kdzwriter -a /external_sd/H990ds10f_00_OPEN_TW_DS_OP_0622.kdz' I received the error "Failed while writing /system, major problem, PANIC!" . It's in a bootloop now should have run '-at' first!
second attempt...
You have to try harder than that message to make me panic
i figure my 10f kdz must be corrupt, so tried 10e
kdzwriter -a /external_sd/H990ds10e_00_OPEN_TW_DS_OP_0517.kdz
errors recieved were:
Failed mounting system for kmod restoring: Invalid argument
kdzwriter: Failed while restoring kernel modules, recommend kernel reinstall!
I reinstalled the kernel. Not sure what the kmod error means?
Anyway android upgraded and works a charm. Didn't fix my camera focus issue but i guess that must be down to the kernel.
Thanks for this awesome tool emdroidle, are you taking donations?
Sorry, Emdroidle i use classic theme, so download tab is not visible. Can use this TWRP https://forum.xda-developers.com/v20/development/recovery-twrp-3-1-0-0-touch-recovery-t3603760, elsa version? TWRP can be updated from TWRP 3.0.2.1 or from fastboot?
Got this on 10f H990DS TWN,
Failed mounting system for kmod restoring: Invalid argument
kdzwriter: Failed while restoring kernel modules, recommend kernel reinstall!
Finished rewrite of system area
Begining rewrite of modem area
ooo...ooo.oooooooo.ooooo...oooooooo.o*
Finished rewrite of modem area
dadme said:
Sorry, Emdroidle i use classic theme, so download tab is not visible. Can use this TWRP https://forum.xda-developers.com/v20/development/recovery-twrp-3-1-0-0-touch-recovery-t3603760, elsa version? TWRP can be updated from TWRP 3.0.2.1 or from fastboot?
Got this on 10f H990DS TWN,
Failed mounting system for kmod restoring: Invalid argument
kdzwriter: Failed while restoring kernel modules, recommend kernel reinstall!
Finished rewrite of system area
Begining rewrite of modem area
ooo...ooo.oooooooo.ooooo...oooooooo.o*
Finished rewrite of modem area
Click to expand...
Click to collapse
Either TWRP should work, just there is a small behavior difference. TWRP 3.0.2-1 has a small bug and never manages to mount /system; while TWRP 3.1.1-0 does manage to mount /system. With 3.0.2-1 the `umount /system` can be skipped, with 3.1.1-0 that command needs to be run before /system is upgraded.
Mars104 said:
does anyone have the link to TWRP 3.1.1-0 for the h990ds? My device didn't seem to like the command 'kdzwriter -a /external_sd/H990ds10f_00_OPEN_TW_DS_OP_0622.kdz' I received the error "Failed while writing /system, major problem, PANIC!" . It's in a bootloop now should have run '-at' first!
second attempt...
You have to try harder than that message to make me panic
i figure my 10f kdz must be corrupt, so tried 10e
kdzwriter -a /external_sd/H990ds10e_00_OPEN_TW_DS_OP_0517.kdz
errors recieved were:
Failed mounting system for kmod restoring: Invalid argument
kdzwriter: Failed while restoring kernel modules, recommend kernel reinstall!
I reinstalled the kernel. Not sure what the kmod error means?
Click to expand...
Click to collapse
Well seeing that "PANIC" message means something rather problematic occurred, and the state of /system is Bad(tm).
"kmod" is short for "kernel module". The Linux kernel has the capability to load/unload extra bits of code (generally drivers) while the kernel is running. These are specific to the particular kernel and trying to load modules for the wrong kernel could fail or cause problems.
I was surprised to learn the Bluetooth and FM Radio drivers are modules, as well as the exfat filesystem is a module. The userspace portion of talking to the Bluetooth chip won't load unless it successfully loads "brcm_bt_drv.ko" into the kernel.
The kernel modules are located in /system/lib/modules. When writing /system, `kdzwriter` first tries to mount /system and save copies of the modules. Once /system has been rewritten it tries to restore them. If either of those steps fails, there is need to reinstall the kernel since the modules on /system will match LG's stock kernel, not the static-fixed kernel I built.
Mars104 said:
Thanks for this awesome tool emdroidle, are you taking donations?
Click to expand...
Click to collapse
Well I don't send them back.
emdroidle said:
The added `chmod` will fix the "permission denied" error. (did you really rename the KDZ file to H990_something.kdz?).
Click to expand...
Click to collapse
Haha no mate I didn't, was just using the name for the KDZ from your example
Just wanted to say thanks as well. Used your tool with the updated instructions. Booted into TWRP, plugged into PC, used ADB from Command Prompt to do the whole thing. Went perfectly. It gave me a line when it was done about recommending a kernel re-install, so once the tool was finished I re-flashed the H990 kernel zip from your other thread, Magisk, the latest Aroma GAPPS package, and then rebooted. After the optimization process, I'm now on V10F-TWN with a patch date of 1st June, and rooted.
It's a touch of a process to get to this point, but if you follow everything properly to the letter, it works. Cheers mate.
i rename my kdz into "some.kdz" i run kdzwriter -at /external_sd/some.kdz itsays : Next chunk starts beyond end of file, Failed to open KDZ file, aborting what does this mean thank you
iDefalt said:
Haha no mate I didn't, was just using the name for the KDZ from your example
Click to expand...
Click to collapse
Okay, fine. I just wanted to make sure since there are people who don't realize you're supposed to adapt the name and complain when things don't work. Just one of those things that makes one go wait-a-minute...
kuachi00 said:
i rename my kdz into "some.kdz" i run kdzwriter -at /external_sd/some.kdz itsays : Next chunk starts beyond end of file, Failed to open KDZ file, aborting what does this mean thank you
Click to expand...
Click to collapse
Most likely you don't have the full file. Were you downloading it and the download got interrupted?
Success! Upgraded to 10f with root
emdroidle
Can you please make a small tool that extract the content of the KDZ file and the system.img file to modify things with ease on PC, and can easier interchange between versions to see what bugs can be avoided....
zinou213 said:
emdroidle
Can you please make a small tool that extract the content of the KDZ file and the system.img file to modify things with ease on PC, and can easier interchange between versions to see what bugs can be avoided....
Click to expand...
Click to collapse
There already are tools for this. https://github.com/Bigcountry907/kdztools and https://forum.xda-developers.com/showthread.php?t=2600575
Though I'm not sure they are completely compatible with the newest kdz's. Simple extraction should work.
-------
Nice tool btw. Now if only it where possible to flash kdz's directly in EDL mode, that would be great !!
askermk2000 said:
There already are tools for this. https://github.com/Bigcountry907/kdztools and https://forum.xda-developers.com/showthread.php?t=2600575
Though I'm not sure they are completely compatible with the newest kdz's. Simple extraction should work.
-------
Nice tool btw. Now if only it where possible to flash kdz's directly in EDL mode, that would be great !!
Click to expand...
Click to collapse
Thank you, I know this tools but i want a confirmation about there compatibility with v20's KDZs, and what is the EDL mode you talk about ??
zinou213 said:
Thank you, I know this tools but i want a confirmation about there compatibility with v20's KDZs, and what is the EDL mode you talk about ??
Click to expand...
Click to collapse
That last part was not for you specifically. It's Sahara Download Mode, or Emergency Download Mode I was talking about, something you probably won't know much about until you brick your phone
askermk2000 said:
That last part was not for you specifically. It's Sahara Download Mode, or Emergency Download Mode I was talking about, something you probably won't know much about until you brick your phone
Click to expand...
Click to collapse
OK Sahara Download Mode i know, i saw this with my old bricked gflex 2 that i unbricked with too many tools and processes that i forget now...
why is it that only the android security patch has been changed and the version is still v10e iam trying to upgrade to v10g thanks
---------- Post added at 11:09 PM ---------- Previous post was at 10:47 PM ----------
also my cpu load is alway going 90 to 100 percent even tho im not using any app did not also do cpu adjustments . it drains my battery fast
@emdroidle
Your donation button doesn't work:
We cannot process this transaction because there is a problem with the PayPal email address supplied by the seller. Please contact the seller to resolve the problem. If this payment is for an eBay listing, you can contact the seller via the "Ask Seller a Question" link on the listing page. When you have the correct email address, payment can be made at www.paypal.com.
Click to expand...
Click to collapse

Did i just killed my ONE for good

Hello everyone,
i just wantet to wipe my old OPO to give it to my son. But in the process i accidently wiped the system partition and are now without any working phone.
i tried to flash an image via recovery and via fastboot. Both without success.
I downloaded a fastboot flashable rom from here but after flashing the system.img the phone still wont boot.
tried to flash boot.img as well but i get this error:
Code:
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
when i try to flash the regular .zip from the oneplus page i get an error: This package is for: bacon,A0001 This Device is .
I tried to flash via adb sideload and pushed the file via adb push on the phone, but same error.
any suggestions how to save my good old ONE to give it a second live in the hands of my son?
Do you have a nandroid backup yo restore? That should fix it if you have access to recovery
patlabor said:
Hello everyone,
i just wantet to wipe my old OPO to give it to my son. But in the process i accidently wiped the system partition and are now without any working phone.
i tried to flash an image via recovery and via fastboot. Both without success.
I downloaded a fastboot flashable rom from here but after flashing the system.img the phone still wont boot.
tried to flash boot.img as well but i get this error:
Code:
fastboot: core/libsparse/sparse.cpp:131: int write_all_blocks(struct sparse_file *, struct output_file *): Assertion `pad >= 0' failed.
when i try to flash the regular .zip from the oneplus page i get an error: This package is for: bacon,A0001 This Device is .
I tried to flash via adb sideload and pushed the file via adb push on the phone, but same error.
any suggestions how to save my good old ONE to give it a second live in the hands of my son?
Click to expand...
Click to collapse
I had the same problem when I tried flashing TWRP K1. Regular TWRP flashed fine.
Oh, if you're using Linux then make sure your udev rules are set up properly. On Arch I needed to install an extra package otherwise adb/fastboot was a bit janky

Categories

Resources