diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp index 07ce4588d..ff95487fe 100644 --- a/init/first_stage_mount.cpp +++ b/init/first_stage_mount.cpp @@ -518,6 +518,12 @@ bool FirstStageMount::TrySwitchSystemAsRoot() { SwitchRoot("/system"); + // Make /system a mountpoint so that adb-remount can move submounts under /system. + if (access("/system", F_OK) == 0 && + mount("/system", "/system", nullptr, MS_BIND, nullptr) != 0) { + PLOG(WARNING) << "Failed to bind mount /system for overlayfs"; + } + return true; }