prepare-root: allow sysroot.readonly=true with kernel cmdline ro
authorMisaki Kasumi <misakikasumi@outlook.com>
Thu, 10 Oct 2024 12:38:34 +0000 (20:38 +0800)
committerMisaki Kasumi <misakikasumi@outlook.com>
Thu, 10 Oct 2024 12:38:34 +0000 (20:38 +0800)
src/switchroot/ostree-mount-util.h
src/switchroot/ostree-prepare-root-static.c
src/switchroot/ostree-prepare-root.c

index 608528f35ac1d6f8f78f726722e24fc281537a55..eb79efdfbfb1fe2db7682df8d06c2ec764329d59 100644 (file)
 #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
index 3995a6f0fb3ae20da23847a6d9dff8938b70048d..cf378910439dfbc389c18881f065514e96ae1465 100644 (file)
@@ -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)
index 7754673eebeed02e40fc8537da1ce25b8d323aef..a002ad6e58f7169de7abf9ae7302e4a03327b4ed 100644 (file)
@@ -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));