在編譯Android12 源碼虛擬機(jī)進(jìn)行調(diào)試時(shí)抄淑,需要remount 時(shí)有時(shí)會(huì)遇到下面錯(cuò)誤:
$adb remount
[liblp]bool android::fs_mgr::WritePrimaryMetadata(int, const android::fs_mgr::LpMetadata &, uint32_t, const std::string &, const std::function<bool (int, const std::string &)> &) write 740 bytes failed: Operation not permitted
[libfs_mgr]add partition scratch
[liblp]bool android::fs_mgr::WritePrimaryMetadata(int, const android::fs_mgr::LpMetadata &, uint32_t, const std::string &, const std::function<bool (int, const std::string &)> &) write 740 bytes failed: Operation not permitted
[libfs_mgr]add partition scratch
[liblp]bool android::fs_mgr::WritePrimaryMetadata(int, const android::fs_mgr::LpMetadata &, uint32_t, const std::string &, const std::function<bool (int, const std::string &)> &) write 740 bytes failed: Operation not permitted
[libfs_mgr]add partition scratch
[liblp]bool android::fs_mgr::WritePrimaryMetadata(int, const android::fs_mgr::LpMetadata &, uint32_t, const std::string &, const std::function<bool (int, const std::string &)> &) write 740 bytes failed: Operation not permitted
[libfs_mgr]add partition scratch
Can not mount overlayfs for partitions: No such file or directory
skip unmounted partition dev:/dev/block/dm-0 mnt:/system: Success
failed to remount partition dev:/dev/block/dm-3 mnt:/vendor: Read-only file system
Consider providing all the dependencies to enable overlayfs
failed to remount partition dev:/dev/block/dm-2 mnt:/product: Read-only file system
Consider providing all the dependencies to enable overlayfs
failed to remount partition dev:/dev/block/dm-1 mnt:/system_ext: Read-only file system
Consider providing all the dependencies to enable overlayfs
remount failed
這時(shí)需要在使用下面命令啟動(dòng)虛擬機(jī):
emulator -writable-system
-writable-system
使用此選項(xiàng)在模擬會(huì)話期間創(chuàng)建可寫(xiě)系統(tǒng)映像赴捞。為此,請(qǐng)執(zhí)行以下操作:
1、使用 -writable-system 選項(xiàng)啟動(dòng)虛擬設(shè)備宴咧。
2、從命令終端輸入 adb remount 命令,讓模擬器以讀/寫(xiě)方式重新裝載 system/(默認(rèn)情況下硕蛹,它以只讀方式裝載)。
官方參數(shù)文檔:https://developer.android.google.cn/studio/run/emulator-commandline?hl=zh-cn#startup-options
啟動(dòng)之后使用adb remount
硕并, 如果失敗法焰,執(zhí)行下面命令:
adb root
adb shell mount -o bind /system /system
adb shell mount -o rw,remount /