[GUIDE] Posible fix for CM-12 flashing errors: Convert from GPE to Retail. - Moto G General

NOTICE: THIS IS ABOUT: "Error executing updater-binary" while flashing CM-12 or Lollipop based ROMs. Check you recovery log to find EXACTLY WHAT HAPPENED, if you have bugs related to lseek64 and blkdiscard. Then THIS IS PROBABLY RELATED TO YOUR PROBLEM. OTHERWISE, IT IS NOT RELATED TO THIS, STAY AWAY.
To check your recovery logs. On TWRP -> Advanced -> Copy Log to SD after trying to flash - > Inspect the Log on your computer and search for blkdiscard or lseek64 and errors around them.
Here is the usual disclaimer about how I blame you for bricking your device by doing risky stuff, and by reading this you acknowledge you are doing this at your own risk. And if you point me, blaming me for you destroying your own device, I'll laugh at you. Yada yada yada.
As far as I know, this fixed it for me, so I am sharing it.
This started with the findings of @murderered, so go thank him.
Original post from him:
murderered said:
Is the installation currently broken? Or am i doing something wrong? Formatted system as ext4, wiped all caches, data and accidently also the user data (having a backup, so no problem).
Code:
Formatting system using make_ext4fs function.
Creating filesystem with parameters:
Size: 880803840
Block size: 4096
Blocks per group: 32768
Inodes per group: 7680
Inode size: 256
Journal blocks: 3360
Label:
Blocks: 215040
Block groups: 7
Reserved block group size: 55
Created filesystem with 11/53760 inodes and 6965/215040 blocks
warning: wipe_block_device: Wipe via secure discard suppressed due to bug in EMMC firmware
Updating partition details...
I:Data backup size is 0MB, free: 12611MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Set page: 'action_complete'
I:Set page: 'clear_vars'
I:Set page: 'refreshfilesystem'
I:getpartitiondetails list '/system;'
I:getpartitiondetails wipe_path '/system'
I:Set page: 'selectfilesystem'
I:Set page: 'partitionoptions'
I:Set page: 'advancedwipe'
I:Set page: 'action_page'
I:wipe list 'DALVIK;/data;/cache;'
I:wipe_path 'DALVIK'
Wiping Dalvik Cache Directories...
-- Dalvik Cache Directories Wipe Complete!
I:wipe_path '/data'
Wiping data without wiping /data/media ...
Done.
I:wipe_path '/cache'
Formatting cache using make_ext4fs function.
Creating filesystem with parameters:
Size: 587202560
Block size: 4096
Blocks per group: 32768
Inodes per group: 7168
Inode size: 256
Journal blocks: 2240
Label:
Blocks: 143360
Block groups: 5
Reserved block group size: 39
Created filesystem with 11/35840 inodes and 4616/143360 blocks
warning: wipe_block_device: Wipe via secure discard suppressed due to bug in EMMC firmware
I:Recreating /cache/recovery folder.
I:Copying file /etc/recovery.fstab to /cache/recovery/recovery.fstab
I:Version number saved to '/cache/recovery/.version'
Updating partition details...
I:Data backup size is 0MB, free: 12611MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Set page: 'action_complete'
I:Set page: 'clear_vars'
I:Set page: 'advancedwipe'
I:Set page: 'wipe'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'mount'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'advanced'
I:Set page: 'sideload'
I:Set page: 'action_page'
Starting ADB sideload feature...
BOARD_HAS_NO_REAL_SDCARD := true
RECOVERY_SDCARD_ON_DATA := true
TW_NO_USB_STORAGE := true
I:TW_BRIGHTNESS_PATH := /sys/devices/fd900000.qcom,mdss_mdp/qcom,mdss_fb_primary.148/leds/lcd-backlight/brightness
I:Found brightness file at '/sys/devices/fd900000.qcom,mdss_mdp/qcom,mdss_fb_primary.148/leds/lcd-backlight/brightness'
I:TWFunc::Set_Brightness: Setting brightness control to 255
Starting to open usb_init()
unix_open to open usb_init(): -1
sideload_service invoked
adbd exiting after successful sideload
Restarting adbd...
Installing '/data/media/0/sideload.zip'...
Checking for MD5 file...
Skipping MD5 check: no MD5 file found
I:Zip contains SELinux file_contexts file in its root. Extracting to /file_contexts
I:Legacy property environment initialized.
about to run program [/tmp/backuptool.sh] with 2 args
grep: /system/build.prop: No such file or directory
Not backing up files from incompatible version: 12
run_program: child exited with status 127
about to run program [/tmp/otasigcheck.sh] with 1 args
erasing 249856 blocks
blkdiscard failed: Invalid argument
writing 109461 blocks of new data
lseek64 failed: Invalid argument
I:TWFunc::Set_Brightness: Setting brightness control to 5
I:Legacy property environment disabled.
E:Error executing updater binary in zip '/data/media/0/sideload.zip'
TWRP 2.8.1.0; Donkey Kernel 3alpha3; Coming from GPE 4.4.4
Thanks in advance!
Click to expand...
Click to collapse
In a nutshell, Google Play Edition devices seem to have a different partition allocation (number of blocks per partition?) that will basically break anything using the new raw block images format that Lollipop uses to flash partitions.
This SHOULD ONLY HAPPEN ON THE GPE 4.4.4 OTA (XT1032?). XT1033 Users who converted to 4.4.3, you are safe.
YET, I HAVEN'T CONFIRMED THAT HIS HAPPENS FOR ALL GPE DEVICES OUT THERE WITH THE 4.4.4 OTA. FOR THE SAKE OF THIS GUIDE I'LL ASUME THAT THIS HAPPENS UNIVERSALLY.
Motorola, in example, still uses the /system layout, associated with a patching system for their Lollipop soak test OTA for XT1033.
Screenshot of the /system subfolder from the Lollipop XT1033 OTA.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
OK @murderered (and mostly anyone that has a GPE device with Android 4.4.4), I found a solution for flashing CM12 with the "Error executing updater-binary". Yet it's quite complicated because of the restrictive nature of the 4.4.4 bootloader.
NOTICE: Check you recovery log to find EXACTLY WHAT HAPPENED, if you have bugs related to lseek64 and blkdiscard. Then THIS IS PROBABLY RELATED TO YOUR PROBLEM. OTHERWISE, STAY AWAY.
Basically, you will need to download the following:
1. Either a Retail or a carrier version of the full 4.4.2 ROM (one you can flash via fastboot). It seriously needs to be a full rom, you can skip this if you instead find a full 4.4.4 ROM, because you need the system.img and boot.img. Do not use the GPE one, it has to be RETAIL/CARRIER and RETAIL/CARRIER ONLY.
1.1. You don't exactly need the 4.4.2 ROM as long as you can push to your sdcard via recovery (not sure why, but I couldn't on TWRP 2.8.1.0).
1.2. I still recommend it because if something derps in the way (like, "suddenly" you can't push through your recovery anymore), you can correct this with it.
2. Then the corresponding 4.4.4 OTA update to your 4.4.2 ROM. Unless, you found a full 4.4.4 stock ROM or you can push through recovery. You'll need most of the bootloader files and the gpt.bin from it (as it is a 4.4.4 version it won't be rejected by fastboot).
3. Patience, it took me 5 hours to finally acomplish it.
4. the lastest mfastboot (this will not work, or, atleast it didn't work for me, with the Android SDK one). I used this as I was also inspecting the Lollipop OTA. Kudos to @W3ND31, who uploaded it (seriously, go thank him to for posting the OTA in the first place, he deserves it): https://docs.google.com/file/d/0B4PT9WP-u_z9NXRBWF9EV2lGcWs/edit
So, I'll try to not sound too cryptic on this, but if you find something you don't understand is preferable to just PM me (and try to explain as much as you can, seriously, I get tired quite easily because I have already been a ROM porter quite a few times).
The steps are simple, but it's quite easy to mess it up (and I didn't exactly have much caution as being experienced in this, but you should).
Before the first step, ensure you can push through the sdcard via ADB easily, test it NOW; this is not mandatory, yet it will probably save you a lot of time; and, because later, you will not be able to test it. We will have to wipe /data partition, so backup EVERYTHING.
0. Have a ROM ready to flash, like CM12, and all it's requirements, GApps, SuperSU, the DSP Fix, everything.
1. First of all, go to fastboot mode (advice: have a decent battery level, it shouldn't take long, just an advice anyway).
2. On your PC, extract the mfastboot binaries to a empty folder.
3. Then extract emmc_appsboot.mbn, fsg.mbn, gpt.bin, rpm.mbn, sbl1_8226.mbn, sdi.mbn, tz.mbn FROM THE 4.4.4 OTA/FULL Image. All these to the same folder where mfastboot is.
4. Extract the system.img or system_sparsechunk's (it should be in sparse images, if it isn't, well, that is why I used the mfastboot) and boot.img from the FULL 4.4.2 STOCK ROM to the folder too.
5. Connect to the phone to the PC and make sure it's recognized if you haven't already.
6. Open a terminal, like cmd or PowerShell and change directory to where your mfastboot.exe is.
7. Run the following :
Code:
mfastboot flash sbl1 sbl1_8226.mbn
mfastboot flash aboot emmc_appsboot.mbn
mfastboot flash rpm rpm.mbn
mfastboot flash tz tz.mbn
mfastboot flash fsg fsg.mbn
mfastboot flash sdi sdi.mbn
mfastboot flash partition gpt.bin
8. Select recovery on the menu (recovery shouldn't have been messed up, still, you have a fastboot terminal, if run into problems, flash your custom recovery again). And wait for it to boot (it could take more time than usual). You'll notice that most partitions are "broken" (by the noticeable errors thrown by your recovery), format /system, /cache, and /data (hope you remembered to backup as I said before).
9.A. Now, if you could push zips through recovery via adb, it's time to test it again. Mount the sdcard on your recovery menu, pray for salvation, and try to push your ROM via ADB through recovery and flash it (via adb sideload, or manually, whatever). I didn't have the luck here, but it should work just fine. Remember to also push SuperSU and your gapps. If successfull, Skip to 15. If not, continue reading.
9.B. If you couldn't push zips through adb, like me. Then you will have to use the 4.4.2 stuff I said you should download as a recomendation.
Attention: As I don't know how recoveries other than TWRP handle formatting in certain filesystems, you may need to flash TWRP for the following.
10. You will have to (temporarilly) format your /data partition to f2fs, so if you are still on your recovery, go and do that. (TWRP > Wipe > Advanced Wipe > select /data > Format > Tap F2FS > Confirm)
11. Go back to fastboot mode in your phone and go back to your computer terminal of choice.
12. Run the following (and read, seriously, READ):
12.A. If your stock 4.4.2 ROM download didn't have sparse images, mfastboot will handle do this for you instead:
Code:
mfastboot flash system system.img
12.B. If your stock 4.4.2 ROM download did have sparse images, flash them one by one. Example:
Code:
mfastboot flash system system_sparsechunk1
mfastboot flash system system_sparsechunk2
mfastboot flash system system_sparsechunk3
13. And finally flash the boot.img
Code:
mfastboot flash boot boot.img
14. Once you did this, reboot to Android. If it BOOTS, then is a good sign, your partition table matches with whatever the bootloader or Android wants.
14.1. If your device is stuck in a bootloop, then you may have to go to recovery and wipe /data and /cache (and remember, /data needs to be f2fs). Anything else, I blame you.
.15. Do the Setup Wizard (don't even bother to sign in to Google), and copy your files to the sdcard. Don't worry about the Android version on your device (4.4.3), because we have everything else to the 4.4.4 version (bootloader and gpt.bin are the important ones)
16. Since this is related to CM12... Just go to recovery and pray to the gods of the software for success. Atleast mine booted...

Why so much bug thread... This error only comes in GPE 4.4.4. ... Downgrade to GPE 4.4.2 and flash CM12 using twrp 2.8.1.0... Simple... No need of bigger guide

padhu1989 said:
Why so much bug thread... This error only comes in GPE 4.4.4. ... Downgrade to GPE 4.4.2 and flash CM12 using twrp 2.8.1.0... Simple... No need of bigger guide
Click to expand...
Click to collapse
If it was that easy...once you updated to 4.4.4 fastboot will not let you downgrade back.
And then the problem prevails, you can't revert back to the non-bugged file.
Heck, on the lollipop thread you can see the same problem on a bigger scale, once you flashed the OTA you can't go back to 4.4.4. It simply doesn't boot.

Paul L. said:
If it was that easy...once you updated to 4.4.4 fastboot will not let you downgrade back.
And then the problem prevails, you can't revert back to the non-bugged file.
Heck, on the lollipop thread you can see the same problem on a bigger scale, once you flashed the OTA you can't go back to 4.4.4. It simply doesn't boot.
Click to expand...
Click to collapse
I was in 4.4.4 GPE and I downgraded to 4.4.2 using Fastboot without any issues.. Lollipop is different... You must be doing something wrong...

padhu1989 said:
I was in 4.4.4 GPE and I downgraded to 4.4.2 using Fastboot without any issues.. Lollipop is different... You must be doing something wrong...
Click to expand...
Click to collapse
Yeah, you could be right. Or maybe I have just been unlucky. My device already had 4.4.3 when I bought it. Or just maybe it's just that I am plain stupid, as far as I know, I tried everything I could, yet my bootloader is somehow intelligent enough to recognize the 4.4.3 (and 4.4.2 too) gpt.bin as outdated.

Related

[Q] Unable to update to stock android 4.2.2 using multirom

I am using multirom v8, with TWRP v2.4.1.0 on a Nexus 7 Wi-fi version. I have stock Android 4.2.1 (but with Tasssadar's kexec-hardboot kernel) as internal and Ubuntu 13.04.
I received the notification that the 4.2.2 update was available. So, I started to install it but it was unsuccessful. I do not remember but I think it said that update had failed and it rebooted.
So, I manually downloaded the update ( to update build JOP40D to JDQ39) and tried to install it using the modified recovery. Got the following error message (relevant parts):
I:Attempt to load settings from settings file...
I:Version number saved to '/cache/recovery/.version'
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Switching packages (TWRP)
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
I:Set page: 'flash_zip'
Installing '/sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip'...
Checking for MD5 file...
Skipping MD5 check: no MD5 file found.
Verifying current system...
contents of partition "/dev/block/platform/sdhci-tegra.3/by-name/LNX" didn't match EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd
file "EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd" doesn't have any of expected sha1 sums; checking cache
failed to stat "/cache/saved.file": No such file or directory
failed to load cache file
script aborted: assert failed: apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd")
assert failed: apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd")
E:Error in /sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip
(Status 7)
Error flashing zip '/sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip'
Updating partition details...
Any suggestions to fix this issue?
PS: I would have posted this here: http://forum.xda-developers.com/showpost.php?p=38043472&postcount=1157 but I do not have sufficient priviledges...
rigved said:
I am using multirom v8, with TWRP v2.4.1.0 on a Nexus 7 Wi-fi version. I have stock Android 4.2.1 (but with Tasssadar's kexec-hardboot kernel) as internal and Ubuntu 13.04.
I received the notification that the 4.2.2 update was available. So, I started to install it but it was unsuccessful. I do not remember but I think it said that update had failed and it rebooted.
So, I manually downloaded the update ( to update build JOP40D to JDQ39) and tried to install it using the modified recovery. Got the following error message (relevant parts):
I:Attempt to load settings from settings file...
I:Version number saved to '/cache/recovery/.version'
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Switching packages (TWRP)
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
I:Set page: 'flash_zip'
Installing '/sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip'...
Checking for MD5 file...
Skipping MD5 check: no MD5 file found.
Verifying current system...
contents of partition "/dev/block/platform/sdhci-tegra.3/by-name/LNX" didn't match EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd
file "EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd" doesn't have any of expected sha1 sums; checking cache
failed to stat "/cache/saved.file": No such file or directory
failed to load cache file
script aborted: assert failed: apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd")
assert failed: apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd")
E:Error in /sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip
(Status 7)
Error flashing zip '/sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip'
Updating partition details...
Any suggestions to fix this issue?
PS: I would have posted this here: http://forum.xda-developers.com/showpost.php?p=38043472&postcount=1157 but I do not have sufficient priviledges...
Click to expand...
Click to collapse
I think the problem is with bootloader (not sure) ...i had same multirom (cyanogenmod +Ubuntu ) ..i deleted ubuntu then flashed Stock 4.2.1 with wugstool then updated to 4.2.2 ... try updating bootloader
rigved said:
I am using multirom v8, with TWRP v2.4.1.0 on a Nexus 7 Wi-fi version. I have stock Android 4.2.1 (but with Tasssadar's kexec-hardboot kernel) as internal and Ubuntu 13.04.
I received the notification that the 4.2.2 update was available. So, I started to install it but it was unsuccessful. I do not remember but I think it said that update had failed and it rebooted.
So, I manually downloaded the update ( to update build JOP40D to JDQ39) and tried to install it using the modified recovery. Got the following error message (relevant parts):
I:Attempt to load settings from settings file...
I:Version number saved to '/cache/recovery/.version'
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Switching packages (TWRP)
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
I:Set page: 'flash_zip'
Installing '/sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip'...
Checking for MD5 file...
Skipping MD5 check: no MD5 file found.
Verifying current system...
contents of partition "/dev/block/platform/sdhci-tegra.3/by-name/LNX" didn't match EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd
file "EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd" doesn't have any of expected sha1 sums; checking cache
failed to stat "/cache/saved.file": No such file or directory
failed to load cache file
script aborted: assert failed: apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd")
assert failed: apply_patch_check("EMMC:/dev/block/platform/sdhci-tegra.3/by-name/LNX:5060608:319331fae14fec8a88063751475fce26bae328e0:5062656:af83f09e77a64ed7ede2adad2a16bd0c12d5d7fd")
E:Error in /sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip
(Status 7)
Error flashing zip '/sdcard/Download/6ece895ecb23.signed-nakasi-JDQ39-from-JOP40D.6ece895e.zip'
Updating partition details...
Any suggestions to fix this issue?
PS: I would have posted this here: http://forum.xda-developers.com/showpost.php?p=38043472&postcount=1157 but I do not have sufficient priviledges...
Click to expand...
Click to collapse
I *just* fixed this problem. Mine was failing on the same line. The trick is to modify the updater-script. I modified it to stop the check, and it flashed without a problem on my tablet. I also removed the sections where it replaced the recovery.
I'm hesitant to post mine because I was NOT running multiboot, so when it patched the bootloader regardless of the checksum, I was fine (Or lucky). I don't know what will happen if you use the one I modified, or if 4.2.1 CAN be updated safely without touching the bootloader.
So here: This script is very untested, and modified by someone who doesn't fully understand what he did. Use this at your own risk, and realize I hold no responsibility if you brick your N7..
That said, if you replace the 'updater-script' in the update zip (located in META-ING/com/google/android) with this one, it will patch.
The LNX partition is the boot partition.
That check is failing because when the script looks at the existing LNX partition (boot), it does not find what it expects to find.
The OTA patches existing files, it doesn't replace them with a full replacement copy. So the starting condition of each file to be patched must be exact.
I believe that the check of the LNX partition is the very last checksum verified, so that is good news - it means nothing else checked in /system is mismatched.
You can either hack the installer script as above (and thus need to use a custom recovery to install it because this will break the signing of the factory package), or you can use a completely safe route:
- make full Nandroid backup (including recovery if possible)
- flash the stock 4.2.1 boot image ( not bootloader! ) to the boot partition
- copy the factory ota .zip file to /cache/update.zip
- create a file named "command" with a single line in it:
--update_package=/cache/update.zip
and copy it to /cache/recovery/command
- flash the stock 4.2.1 recovery to the recovery partition
- reboot to recovery
This runs the pure stock OTA install which does all the patching plus installs a new 4.18 bootloader, 4.2.2 boot partition, and 4.2.2 stock recovery.
Before you get too antsy bear in mind that this whole situation is likely to happen again with the next OTA - meaning, it would be a great time to get a backup of pure stock 4.2.2 (including stock recovery and stock boot partition).
So, now:
- perform a soft boot of a custom recovery (don't flash it in place just yet!)
- overflash a SuperSU/Superuser root kit
- make a Nandroid Backup of this entire "lightly rooted pure stock 4.2.2 ROM" - including the recovery partition!
- hard-flash your custom recovery
- restore only the boot partition from the first Nandroid backup described in these instructions.
cheers

[Q] Nexus 7 (2012) Stuck in a boot loop, recovery fails from being read only

Hi and thanks to anyone who decides to help me as my knowledge is limited.
I decided to flash KitKat as I play a WebView based game and thought the WebView Chromium of KitKat might make it run faster as it ran pretty slow. On the Paranoid Google+ page it says you need TWP 2.6 later and other sites say 2.6.x. I had 2.6.0.0, so did a backup of boot, data, system and recovery using TWRP, copied them to a PC and then tried installing KitKat, it failed. So I updated to TWRP 2.6.3.0 and it failed again, tried a second time and it updated
The game didn't work well on KitKat, so I restored my original version. I then decided to take screenshot of game not working on KitKat to complain, so tried installing KitKat again forgetting to update to 2.6.3.0 as the restoration of the backup restored the prevous 2.6.0.0 recovery, was a noob and tried again and i'm now left with a Nexus 7 in a boot logo loop.
Restoring the backup fails, as does installing the KitKat Zip or Opensensation . If I try flashing TWRP 2.6.3.0 via fastboot, it says success, but when I reboot the recovery i'm still in 2.6.0.0. I can boot into 2.6.3.0 using "fastboot boot", but it still won't restore the backup or flash. I also have a backup of the OpenSensation rom (wanted to try PDroid and it was the only rom I could find prepatched) which I made on 2.6.3.0, that won't restore either.
The error i'm getting in TWRP is "symlink: some failed"", "can't open destination log file: '/cache/recovery/log'" and "E:Unable to open '/cache/recovery/log'"
This is the end part of recovery.log in tmp
Code:
E:TWFunc::Copy_Log -- Can't open destination log file: '/cache/recovery/log'
I:Copying file /cache/recovery/log to /cache/recovery/last_log
I:Attempt to load settings from settings file...
I:Loading settings from '/data/media/0/TWRP/.twrps'.
I:Backup folder set to '/data/media/0/TWRP/BACKUPS/015d2109a660180c'
E:Unable to open '/cache/recovery/.version'.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Switching packages (TWRP)
I:Set page: 'wipe'
I:Set page: 'action_page'
Formatting Cache using make_ext4fs function.
Creating filesystem with parameters:
Size: 464519168
Block size: 4096
Blocks per group: 32768
Inodes per group: 7088
Inode size: 256
Journal blocks: 1772
Label:
Blocks: 113408
Block groups: 4
Reserved block group size: 31
Created filesystem with 11/28352 inodes and 3654/113408 blocks
E:Unable to open '/cache/recovery/.version'.
Wiping data without wiping /data/media ...
I:Unable to unlink '/data/local/tmp/init.rc: Read-only file system'
I:Unable to unlink '/data/data/com.android.providers.applications/lib: Read-only
file system'
I:Unable to unlink '/data/app-asec/com.acrossair.tvguideuk-1.asec: Read-only fil
e system'
I:Unable to unlink '/data/app/org.mozilla.firefox_beta-1.apk: Read-only file sys
tem'
I:Unable to unlink '/data/property/persist.sys.NV_STEREOCTRL: Read-only file sys
tem'
I:Unable to unlink '/data/dalvik-cache/[email protected]@[email protected]: Read-on
ly file system'
I:Unable to unlink '/data/gps/glgpsctrl: Read-only file system'
I:Unable to unlink '/data/user/0: Read-only file system'
I:Unable to unlink '/data/system/entropy.dat: Read-only file system'
I:Unable to unlink '/data/backup/pending/journal-1737016036.tmp: Read-only file
system'
I:Unable to unlink '/data/sensors/KXTF9_Calibration.ini: Read-only file system'
I:Unable to unlink '/data/lightsensor/AL3010_Config.ini: Read-only file system'
I:Unable to unlink '/data/anr/traces.txt: Read-only file system'
I:Unable to unlink '/data/tombstones/tombstone_00: Read-only file system'
Done.
Updating partition details...
I:Data backup size is 1537MB, size: 6058MB, used: 4595MB, free: 1330MB, in data/
media: 3058MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Set page: 'action_complete'
I:Set page: 'clear_vars'
I:Set page: 'wipe'
I:Set page: 'action_page'
Formatting cache using make_ext4fs function.
Creating filesystem with parameters:
Size: 464519168
Block size: 4096
Blocks per group: 32768
Inodes per group: 7088
Inode size: 256
Journal blocks: 1772
Label:
Blocks: 113408
Block groups: 4
Reserved block group size: 31
Created filesystem with 11/28352 inodes and 3654/113408 blocks
E:Unable to open '/cache/recovery/.version'.
Wiping data without wiping /data/media ...
I:Unable to unlink '/data/local/tmp/init.rc: Read-only file system'
I:Unable to unlink '/data/data/com.android.providers.applications/lib: Read-only
file system'
I:Unable to unlink '/data/app-asec/com.acrossair.tvguideuk-1.asec: Read-only fil
e system'
I:Unable to unlink '/data/app/org.mozilla.firefox_beta-1.apk: Read-only file sys
tem'
I:Unable to unlink '/data/property/persist.sys.NV_STEREOCTRL: Read-only file sys
tem'
I:Unable to unlink '/data/dalvik-cache/[email protected]@[email protected]: Read-on
ly file system'
I:Unable to unlink '/data/gps/glgpsctrl: Read-only file system'
I:Unable to unlink '/data/user/0: Read-only file system'
I:Unable to unlink '/data/system/entropy.dat: Read-only file system'
I:Unable to unlink '/data/backup/pending/journal-1737016036.tmp: Read-only file
system'
I:Unable to unlink '/data/sensors/KXTF9_Calibration.ini: Read-only file system'
I:Unable to unlink '/data/lightsensor/AL3010_Config.ini: Read-only file system'
I:Unable to unlink '/data/anr/traces.txt: Read-only file system'
I:Unable to unlink '/data/tombstones/tombstone_00: Read-only file system'
Done.
Updating partition details...
I:Data backup size is 1537MB, size: 6058MB, used: 4595MB, free: 1330MB, in data/
media: 3058MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Set page: 'action_complete'
I:Set page: 'clear_vars'
I:Set page: 'wipe'
I:Set page: 'main'
I:Set page: 'clear_vars'
I:Set page: 'main2'
I:Set page: 'install'
I:Set page: 'flash_confirm'
I:Set page: 'flash_zip'
I:Set page: 'flash_zip'
Installing '/sdcard/pa_aosp_grouper.zip'...
Checking for MD5 file...
I:Cannot find file /sdcard/pa_aosp_grouper.zip.md5
Skipping MD5 check: no MD5 file found.
Verifying zip signature...
I:read key e=3
I:read key e=65537
I:comment is 1738 bytes; signature 1720 bytes from end
I:whole-file signature verified against key 0
I:Zip contains SELinux file_contexts file in its root. Extracting to /file_conte
xts
Creating filesystem with parameters:
Size: 681574400
Block size: 4096
Blocks per group: 32768
Inodes per group: 6944
Inode size: 256
Journal blocks: 2600
Label:
Blocks: 166400
Block groups: 6
Reserved block group size: 47
Created filesystem with 11/41664 inodes and 5415/166400 blocks
minzip: Extracted 2 file(s)
minzip: Error writing 32768 bytes from zip file from 0xbe95d794: Read-only file
system
minzip: Process function elected to fail (in inflate)
minzip: Can't extract entry to file.
minzip: Error extracting "/system/framework/framework-res.apk"
minzip: Extracted 418 file(s)
symlink: failed to remove /system/fonts/DroidSans-Bold.ttf: Read-only file syste
m
symlink: failed to symlink /system/fonts/DroidSans-Bold.ttf to Roboto-Bold.ttf:
File exists
script aborted: symlink: some symlinks failed
symlink: some symlinks failed
E:Error executing updater binary in zip '/sdcard/pa_aosp_grouper.zip'
Error flashing zip '/sdcard/pa_aosp_grouper.zip'
Updating partition details...
I:Data backup size is 1537MB, size: 6058MB, used: 4595MB, free: 1330MB, in data/
media: 3058MB.
I:Unable to mount '/usb-otg'
I:Actual block device: '', current file system: 'vfat'
I:Set page: 'flash_done'
Which says update fails because file system is read only.
I've tried Nexus Tookit and it says it was successful. Used the stock rom before the most recent one.
Code:
Flash Stock + Unroot...
------------------------------------------------------------------
erasing 'boot'...
OKAY [ 0.011s]
finished. total time: 0.011s
******** Did you mean to fastboot format this partition?
erasing 'cache'...
OKAY [ 0.022s]
finished. total time: 0.022s
erasing 'recovery'...
OKAY [ 0.022s]
finished. total time: 0.022s
******** Did you mean to fastboot format this partition?
erasing 'system'...
OKAY [ 0.032s]
finished. total time: 0.032s
******** Did you mean to fastboot format this partition?
erasing 'userdata'...
OKAY [ 0.028s]
finished. total time: 0.029s
sending 'bootloader' (2100 KB)...
OKAY [ 0.279s]
writing 'bootloader'...
OKAY [ 0.724s]
finished. total time: 1.004s
rebooting into bootloader...
OKAY [ 0.006s]
finished. total time: 0.007s
archive does not contain 'boot.sig'
archive does not contain 'recovery.sig'
archive does not contain 'system.sig'
--------------------------------------------
Bootloader Version...: 4.23
Baseband Version.....: N/A
Serial Number........: 015d2109a660180c
--------------------------------------------
checking product...
OKAY [ 0.040s]
checking version-bootloader...
OKAY [ 0.023s]
sending 'boot' (4896 KB)...
OKAY [ 0.644s]
writing 'boot'...
OKAY [ 0.018s]
sending 'recovery' (5432 KB)...
OKAY [ 0.720s]
writing 'recovery'...
OKAY [ 0.023s]
erasing 'system'...
OKAY [ 0.017s]
sending 'system' (529061 KB)...
OKAY [ 66.865s]
writing 'system'...
OKAY [ 8.887s]
erasing 'userdata'...
OKAY [ 0.026s]
formatting 'userdata' partition...
Creating filesystem with parameters:
Size: 6453985280
Block size: 4096
Blocks per group: 32768
Inodes per group: 8048
Inode size: 256
Journal blocks: 24620
Label:
Blocks: 1575680
Block groups: 49
Reserved block group size: 391
Created filesystem with 11/394352 inodes and 52512/1575680 blocks
sending 'userdata' (102525 KB)...
writing 'userdata'...
OKAY [ 51.792s]
erasing 'cache'...
OKAY [ 0.018s]
formatting 'cache' partition...
Creating filesystem with parameters:
Size: 464519168
Block size: 4096
Blocks per group: 32768
Inodes per group: 7088
Inode size: 256
Journal blocks: 1772
Label:
Blocks: 113408
Block groups: 4
Reserved block group size: 31
Created filesystem with 11/28352 inodes and 3654/113408 blocks
sending 'cache' (9052 KB)...
writing 'cache'...
OKAY [ 3.181s]
rebooting...
finished. total time: 132.412s
But It has no effect. It's still stuck in a boot loop and if I reboot into recovery it's still TWRP 2.6.0.0. I can browse data/data using ADB sh and all data still hasn't been deleted. When using ADB, I can push files to root but once I reboot the device they are gone. If I do ADB Shell mount after attemping to install someone via TWRP I get
Code:
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)/dev/block/mmcblk0p9 on /data type ext4 (ro,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p9 on /sdcard type ext4 (ro,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/platform/sdhci-tegra.3/by-name/APP on /system type ext4 (ro,seclabel,nodev,noatime,nodiratime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p4 on /cache type ext4 (ro,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
If I then go into the mount menu and remove ticks in boxes and put them back I get
Code:
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,seclabel,relatime)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,relatime)
/dev/block/mmcblk0p9 on /data type ext4 (rw,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p9 on /sdcard type ext4 (rw,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p4 on /cache type ext4 (rw,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p3 on /system type ext4 (rw,seclabel,relatime,user_xattr,acl,barrier=1,data=ordered)
but if I try writing to cache, system, sdcard, data, it instantly switches back to ro and faiils. ADB push says it succeeds and file appears on device when it is mounted as RW, but is gone on reboot.
If I boot into recovery TWRP 2.6.0.0 and type adb devices, I get
Code:
List of devices attached
0123456789ABCDEF recovery
Which obviously I know is iffy.
If I do fastboot boot <TWRP 2.6.3.0>
and do adb devices, I get
Code:
List of devices attached
015d2109a660180c recovery
If it means anything, previously i've taken screenshots on the device and deleted others. Then connected to a PC in normal mode and what I see in the screenshot directory was from before those changes.
If it also has a bearing, when I connect the Nexus to the PC it tells me it can perform faster when connected to a USB2.0 port which it is. It Also has the power recharge problem, to get it to recharge I have to plug the usb cable in, remove usb cable and reinsert within 10 seconds, turn the screen off and leave it alone. As solution posted on Google Forums, but it used to charge normally.
I had a similar problem the other day and used the toolkit to flag an even earlier build (4.2) and I could boot.
Then do the OTA updates which will update your bootloader and then reflash whatever you like.
---------- Post added at 06:24 AM ---------- Previous post was at 06:23 AM ----------
I had a similar problem the other day and used the toolkit to flag an even earlier build (4.2) and I could boot.
Then do the OTA updates which will update your bootloader and then reflash whatever you like.
Thanks for your suggestion, unfortunately if I flash any stock which doesn't have the same boot loader as the device already has the flash fails. I get
Code:
writing 'bootloader'...
FAILED (remote: ())
so no error code and fastboot crashes after a couple of more steps. I can't write to the device at all, formatting, erasing does nothing even if it says it was successful. in TWRP I can't delete any file or change the permissions on any file.
So it's not something I know about, but i'm assuming the boot loader gets verified straight after being flashed, as my device will still have 4.23 regardless of what's being flashed the verification fails and fastboot on both the PC and Nexus 7 crashes. On the Nexus 7 in top left corner I see 'Signature Match'.
I also can't relock the bootloader. If I do "Fastboot OEM lock" it says success, If I immediately then try "Fastboot OEM Unlcock" it says it can't be done as device is already unlocked. It's like it's a hardware write flash failure, but it's a very big coincidence it happened when I was using TWRP.
Also tried removing the battery connector for a few minutes, did nothing.
Did you get anywhere with this? I've got the same symptoms - it "pretends" to flash partitions, but does nothing. Same error trying to downgrade the bootloader.
The installed OS has become flakey because its state never changes - it seems the whole device is stuck in read-only mode.
I'm suspecting its a write off
Oh - and I don't think its to do with TWRP - I had CWM installed, but I hadn't done anything but used the device for about a week - I have stock 4.4 + CWM + Superuser - and was happily using it until today when it started rebooting whenever I write much (like install updates). I think something about the flash has just "gone bad" - or perhaps been marked as non-writeable.
Same here..
I have experienced same problem.
My N7 is in Groudhog Day mode!
Whatever I do it reverts to its condition a fortnight ago... before rebooting.
It goes through all the motions... but Groundhog Day after reboot.
Must be hardware I think.
Any comments?????
whitty_nexus said:
Did you get anywhere with this? I've got the same symptoms - it "pretends" to flash partitions, but does nothing. Same error trying to downgrade the bootloader.
The installed OS has become flakey because its state never changes - it seems the whole device is stuck in read-only mode.
I'm suspecting its a write off
Oh - and I don't think its to do with TWRP - I had CWM installed, but I hadn't done anything but used the device for about a week - I have stock 4.4 + CWM + Superuser - and was happily using it until today when it started rebooting whenever I write much (like install updates). I think something about the flash has just "gone bad" - or perhaps been marked as non-writeable.
Click to expand...
Click to collapse
Has anyone managed to solve this? I'm having the same problem. Bootloops and whenever I try to wipe data in TWRP (factory reset) it doesn't actually wipe anything. Help!
Sent from my iPhone using Tapatalk
I've followed this up with Google Support (I bought the tablet from the play-store), and with it in the warranty period they offered an RMA replacement. They didn't have any hints or tips other than attempting to boot in safe-mode and factory reset the device (first-level standard support script), after factory reset failed they offered replacement.
This is only of help if your warranty is still in good standing - hint they were only interested in drop-damage or water-damage - unlocked bootloaders are no problem - although (a) I'm running stock and (b) Australian consumer law may give better protection than other locations.
Breaking news is that my wife's tablet failed in exactly the same way 3 weeks later. Her's had only ever been stock - in fact its bootloader was locked until the KitKat OTA reported errors applying due to mismatched system APKs. I suspect that was the first sign of bad flash. I unlocked and flashed stock KitKat. Then had ~3 weeks of no problems, now this. Hope that helps someone.
pwllheli said:
It goes through all the motions... but Groundhog Day after reboot.
Must be hardware I think.
Any comments?????
Click to expand...
Click to collapse
mattsolberg said:
Has anyone managed to solve this? I'm having the same problem. Bootloops and whenever I try to wipe data in TWRP (factory reset) it doesn't actually wipe anything. Help!
Click to expand...
Click to collapse
Well, just an update. Same problems still persisting. No solution yet. I contacted Google support but as I'm outside of the warranty period, I'm S.O.L.
Anyone with some other ideas?
Sent from my iPhone using Tapatalk
Just adding a "ME TOO!". Makes me feel better that I am not alone... No matter how I flash, it says its successful, but on reboot, all is as it was before flash... Suppose I could get a Nexus 7 with a broken screen and fix it now... :/
I may consider myself lucky : it is late 2018 and my good old Nexus 7 2012 has fall into the Groundhog Day mode a couple of months ago... No way to flash, erase data or reset... Even erasing my personal files when connected to a PC doesn't work : all files are back after reboot... Bye bye Cyanogen ROM...
Turns out the read only issue is a known issue of hardware failure. I did end up replacing the motherboard and it was a good decision. Not too expensive and not super hard to do. I use an ASOP Nouget build.
Sent from my LGLS992 using Tapatalk

Corrupt partition /data

Okay so I recently updated my s4(att) from cyanogen 12 to cyanogen 13 (latest nightly). I went to settings/security and chose encrypt phone. After about 30 minutes of encrypting it reboot and got stuck in a bootloop. I thought no problem Ill just reflash. I go to reflash my backup and it says error mounting /data. I try formating data, factory reset, and installing the rom from scratch. It seems my data partition corrupt. So I figure fastboot. Yet upon loading fastboot I cant get adb to see my device. I think I got the right drivers installed. But nothing. Any help would be greatly appreciated.
Edit: fixed.
Solution:
I found this and was able to shell in via adb and format the partition.
f you wish to wipe the /data partition completely (including media like photos), follow the below instructions:
Boot into recovery.
Run adb shell in a terminal (Linux) or Command Prompt ("CMD", Windows). After a few seconds, you should see a line containing ~ #.
WARNING. Triple-check the command that you are entering here. White space and capitalization are important. Make any mistake here and you may accidentally wipe your whole flash memory including recovery images.
NOTE: if you want to encrypt your partition later, you have to leave 16KiB unallocated space on the end of the partition.
In the adb shell, run the command mke2fs -t ext4 /dev/block/mmcblk0p12. Substitute /dev/block/mmcblk0p12 and ext4 according to the recovery filesystem table (for /data). Output when running the command:
~ # mke2fs -t ext4 /dev/block/mmcblk0p12
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
755904 inodes, 3022848 blocks
151142 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3095396352
93 block groups
32768 blocks per group, 32768 fragments per group
8128 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 34 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
(Optional) Install new firmware (E.g. CM 10.1).
Reboot.
(Optional) In order to encrypt the partition while clearing your whole data partition, run vdc cryptfs enablecrypto wipe PIN_OR_PASSWORD (before Android 5.0) or vdc cryptfs enablecrypto wipe password PASSWORD_IN_HEX (since Android 5.0, see this post for details).
Reconfigure device, choose language, enter name, install apps, etc.
source: android .stackexchange. com/questions/33398/cannot-factory-reset-after-encrypting
(sorry cant post links yet)
of course always check your formatting the correct partition first

[Guide] Repartition Nexus7(2013) to increase system partition - Extra Space for Rom

Hi, this is my first time posting here. I noticed there is no guide to increase the system partition size in Nexus 7 (2013). The system partition is only around 880MB making it impossible to flash new ROMs and large package of GApps. This guide is for Nexus 7 (2013) wifi 32GB but it should work for other Nexus 7 (2013) editions and even Nexus 7 (2012) with some numbers changed.
My guide is based on this guide for Nexus 5. Check it out. The only issue with Nexus 7 is that the recovery partition is between the system and userdata partitions in the partition table. So deleting the partitions (which includes recovery partition) and then recreating them with offsets might leave your tablet bricked. If you have a way to unbrick the tablet or you are manly enough, you can try the guide written in the next comment. I haven't tested it. Leave a comment if it works. Anyway from the Nexus 5 guide:
The high-level procedure here is, since filesystems must be contiguous and in order so they can be addressed properly, we need to delete every partition inclusively from system to userdata, then recreate them with new storage offsets.
Click to expand...
Click to collapse
This part is not very accurate. I am not sure about Nexus 5 but in Nexus 7, I have changed the order with great success. Only thing is that you need to restart at the end so that the recovery mode updates the mounting configuration. I am not sure if it works with the stock ROM but it definitely works with a custom ROM.
The downside of my way is that you end up with around 880MB unused memory. You can give it to the cache partition. Otherwise, you have to do the untested one in the next comment.
Before we start, I am not liable if it doesn't work or makes your device unusable. The tested guide below works for me.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Tested Guide starts here:
Prerequisite:
1. PC (any OS) with adb and fastboot
2. Nexus 7 with TWRP recovery connected to the PC via USB.
3. Get parted from iwf1.com/iwf-repo/parted.rar and extract it into any directory
4. (Optional) System and userdata partitions are wiped out. So backup system and/or data partitions using TWRP recovery
Steps:
1. Open TWRP recovery mode in Nexus 7. Make sure to have the system partition read/write.
2. Go to mount and unmount all partitions you are going to modify (for now system and data).
3. Open PC's command line in parted's directory
4. The next steps are on the command line unless stated:
Code:
adb push parted /
adb shell
~ # chmod +x parted
~ # /parted /dev/block/mmcblk0
(parted): unit b
(parted): p
I used unit b to get partition sizes in bytes. So you can resize accurately this way. You will get the following partition table by default. Keep a copy of this partition table (and one with unit compact for easy readability) as reference if you mess up or want to restore to default.
Code:
Number Start End Size File system Name Flags
1 67108864B 156745727B 89636864B fat16 radio
2 201326592B 204472319B 3145728B modemst1
3 204472320B 207618047B 3145728B modemst2
4 268435456B 283795455B 15360000B ext4 persist
5 335544320B 336343039B 798720B m9kefs1
6 336343040B 337141759B 798720B m9kefs2
7 402653184B 403451903B 798720B m9kefs3
8 403451904B 406597631B 3145728B fsg
9 469762048B 471298047B 1536000B sbl1
10 471298048B 472834047B 1536000B sbl2
11 472834048B 474931199B 2097152B sbl3
12 474931200B 480174079B 5242880B aboot
13 480174080B 480698367B 524288B rpm
14 536870912B 553648127B 16777216B boot
15 603979776B 604504063B 524288B tz
16 604504064B 604505087B 1024B pad
17 604505088B 606041087B 1536000B sbl2b
18 606041088B 608138239B 2097152B sbl3b
19 608138240B 613381119B 5242880B abootb
20 613381120B 613905407B 524288B rpmb
21 613905408B 614429695B 524288B tzb
22 671088640B 1551892479B 880803840B ext2 system
23 1551892480B 2139095039B 587202560B ext4 cache
24 2147483648B 2148532223B 1048576B misc
25 2214592512B 2225078271B 10485760B recovery
26 2281701376B 2281709567B 8192B DDR
27 2281709568B 2281717759B 8192B ssd
28 2281717760B 2281718783B 1024B m9kefsc
29 2348810240B 2348843007B 32768B metadata
30 2415919104B 31272713727B 28856794624B ext4 userdata
5. Rename the system partition to disable it
Code:
(parted): name 22 unused1
6. Now you need to delete userdata partition:
Code:
(parted): rm 30
7. You need to create 2 primary partitions in place of userdata. First one will be the system partition. Second one will be the userdata partition. I recommend to have the system partition to start with the same byte userdata started and size divisible by 4096 bytes. Leave some space between the 2 divisible by 4096 bytes (block-size). Then have userdata partition start with a number divisible by 4096 bytes, size divisible by 512 bytes and ends where user data ended. I increased my system partition to around 2.93GiB (you can resize it whatever you want). I don't really need a lot of userdata. So my configuration would be:
Code:
(parted): mkpart primary 2415919104B 5570068479B
(parted): mkpart primary 5637144576B 31272713727B
8. Now you need to rename these 2 partitions:
Code:
(parted): name 30 system
(parted): name 31 userdata
(parted): p
9. Finally you need to create ext4 filesystem for system and userdata.
Code:
(parted): quit
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p30
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p31
~ # /parted /dev/block/mmcblk0 p
10. Have a final look at the partition table to see if everything is correct. Then Reboot into Recovery. This is a very important step. The mount configuration (/etc/fstab) doesn't update until you reboot.
Code:
~ # exit
adb reboot recovery
Done! You have a new system partition with a larger size ready for a ROM. The Size of the ROM will shrink after flashing a new ROM, Using TWRP, Wipe -> Advanced Wipe -> select system -> Resize File System -> Swipe.
Note: You might need to wipe cache/dalvik (might need wipe system too for mount to work), then unmount and remount system/cache/data for everything to work (for example, I had tablet's internal storage not showing on PC initially). But once everything works, it will always work
Final partition table looks like this:
Code:
Number Start End Size File system Name Flags
1 67.1MB 157MB 89.6MB fat16 radio
2 201MB 204MB 3146kB modemst1
3 204MB 208MB 3146kB modemst2
4 268MB 284MB 15.4MB ext4 persist
5 336MB 336MB 799kB m9kefs1
6 336MB 337MB 799kB m9kefs2
7 403MB 403MB 799kB m9kefs3
8 403MB 407MB 3146kB fsg
9 470MB 471MB 1536kB sbl1
10 471MB 473MB 1536kB sbl2
11 473MB 475MB 2097kB sbl3
12 475MB 480MB 5243kB aboot
13 480MB 481MB 524kB rpm
14 537MB 554MB 16.8MB boot
15 604MB 605MB 524kB tz
16 605MB 605MB 1024B pad
17 605MB 606MB 1536kB sbl2b
18 606MB 608MB 2097kB sbl3b
19 608MB 613MB 5243kB abootb
20 613MB 614MB 524kB rpmb
21 614MB 614MB 524kB tzb
22 671MB 1552MB 881MB ext2 unused1
23 1552MB 2139MB 587MB ext4 cache
24 2147MB 2149MB 1049kB misc
25 2215MB 2225MB 10.5MB recovery
26 2282MB 2282MB 8192B DDR
27 2282MB 2282MB 8192B ssd
28 2282MB 2282MB 1024B m9kefsc
29 2349MB 2349MB 32.8kB metadata
30 2416MB 5570MB 3154MB ext2 system
31 5637MB 31.3GB 25.6GB ext4 userdata
To increase cache size:
You have 880MB unused storage from the old system partition. You can keep it the way it is as you have the old system partition here which can be re-enabled quickly in the future. OR You can give this unused partition to the cache partition without messing around a lot. I recommend keeping a small unused partition in place of the old system partition to avoid messing with the order of recovery partition.
Code:
adb push parted /
adb shell
~ # chmod +x parted
~ # /parted /dev/block/mmcblk0
(parted): unit b
(parted): p
(parted): rm 22
(parted): rm 23
(parted): mkpart primary 671088640B 671096831B
(parted): mkpart primary 671096832B 2139095039B
(parted): name 22 unused1
(parted): name 23 cache
(parted): p
(parted): quit
~ # mke2fs -b 4096 -T ext4 /dev/block/mmcblk0p23
~ # quit
Edit: Deleted
rkhat said:
If you have a way to unbrick the tablet or you are manly enough, you can try the guide...
I haven't tested it. Leave a comment if it works.
Click to expand...
Click to collapse
No, there is no way to unbrick the tablet.
Here is a likely comment "So I took the jump in the name of exploration, and bricked my tablet"
Now, are you manly enough to try your own guide?
/EDIT 1
2018 - Unbricking method is available.
/EDIT 2
Here is a Non-destructive repartition script which you can simply 'install' from TWRP.
k23m said:
No, there is no way to unbrick the tablet.
Here is a likely comment "So I took the jump in the name of exploration, and bricked my tablet"
Now, are you manly enough to try your own guide?
Click to expand...
Click to collapse
If you checked the comment write below the second link, you will see a link to a repair option with RIFF JTAG box (costs >100$). I am not going to invest into a repair kit on a device that is probably worth less than the box, but hopefully someone who has the box and tablet can test the solution in the "name of exploration" and help others
Anyway, I am going to buy a chromebook in a year. Tablet market is dead. I might try the second solution on the N7 if some realtive doesn't steal it.
Didn't know that parted on works on android partitions in the way you describe.
My n7 2013 is in pretty bad shape, it has severe touch screen problems which sucks (its gone back to ASUS three times! pretty much gave up... haha they don't want to see it again).
So maybe I'll be game enough to try out the guide someday, but not today
There are something strange after I follow this guide.
If I copy files to /system and /system usage space is over 1GB.
/system will become read-only and mount as ro.
I try to remount /system as rw. But if I copy files into /system, it will become ro again.
Only I can do is format /system. Anyone can help?
Thanks.
I assume to do this you only need custom recovery and root?
OK, I've done the repartitioning. Looks good.
But, I can't seem to flash via TWRP. I try to side-load ROM and I see:
detecting filesystem ext4 for ...
Patching system image unconditionally...
E1001: Failed to update system image.
Updater process ended with error: 7
Any ideas?
RedBullet said:
OK, I've done the repartitioning. Looks good.
But, I can't seem to flash via TWRP. I try to side-load ROM and I see:
detecting filesystem ext4 for ...
Patching system image unconditionally...
E1001: Failed to update system image.
Updater process ended with error: 7
Any ideas?
Click to expand...
Click to collapse
Which ROM did you use? I don't think it works with stock ROM. I use lineageOS.
Btw if you attempt to update the ROM instead of reinstalling it, the system partition will shrink back and you can't use the following step to fix it:
The Size of the ROM will shrink after flashing a new ROM, Using TWRP, Wipe -> Advanced Wipe -> select system -> Resize File System -> Swipe.
Click to expand...
Click to collapse
I found a solution to skip this whole resizing step. I am going to post it after some testing.
rkhat said:
Which ROM did you use? I don't think it works with stock ROM. I use lineageOS.
Btw if you attempt to update the ROM instead of reinstalling it, the system partition will shrink back and you can't use the following step to fix it:
I found a solution to skip this whole resizing step. I am going to post it after some testing.
Click to expand...
Click to collapse
Yea, I was flashing lineage. I eventually got it. I wonder if my partition shrunk back also... What's easiest way to check?
Oh and what do you mean by update vs re-install? I am just flashing via sideload
RedBullet said:
Yea, I was flashing lineage. I eventually got it. I wonder if my partition shrunk back also... What's easiest way to check?
Oh and what do you mean by update vs re-install? I am just flashing via sideload
Click to expand...
Click to collapse
Use parted to print the partition table. First four steps in my guide. Then check the system partition. If it's like the original size, it shrank.
LineageOS supports updating. Let's say you are now on LineageOS 20170801. You want to update to 20170829. When you sideload the newer version, it will attempt to update the previous version (basically only update the differences between the 2 versions). You retain any modification to the system partition (like gapps). Reinstalling means you wipe the system partition then sideload the ROM.
So when updating LineageOS, the system partition will shrink again and I wasn't able to resize it back. Thus corrupting the system partition.
would it not be easier/safer to use parted's resize command to shrink the userdata partition, and then use the move command to move partition 23-29, and then use the resize command again to increase the size of the system partition?
theistus said:
would it not be easier/safer to use parted's resize command to shrink the userdata partition, and then use the move command to move partition 23-29, and then use the resize command again to increase the size of the system partition?
Click to expand...
Click to collapse
I don't think you can do it with parted's move command because according to move's documentation, these are the only supported formats:
ext2 (provided the destination partition is larger than the source partition)
fat16, fat32
linux-swap
reiserfs (if libreiserfs is installed)
Click to expand...
Click to collapse
Partitions 24-29 don't use a file system supported by parted. They definitely contain data (for example recovery partition has your twrp recovery image ).
I think there is a way to do what you are suggesting. In fact, the solution in my 2nd post was about moving the partitons. However, the solution had a mistake which is why I removed it. I had to use dd command to move all the bytes from the old partition to the new partition.
Also, it is somewhat risky. If you do any mistake with the recovery partition (not sure about the other 5 partitions), you pretty much bricked the tablet. If I had anyway to unbrick it, I would do it. Since not, better lose the 840MB.
rkhat said:
I don't think you can do it with parted's move command because according to move's documentation, these are the only supported formats:
Partitions 24-29 don't use a file system supported by parted. They definitely contain data (for example recovery partition has your twrp recovery image ).
I think there is a way to do what you are suggesting. In fact, the solution in my 2nd post was about moving the partitons. However, the solution had a mistake which is why I removed it. I had to use dd command to move all the bytes from the old partition to the new partition.
Also, it is somewhat risky. If you do any mistake with the recovery partition (not sure about the other 5 partitions), you pretty much bricked the tablet. If I had anyway to unbrick it, I would do it. Since not, better lose the 840MB.
Click to expand...
Click to collapse
Yeah, that's the one that scares me. That recovery partition is smack dab in the middle, and it's very ... inconvenient.
Anyone try this with the Nexus 7 2013 LTE version?
better 64gb
https://forum.xda-developers.com/picture.php?albumid=14541&pictureid=56454
Rather than move the system partition, I just moved the cache partition ahead of userdata and extended my system partition by 587MB. This allowed me to keep the same partition numbers and have no unused space.
And after flashing an image if you want to extend the logical drive to fill the partition manually, the command is:
Code:
resize2fs -f /dev/block/mmcblk0p22
Magendanz said:
Rather than move the system partition, I just moved the cache partition ahead of userdata and extended my system partition by 587MB. This allowed me to keep the same partition numbers and have no unused space.
Click to expand...
Click to collapse
Could you explain a bit more how to do that ?
I have read on a few websites that Android Oreo doesn't use the cache partition anymore. If this is true, could it also be simply removed instead of moved ?
Non-destructive repartition script
rkhat said:
The only issue with Nexus 7 is that the recovery partition is between the system and cache partitions in the partition table.
Code:
Number Start End Size File system Name Flags
22 671088640B 1551892479B 880803840B ext2 system
23 1551892480B 2139095039B 587202560B ext4 cache
24 2147483648B 2148532223B 1048576B misc
25 2214592512B 2225078271B 10485760B recovery
Click to expand...
Click to collapse
Have another look at the table - recovery is not between the system and cache partitions.
k23m said:
No, there is no way to unbrick the tablet.
Click to expand...
Click to collapse
I wrote it a year ago, but now we do have a way to unbrick the tablet, so read on and feel free to experiment
wline said:
I have read on a few websites that Android Oreo doesn't use the cache partition anymore. If this is true, could it also be simply removed instead of moved ?
Click to expand...
Click to collapse
Good point. N7's cache is oversized anyway, all my relatively new Xiaomi phones use only 256MB cache. There is no need for complex re-partitioning if we opt for decreased cache. I just did this...
Code:
Number Start End Size File system Name Flags
22 640MiB 1780MiB 1140MiB ext2 system
23 1780MiB 2040MiB 260MiB ext4 cache
24 2048MiB 2049MiB 1.00MiB misc
25 2112MiB 2122MiB 10.0MiB recovery
Code:
Filesystem Size Used Available Use% Mounted on
/dev/block/mmcblk0p30
26.4G 7.0G 19.4G 27% /data
/dev/block/mmcblk0p22
1.1G 607.0M 517.3M 54% /system
/dev/block/mmcblk0p23
258.8M 19.0M 226.7M 8% /cache
Now I have 1.1GB non-destructively resized system and 260MB cache. No changes to other partitions and original OS still works without any backup/restore. It was only a test because personally I have no need for larger system partition. I install LineageOS with pico gapps and later add other Google apks as non-system in the data partition space. I attached a script for the 1.1GB/260MB re-partition. While it is non-destructive, you should do a backup and copy it to your PC first.
Use the latest TWRP and just install sysrepart.zip. The script will create a backup of your original gpt partition table and a log file in the root of internal storage. If you have any issues, post the log.
If you wish to restore original partitioning, install sysrepartundo.zip. This script will attempt to non-destructively resize system again but if you installed some mega-gapps, it will obviously fail. In this case, use TWRP and manually format the system partition, then restore system's backup.
:good:
k23m said:
Have another look at the table - recovery is not between the system and cache partitions.
Click to expand...
Click to collapse
That was a typo. It should be between system and userdata because I am taking from userdata to increase the system partition. I'll edit the main post.
k23m said:
I wrote it a year ago, but now we do have a way to unbrick the tablet, so read on and feel free to experiment
Click to expand...
Click to collapse
Is your guide for soft-unbrick only?
I don't think fastboot can resize or rename a partition. So if you resized the recovery partition to a smaller size or forgot to name a partition "recovery", will your solution be able to handle these situations?

[GUIDE] Universal guide for making your partitions inside super read-writable again.

Disclaimer: I'm not responsible for any result of these operations. Please be careful and well prepared. Always have your important data backed up safely on other place.
Hello everyone!
As far as 2022 and Xiaomi gets their new phones updated to MIUI13 and Android 12, they implement the new read-only filesystem "EROFS" on the logical partitions inside super partition. EROFS is a filesystem initial developed by Huawei and then Google select it as a new standard to use in read only logical partition inside super partition from Android 12. The "EROFS", is the short for "Extendable (or Enhanced?) Read-Only Filesystem", conveying that this filesystem is a one-time cooked filesystem and cannot be changed without extracting and re-cooking. With erofs we cannot modify the logical partition anymore so I found a new way to unlock these partitions.
I just faced and managed to solve the "lock" and I would like to share the solution, which may help more people.
My device: Xiaomi 12 (cupid).
System: Stock MIUI13 (Android 12).
Logical partitions with read-only lock inside super partition: system, vendor, product, system_ext, odm, vendor_dlkm. All of them are erofs filesystem.
Be aware that this device is virtual a/b and the _b partitions inside super are 0k blank files. No need to do anything with them.
In theory, all devices shipping with erofs partitions inside super are compatible with this method. Feedbacks are always welcome!
Before we start: This guide is for Android power users that wish to make their Android 12+ read-only system/vendor.... partitions with EROFS filesystem inside super read-writeable again to remove the bloatware and do more customizations to their device.
Credits:
@Yuki1001 - EROFS Guide, research, new rw discoveries.
@lebigmac - a couple of rw slogans, some binaries, inspiration.
Requirements:
1. Your phone must be unlocked as you must flash your new super.img through fastboot command. Root is required to run any command in a terminal (win cmd or linux terminal).
2. 20GB+ free space on your phone and PC.
3. The toolkit needed.
4. A clever brain and courage.
So in short, the tutorial contains these part:
(1) Dump and extract your super image.
(2) Pull the folder with partition images extracted from super image to the PC.
(3) Convert these erofs images to ext4 images (Extract and Rebuild). These new images are in the same folder.
(4) Push the folder to the phone and fix any errors of new generated ext4 images.
(5) Merge them into a new single sparse super image and pull it to the PC.
(6) Flash the new image through fastboot command.
(7) Check the rw capability of the logical partitions and do anything you want!
Let's start now!
1. Get your super image by dumping your current super partition. We can find our super partition in this way:
Code:
su
cd /dev/block/bootdevice/by-name
ls -al | grep "super"
You will get the output like this:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Then we knows the super partition block number and path immediately. Let's dump its data to a file.
Code:
dd if=%PATH_TO_SUPER_BLOCK% of=/data/local/tmp/super_orig.img bs=4096
Wait for the data transfer done and we can get the super image. DO NOT forget to replace "%PATH_TO_SUPER_BLOCK%" with your own super block path!
2. Now we can do things with the super_orig.img: Extract logical partitions inside super partition to a folder. I will use Google's official tool: lpunpack. For example, I extract these partitions inside super to "sup_unpack" folder. Give all binaries in tools folder with executive permission in advance.
Code:
./tools/lpunpack ./super_orig.img sup_unpack
Now check with the folder to confirm whether these partitions insider super are extracted. If so, we can transmit the folder to the PC with adb pull. Extract my unlock-super folder in advance and we need to place the pulled out folder in it.
Code:
adb pull /data/local/tmp/sup_unpack
Now the "sup_unpack" folder exists in the platform-tools folder. Move it to the "unlock-super" folder.
3. Extract these erofs images one by one with erofsUnpackRust.exe and repack them into ext4 image. Check the folders' size to determine how big space does the new ext4 filesystem need. I'd like to recommend you to preset some free space for every new ext4 images for further modifications.
You are required to remove all _a suffix for the images in order to make the following program works properly. For example: system_a.img --> system.img. You have been warned!
For example:
Code:
erofsUnpackRust sup_unpack/system.img system
erofsUnpackRust sup_unpack/vendor.img vendor
erofsUnpackRust sup_unpack/product.img product
.... (and so on)
You will get the output like these screenshots:
For building a new image, we need to set a timestamp for all files included. I use 1230764400 as it equals the original file timestamp in erofs image. DO NOT forget to replace %FS_SIZE% with your real fs size you want. So go with the following command:
Code:
***DO NOT COPY!***
Example:
System:
make_ext4fs -J -T 1230764400 -S system/config/system_file_contexts -l %FS_SIZE% -C system/config/system_fs_config -L system -a system system_a.img system/system
Vendor:
make_ext4fs -J -T 1230764400 -S vendor/config/vendor_file_contexts -l %FS_SIZE% -C vendor/config/vendor_fs_config -L vendor -a vendor vendor_a.img vendor/vendor
For odm, product, system_ext, vendor_dlkm...... and other partitions, use the same step.
You should get the output like these screenshots:
When you completed the steps above you should have the images in ext4 format. Then make a folder named "new_ext4" and move the new image files (_a suffix) to the new_ext4 folder. Make sure all partitions' images are correctly rebuilt.
Copy the _b blank files toghether with new built _a images:
4. Push the folder that contains your image to /data/local/tmp again. In my case use this command:
Code:
adb push new_ext4 /data/local/tmp/new_ext4
Then check whether the new folder exists in the correct place. DO NOT forget to use e2fsck -yf to fix any errors of the new images before joining them into a super image.
5. Now we have all partitions unlocked and corrected but we need to join them into a single "super_new.img" for flashing. Use the lpmake tool to create the new "super_new.img". Again, DO NOT forget to replace %SUPER_SIZE% with your super partition's physical size (the size of super_orig.img) , and replace mulitiple %SIZE% with the real size of your new built ext4 images (with _a suffix) .
Code:
***DO NOT COPY!***
cd /data/local/tmp/new_ext4
../tools/lpmake --output super_new.img --sparse --metadata-size 65536 --super-name super --metadata-slots 2 --device super:%SUPER_SIZE% --group slot_a:%SUPER_SIZE% --group slot_b:0 --partition system_a:none:%SIZE%:slot_a --image system_a=./system_a.img --partition vendor_a:none:%SIZE%:slot_a --image vendor_a=./vendor_a.img --partition product_a:none:%SIZE%:slot_a --image product_a=./product_a.img --partition system_ext_a:none:%SIZE%:slot_a --image system_ext_a=./system_ext_a.img --partition odm_a:none:%SIZE%:slot_a --image odm_a=./odm_a.img --partition vendor_dlkm_a:none:%SIZE%:slot_a --image vendor_dlkm_a=./vendor_dlkm_a.img --partition odm_b:none:0:slot_b --image odm_b=./odm_b.img --partition system_b:none:0:slot_b --image system_b=./system_b.img --partition vendor_b:none:0:slot_b --image vendor_b=./vendor_b.img --partition product_b:none:0:slot_b --image product_b=./product_b.img --partition system_ext_b:none:0:slot_b --image system_ext_b=./system_ext_b.img --partition vendor_dlkm_b:none:0:slot_b --image vendor_dlkm_b=./vendor_dlkm_b.img
In the command we use --sparse parameter to let the new joined super image sparse, for the following fastboot flash.
6. Pull the new super_new.img to the computer. Do the fastboot flash. Erase the super partition and flash the new image.
Code:
adb pull /data/local/tmp/new_ext4/super_new.img
fastboot erase super
fastboot flash super super_new.img
Now the partitions inside super should already have full r/w capability. Reboot the phone to check whether they can be mounted as r/w.
Voila!
All tools are provided as attachments.
Password: super-rw
If you think it's useful, please click the "Like" button. Thanks!
Reserved floor #2.
Reserved floor #3.
\unlock-super>erofsUnpackRust Download/product.img product
erofsUnpack 1.3.211216
<E> erofs: cannot find valid erofs superblock
thread '<unnamed>' panicked at 'read erofs super block failed', src\lib.rs:168:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
getting this error in vendor extracting
C:\unlock-super>erofsUnpackRust Download/product.img product
erofsUnpack 1.3.211216
<E> erofs: cannot find valid erofs superblock
thread '<unnamed>' panicked at 'read erofs super block failed', src\lib.rs:168:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
now this is
unlock-super>make_ext4fs -J -T 1230764400 -S system/config/system_file_contexts -l 626733056 -C system/config/system_fs_config -L system -a system system_a.img system/system
loaded 3141 fs_config entries
Creating filesystem with parameters:
Size: 626733056
Block size: 4096
Blocks per group: 32768
Inodes per group: 7664
Inode size: 256
Journal blocks: 0
Label: system
Blocks: 153011
Block groups: 5
Reserved block group size: 39
error: ext4_allocate_best_fit_partial: failed to allocate 4720 blocks, out of space?
Failed to create image system_a.img, removing it
Mr Hassan said:
now this is
unlock-super>make_ext4fs -J -T 1230764400 -S system/config/system_file_contexts -l 626733056 -C system/config/system_fs_config -L system -a system system_a.img system/system
loaded 3141 fs_config entries
Creating filesystem with parameters:
Size: 626733056
Block size: 4096
Blocks per group: 32768
Inodes per group: 7664
Inode size: 256
Journal blocks: 0
Label: system
Blocks: 153011
Block groups: 5
Reserved block group size: 39
error: ext4_allocate_best_fit_partial: failed to allocate 4720 blocks, out of space?
Failed to create image system_a.img, removing it
Click to expand...
Click to collapse
The size setting of your new ext4 img is too small. Consider a larger value.
EDIT: Normally, your files maybe 2GB+ larger than the erofs img. Check your files' real size and give a good value to -l parameter.
Yuki1001 said:
The size setting of your new ext4 img is too small. Consider a larger value.
EDIT: Normally, your files maybe 2GB+ larger than the erofs img. Check your files' real size and give a good value to -l parameter.
Click to expand...
Click to collapse
My ext have around 900mb
And vendor something like 1400mb
And both are getting same error
I thought maybe big size i just try remove some file but still same
If its small size issue then how can increase or large it?
Or should i merge both partitions on same but i don't think it'll be possible
Mr Hassan said:
My ext have around 900mb
And vendor something like 1400mb
And both are getting same error
I thought maybe big size i just try remove some file but still same
If its small size issue then how can increase or large it?
Or should i merge both partitions on same but i don't think it'll be possible
Click to expand...
Click to collapse
Would you like to take some screenshots of your extracted folder's size and the original image's size?
PS: After calculating all your files' total size, I recommend you to reserve at least 500MB+ free space inside your new ext4 image.
Mr Hassan said:
My ext have around 900mb
And vendor something like 1400mb
And both are getting same error
I thought maybe big size i just try remove some file but still same
If its small size issue then how can increase or large it?
Or should i merge both partitions on same but i don't think it'll be possible
Click to expand...
Click to collapse
You on oos 11 ?oos 11 have no erofs
Oos 12 have erofs
ChrisFeiveel84 said:
You on oos 11 ?oos 11 have no erofs
Oos 12 have erofs
Click to expand...
Click to collapse
Ofcourse I'm in os12
Yuki1001 said:
Would you like to take some screenshots of your extracted folder's size and the original image's size?
PS: After calculating all your files' total size, I recommend you to reserve at least 500MB+ free space inside your new ext4 image.
Click to expand...
Click to collapse
Sure tomorrow I'll send you the screen shot of unpack and img both images
Yuki1001 said:
Before we start: This guide is for Android power users that wish to make their Android 12+ read-only system/vendor.... partitions with EROFS filesystem inside super read-writeable again to remove the bloatware and do more customizations to their device.
Click to expand...
Click to collapse
Yuki1001 said:
Now the partitions inside super should already have full r/w capability. Reboot the phone to check whether they can be mounted as r/w.
Click to expand...
Click to collapse
Hi @Yuki1001
Please keep up the great work! The more people have RW access to their own devices the better for the open source community!
If you want to integrate your erofs fix into my script please contact me! Of course you will be properly credited!
Well its not looks like yours kind of
But you know better
But its good thing if he helping people's with a different way
I personally like this thread becoz i just want to make one vendor rw
And then I'm able to boot after flash
edited remove quote on @
Yuki1001 request​
and today its not even unpack dont know where doing mistake
unlock-super>erofsUnpackRust Download/vendor.img vendor
erofsUnpack 1.3.211216
<E> erofs: cannot find valid erofs superblock
thread '<unnamed>' panicked at 'read erofs super block failed', src\lib.rs:168:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Reserved floor#16.
Mr Hassan said:
and today its not even unpack dont know where doing mistake
unlock-super>erofsUnpackRust Download/vendor.img vendor
erofsUnpack 1.3.211216
<E> erofs: cannot find valid erofs superblock
thread '<unnamed>' panicked at 'read erofs super block failed', src\lib.rs:168:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Click to expand...
Click to collapse
I had problems extracting my vendor.img using others' erofs unpack tools. Only the erofsunpackrust.exe works. Maybe your vendor.img is special? (which means you need to try other erofs unpack tools for luck)
Yuki1001 said:
I had problems extracting my vendor.img using others' erofs unpack tools. Only the erofsunpackrust.exe works. Maybe your vendor.img is special? (which means you need to try other erofs unpack tools for luck)
Click to expand...
Click to collapse
but same thing i used before and works for me and you see upper results
anyway now is there any other erofs avaliable to test?
Yuki1001 said:
Would you like to take some screenshots of your extracted folder's size and the original image's size?
PS: After calculating all your files' total size, I recommend you to reserve at least 500MB+ free space inside your new ext4 image.
Click to expand...
Click to collapse
here,s the size of vendor unpack and repack
Mr Hassan said:
View attachment 5716687View attachment 5716689
here,s the size of vendor unpack and repack
Click to expand...
Click to collapse
So you could to set the ext4 vendor image to 2G. 2G = 2147483678 bytes. Try to set the -l parameter to 2147483648.

Categories

Resources