• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Mount system.ext4 or super.img as read write Android 10+

Status
Not open for further replies.
Search This thread

lebigmac

Senior Member
Jan 31, 2017
873
507
Mod Edit

New thread is located here: https://forum.xda-developers.com/t/script-mount-system-as-read-write-android-10.4240703/

Mod Edit End

So I managed to successfully run the command that @topjohnwu suggested on Twitter
e2fsck -E unshare_blocks system.ext4
directly on the extracted system.ext4 image file (which was extracted from super.img using this amazing tool)

And the image still fails to be mounted as rw using the command below. Mounting as ro works just fine though.
Code:
 sudo mount -t ext4 -o loop,rw system.ext4 /mnt/dir
mount: /mnt/dir: wrong fs type, bad option, bad superblock on /dev/loop18, missing codepage or helper program, or other error.

Code:
root:~# e2fsck -E unshare_blocks system.ext4
[...]
/system/lib/libpdfium.so (inode #3345, mod time Thu Jan  1 02:00:00 2009)
    /system/lib/libhwui.so (inode #3260, mod time Thu Jan  1 02:00:00 2009)
    /system/lib/libchrome.so (inode #3204, mod time Thu Jan  1 02:00:00 2009)
    /system/lib/libbluetooth.so (inode #3184, mod time Thu Jan  1 02:00:00 2009)
    /system/apex/com.android.runtime.release.apex (inode #119, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8100.kl (inode #5649, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 3 file(s):
    /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8100.kl (inode #5653, mod time Thu Jan  1 02:00:00 2009)
    /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8000.kl (inode #5652, mod time Thu Jan  1 02:00:00 2009)
    /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8000.kl (inode #5648, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8111.kl (inode #5650, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 1 file(s):
    /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8111.kl (inode #5654, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/keylayout/Vendor_054c_Product_09cc.kl (inode #5651, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 1 file(s):
    /system/usr/keylayout/Vendor_054c_Product_05c4.kl (inode #5647, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8000.kl (inode #5652, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 3 file(s):
    /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8100.kl (inode #5653, mod time Thu Jan  1 02:00:00 2009)
    /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8100.kl (inode #5649, mod time Thu Jan  1 02:00:00 2009)
    /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8000.kl (inode #5648, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8100.kl (inode #5653, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 3 file(s):
    /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8000.kl (inode #5652, mod time Thu Jan  1 02:00:00 2009)
    /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8100.kl (inode #5649, mod time Thu Jan  1 02:00:00 2009)
    /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8000.kl (inode #5648, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8111.kl (inode #5654, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 1 file(s):
    /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8111.kl (inode #5650, mod time Thu Jan  1 02:00:00 2009)
clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
Couldn't clone file: Could not allocate block in ext2 filesystem
File /system/usr/share/zoneinfo/tz_version (inode #5688, mod time Thu Jan  1 02:00:00 2009)
  has 1 multiply-claimed block(s), shared with 1 file(s):
    /system/apex/com.android.runtime.release.apex (inode #119, mod time Thu Jan  1 02:00:00 2009)
Multiply-claimed blocks already reassigned or cloned.

File /system/usr/share/zoneinfo/tzdata (inode #5689, mod time Thu Jan  1 02:00:00 2009)
  has 124 multiply-claimed block(s), shared with 1 file(s):
    /system/apex/com.android.runtime.release.apex (inode #119, mod time Thu Jan  1 02:00:00 2009)
Multiply-claimed blocks already reassigned or cloned.

Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 3A: Optimizing directories
Failed to optimize directory /system/fonts (2249): Could not allocate block in ext2 filesystem
Failed to optimize directory /system/lib (2995): Could not allocate block in ext2 filesystem
Failed to optimize directory /system/lib/vndk-29 (3507): Could not allocate block in ext2 filesystem
Failed to optimize directory /system/lib64 (3762): Could not allocate block in ext2 filesystem
Failed to optimize directory /system/lib64/vndk-29 (4434): Could not allocate block in ext2 filesystem
Pass 4: Checking reference counts
Pass 5: Checking group summary information

/: ***** FILE SYSTEM WAS MODIFIED *****

/: ********** WARNING: Filesystem still has errors **********

/: 5704/6048 files (20.8% non-contiguous), 655526/655526 blocks
 
Last edited by a moderator:
  • Like
Reactions: thor_1979

lebigmac

Senior Member
Jan 31, 2017
873
507
Trying to remove the shared_blocks feature from the extracted system.ext4 is not allowed using the stock tune2fs:

Code:
sudo tune2fs -f -O ^shared_blocks ./system_test.ext4
tune2fs 1.44.6 (5-Mar-2019)
Clearing filesystem feature 'shared_blocks' not supported.
 
  • Like
Reactions: thor_1979

lebigmac

Senior Member
Jan 31, 2017
873
507
I replaced all 4 occurences of these three bytes in my super.img like suggested here and flashed it to my phone.
It didn't boot probably due to the invalid sha256 checksums as predicted.

Which bytes I must hex edit in the extracted system.ext4 in order to make it rw? I was thinking maybe the shared_blocks feature?

super-jpg.5230839
 

lebigmac

Senior Member
Jan 31, 2017
873
507
lol enough with the hex editing already.

Guys this is just a heads up that now there's a 1-click solution for all those enthousiasts that would like to make their Android 10+ system read-write-able again just like it used to be in Android 9 and earlier.

Tested on Xiaomi Poco X3 NFC surya and works great over here!

The solution was burried deep inside the new forum interface and was really hard to find so I decided to write this little automatic bash script for all Linux users that would like to debloat their device a bit more thoroughly.

Check it out here:
https://forum.xda-developers.com/t/script-mount-system-as-read-write-android-10.4240703/
 
  • Like
Reactions: ardasher
Status
Not open for further replies.

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Mod Edit

    New thread is located here: https://forum.xda-developers.com/t/script-mount-system-as-read-write-android-10.4240703/

    Mod Edit End

    So I managed to successfully run the command that @topjohnwu suggested on Twitter
    e2fsck -E unshare_blocks system.ext4
    directly on the extracted system.ext4 image file (which was extracted from super.img using this amazing tool)

    And the image still fails to be mounted as rw using the command below. Mounting as ro works just fine though.
    Code:
     sudo mount -t ext4 -o loop,rw system.ext4 /mnt/dir
    mount: /mnt/dir: wrong fs type, bad option, bad superblock on /dev/loop18, missing codepage or helper program, or other error.

    Code:
    root:~# e2fsck -E unshare_blocks system.ext4
    [...]
    /system/lib/libpdfium.so (inode #3345, mod time Thu Jan  1 02:00:00 2009)
        /system/lib/libhwui.so (inode #3260, mod time Thu Jan  1 02:00:00 2009)
        /system/lib/libchrome.so (inode #3204, mod time Thu Jan  1 02:00:00 2009)
        /system/lib/libbluetooth.so (inode #3184, mod time Thu Jan  1 02:00:00 2009)
        /system/apex/com.android.runtime.release.apex (inode #119, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8100.kl (inode #5649, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 3 file(s):
        /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8100.kl (inode #5653, mod time Thu Jan  1 02:00:00 2009)
        /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8000.kl (inode #5652, mod time Thu Jan  1 02:00:00 2009)
        /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8000.kl (inode #5648, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8111.kl (inode #5650, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 1 file(s):
        /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8111.kl (inode #5654, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/keylayout/Vendor_054c_Product_09cc.kl (inode #5651, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 1 file(s):
        /system/usr/keylayout/Vendor_054c_Product_05c4.kl (inode #5647, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8000.kl (inode #5652, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 3 file(s):
        /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8100.kl (inode #5653, mod time Thu Jan  1 02:00:00 2009)
        /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8100.kl (inode #5649, mod time Thu Jan  1 02:00:00 2009)
        /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8000.kl (inode #5648, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8100.kl (inode #5653, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 3 file(s):
        /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8000.kl (inode #5652, mod time Thu Jan  1 02:00:00 2009)
        /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8100.kl (inode #5649, mod time Thu Jan  1 02:00:00 2009)
        /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8000.kl (inode #5648, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/keylayout/Vendor_054c_Product_09cc_Version_8111.kl (inode #5654, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 1 file(s):
        /system/usr/keylayout/Vendor_054c_Product_05c4_Version_8111.kl (inode #5650, mod time Thu Jan  1 02:00:00 2009)
    clone_file: Could not allocate block in ext2 filesystem returned from clone_file_block
    Couldn't clone file: Could not allocate block in ext2 filesystem
    File /system/usr/share/zoneinfo/tz_version (inode #5688, mod time Thu Jan  1 02:00:00 2009)
      has 1 multiply-claimed block(s), shared with 1 file(s):
        /system/apex/com.android.runtime.release.apex (inode #119, mod time Thu Jan  1 02:00:00 2009)
    Multiply-claimed blocks already reassigned or cloned.
    
    File /system/usr/share/zoneinfo/tzdata (inode #5689, mod time Thu Jan  1 02:00:00 2009)
      has 124 multiply-claimed block(s), shared with 1 file(s):
        /system/apex/com.android.runtime.release.apex (inode #119, mod time Thu Jan  1 02:00:00 2009)
    Multiply-claimed blocks already reassigned or cloned.
    
    Pass 2: Checking directory structure
    Pass 3: Checking directory connectivity
    Pass 3A: Optimizing directories
    Failed to optimize directory /system/fonts (2249): Could not allocate block in ext2 filesystem
    Failed to optimize directory /system/lib (2995): Could not allocate block in ext2 filesystem
    Failed to optimize directory /system/lib/vndk-29 (3507): Could not allocate block in ext2 filesystem
    Failed to optimize directory /system/lib64 (3762): Could not allocate block in ext2 filesystem
    Failed to optimize directory /system/lib64/vndk-29 (4434): Could not allocate block in ext2 filesystem
    Pass 4: Checking reference counts
    Pass 5: Checking group summary information
    
    /: ***** FILE SYSTEM WAS MODIFIED *****
    
    /: ********** WARNING: Filesystem still has errors **********
    
    /: 5704/6048 files (20.8% non-contiguous), 655526/655526 blocks
    1
    Trying to remove the shared_blocks feature from the extracted system.ext4 is not allowed using the stock tune2fs:

    Code:
    sudo tune2fs -f -O ^shared_blocks ./system_test.ext4
    tune2fs 1.44.6 (5-Mar-2019)
    Clearing filesystem feature 'shared_blocks' not supported.
    1
    lol enough with the hex editing already.

    Guys this is just a heads up that now there's a 1-click solution for all those enthousiasts that would like to make their Android 10+ system read-write-able again just like it used to be in Android 9 and earlier.

    Tested on Xiaomi Poco X3 NFC surya and works great over here!

    The solution was burried deep inside the new forum interface and was really hard to find so I decided to write this little automatic bash script for all Linux users that would like to debloat their device a bit more thoroughly.

    Check it out here:
    https://forum.xda-developers.com/t/script-mount-system-as-read-write-android-10.4240703/