Mount android emulator vendor.img as read-write in Ubuntu

I want to poke a bit at a vendor.img file delivered as part of the android emulator system images. I am particulaly interested in Android 11 (API level 30).

I would like to mount it on a Ubuntu machine, modify it and then save it. With older versions (<= Android 9 (API level 28)), I can do this by mounting, modify and unmount it. But with Android 11 I get an error when I am mounting the image as rw.

These are the commands that I use:

$ fdisk -lu vendor.img
Disk vendor.img: 101 MiB, 105906176 bytes, 206848 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 5AE1C1A8-BAFF-4DE4-A85A-7A7093FA8019
Device Start End Sectors Size Type
vendor.img1 2048 204799 202752 99M Linux filesystem
$ sudo mount -t auto -o rw,loop,offset=$((2048*512)) vendor.img /mnt/vendor/
mount: /mnt/vendor: wrong fs type, bad option, bad superblock on /dev/loop17, missing codepage or helper program, or other error.

Mounting as ro works fine:

$ sudo mount -t auto -o ro,loop,offset=$((2048*512)) vendor.img /mnt/vendor/

But trying to remount it as rw doesn't:

$ sudo mount -o remount,rw /mnt/vendor/
mount: /mnt/vendor: cannot remount /dev/loop17 read-write, is write-protected.

How is this rw protection mechanism implemented, and how could I disable it?

2 Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like