From 5b6d208801d0140fe65f2c35dec297a9f0dc47a8 Mon Sep 17 00:00:00 2001 From: Misaki Kasumi Date: Thu, 10 Oct 2024 20:38:34 +0800 Subject: [PATCH] prepare-root: allow sysroot.readonly=true with kernel cmdline ro --- src/switchroot/ostree-mount-util.h | 4 ---- src/switchroot/ostree-prepare-root-static.c | 2 -- src/switchroot/ostree-prepare-root.c | 7 ------- 3 files changed, 13 deletions(-) diff --git a/src/switchroot/ostree-mount-util.h b/src/switchroot/ostree-mount-util.h index 608528f35a..eb79efdfbf 100644 --- a/src/switchroot/ostree-mount-util.h +++ b/src/switchroot/ostree-mount-util.h @@ -36,10 +36,6 @@ #define _OSTREE_SYSROOT_READONLY_STAMP "/run/ostree-sysroot-ro.stamp" #define _OSTREE_COMPOSEFS_ROOT_STAMP "/run/ostree-composefs-root.stamp" -#define OTCORE_SYSROOT_NOT_WRITEABLE \ - "sysroot.readonly=true requires %s to be writable at this point, the cmdline should contain rw " \ - "but not ro, if that is not the case this is likely the issue" - #define autofree __attribute__ ((cleanup (cleanup_free))) static inline int diff --git a/src/switchroot/ostree-prepare-root-static.c b/src/switchroot/ostree-prepare-root-static.c index 3995a6f0fb..cf37891043 100644 --- a/src/switchroot/ostree-prepare-root-static.c +++ b/src/switchroot/ostree-prepare-root-static.c @@ -227,8 +227,6 @@ main (int argc, char *argv[]) * writable bind-mounts (for /etc and /var) are required later on. */ if (sysroot_readonly) { - if (!sysroot_currently_writable) - errx (EXIT_FAILURE, OTCORE_SYSROOT_NOT_WRITEABLE, root_arg); /* Pass on the fact that we discovered a readonly sysroot to ostree-remount.service */ int fd = open (_OSTREE_SYSROOT_READONLY_STAMP, O_WRONLY | O_CREAT | O_CLOEXEC, 0644); if (fd < 0) diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c index 7754673eeb..a002ad6e58 100644 --- a/src/switchroot/ostree-prepare-root.c +++ b/src/switchroot/ostree-prepare-root.c @@ -501,13 +501,6 @@ main (int argc, char *argv[]) g_variant_builder_add (&metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_ROOT_TRANSIENT, g_variant_new_boolean (root_transient)); - /* This will result in a system with /sysroot read-only. Thus, two additional - * writable bind-mounts (for /etc and /var) are required later on. */ - if (sysroot_readonly) - { - if (!sysroot_currently_writable) - errx (EXIT_FAILURE, OTCORE_SYSROOT_NOT_WRITEABLE, root_arg); - } /* Pass on the state for use by ostree-prepare-root */ g_variant_builder_add (&metadata_builder, "{sv}", OTCORE_RUN_BOOTED_KEY_SYSROOT_RO, g_variant_new_boolean (sysroot_readonly));