修复adb remount失败问题

一,错误log

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
$ adb disable-verity
disable-verity only works for userdebug builds
Overlayfs setup failed with error No such process
Now reboot your device for settings to take effect
$ adb remount
virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
[libfs_mgr]could not map scratch image
Overlayfs setup for /system failed, skipping: No such process
virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
[libfs_mgr]could not map scratch image
Overlayfs setup for /vendor failed, skipping: No such process
virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
[libfs_mgr]could not map scratch image
Overlayfs setup for /system_ext failed, skipping: No such process
virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
[libfs_mgr]could not map scratch image
Overlayfs setup for /product failed, skipping: No such process
No partitions to remount
remount failed

logcat

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
01-01 05:57:42.090  2567  2567 W device-mapper: table: 254:4: len=139924 not aligned to h/w logical block size 4096 of sda12
01-01 05:57:42.101 2567 2567 E device-mapper: core: Cannot calculate initial queue limits
01-01 05:57:42.108 2567 2567 W device-mapper: ioctl: unable to set up device queue for new table.
08-15 16:03:17.785 2567 2567 E gsid : DM_TABLE_LOAD failed: Invalid argument
08-15 16:03:17.811 2567 2567 E gsid : Didn't generate uevent for [scratch] removal
08-15 16:03:17.811 2567 2567 E gsid : Error creating device-mapper node for image scratch
08-15 16:03:17.812 2564 2564 E remount : virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
08-15 16:03:17.812 2564 2564 E remount : [libfs_mgr]could not map scratch image
08-15 16:03:17.812 2564 2564 E remount : Overlayfs setup for /system failed, skipping: No such process
01-01 05:57:42.153 2567 2567 W device-mapper: table: 254:4: len=139924 not aligned to h/w logical block size 4096 of sda12
01-01 05:57:42.163 2567 2567 E device-mapper: core: Cannot calculate initial queue limits
01-01 05:57:42.171 2567 2567 W device-mapper: ioctl: unable to set up device queue for new table.
08-15 16:03:17.848 2567 2567 E gsid : DM_TABLE_LOAD failed: Invalid argument
08-15 16:03:17.848 2567 2567 E gsid : Didn't generate uevent for [scratch] removal
08-15 16:03:17.848 2567 2567 E gsid : Error creating device-mapper node for image scratch
08-15 16:03:17.848 2564 2564 E remount : virtual bool android::fiemap::ImageManagerBinder::MapImageDevice(const std::string &, const std::chrono::milliseconds &, std::string *) binder returned: Failed to map
08-15 16:03:17.848 2564 2564 E remount : [libfs_mgr]could not map scratch image
08-15 16:03:17.848 2564 2564 E remount : Overlayfs setup for /vendor failed, skipping: No such process

二,fixed

关键错误: device-mapper: table: 254:4: len=139924 not aligned to h/w logical block size 4096 of sda12

  • 在代码中查看 BOARD_FLASH_BLOCK_SIZE

    1
    2
    $ get_build_var BOARD_FLASH_BLOCK_SIZE
    131072
  • 修改

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    diff --git a/rb5/BoardConfig.mk b/rb5/BoardConfig.mk
    index 92f536b..c081250 100644
    --- a/rb5/BoardConfig.mk
    +++ b/rb5/BoardConfig.mk
    @@ -38,7 +38,7 @@ BOARD_BOOTCONFIG += androidboot.verifiedbootstate=orange
    BOARD_BOOTIMAGE_PARTITION_SIZE := 103079215104 #96M
    BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE := 103079215104 #96M
    BOARD_USERDATAIMAGE_PARTITION_SIZE := 21474836480
    -BOARD_FLASH_BLOCK_SIZE := 131072
    +BOARD_FLASH_BLOCK_SIZE := 4096

三,问题总结

本次 adb remount 失败的核心原因在于 BoardConfig 中定义的闪存块大小(BOARD_FLASH_BLOCK_SIZE)与硬件实际的逻辑块大小不匹配,导致了 device-mapper 在创建 OverlayFS 所需的 scratch 设备时出现地址对齐错误。

  • 官方修复
    查了下,官方已修复这个问题
    https://android-review.googlesource.com/c/device/linaro/dragonboard/+/2164963
    1
    2
    3
    4
    5
    6
    7
    8
    db845c: Set the flash block size to 4096

    While running system/core/fs_mgr/tests/adb-remount-test.sh
    device-mapper reports h/w logical block size to be 4096.
    So updating the BOARD_FLASH_BLOCK_SIZE accordingly.

    Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
    Change-Id: Ia300194969da0bfb5ab47b77b130da7be3acc577

编译机:Ubuntu-22.04 AMD 5800X
手机:Qualcomm Robotics RB5
源码版本:AOSP android-13.0.0_r74
内核版本:common-android13-5.15


修复adb remount失败问题
https://hqw700.github.io/2025/09/24/2025-09-24-fix-adb-remount-error/
发布于
2025年9月24日
许可协议