Skip to content

Commit

Permalink
Merge pull request #3129 from cgwalters/fix-unlock-composefs-compat
Browse files Browse the repository at this point in the history
prepare-root: Fix composefs + ostree admin unlock --hotfix compat
  • Loading branch information
cgwalters committed Jan 4, 2024
2 parents 6a339ac + a1c1c0b commit 9faf556
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/switchroot/ostree-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,18 +644,11 @@ main (int argc, char *argv[])
= "lowerdir=" TMP_SYSROOT
"/usr,upperdir=.usr-ovl-upper,workdir=" OTCORE_HOTFIX_USR_OVL_WORK;

/* Except overlayfs barfs if we try to mount it on a read-only
* filesystem. For this use case I think admins are going to be
* okay if we remount the rootfs here, rather than waiting until
* later boot and `systemd-remount-fs.service`.
*/
if (path_is_on_readonly_fs (TMP_SYSROOT))
{
if (mount (TMP_SYSROOT, TMP_SYSROOT, NULL, MS_REMOUNT | MS_SILENT, NULL) < 0)
err (EXIT_FAILURE, "failed to remount rootfs writable (for overlayfs)");
}

if (mount ("overlay", TMP_SYSROOT "/usr", "overlay", MS_SILENT, usr_ovl_options) < 0)
unsigned long mflags = MS_SILENT;
// Propagate readonly state
if (!sysroot_currently_writable)
mflags |= MS_RDONLY;
if (mount ("overlay", TMP_SYSROOT "/usr", "overlay", mflags, usr_ovl_options) < 0)
err (EXIT_FAILURE, "failed to mount /usr overlayfs");
}
else if (!using_composefs)
Expand Down

0 comments on commit 9faf556

Please sign in to comment.