Skip to content

Commit

Permalink
prepare-root: allow sysroot.readonly=true with kernel cmdline ro
Browse files Browse the repository at this point in the history
  • Loading branch information
ruihe774 committed Oct 10, 2024
1 parent a54518e commit 5b6d208
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 13 deletions.
4 changes: 0 additions & 4 deletions src/switchroot/ostree-mount-util.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions src/switchroot/ostree-prepare-root-static.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 0 additions & 7 deletions src/switchroot/ostree-prepare-root.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 5b6d208

Please sign in to comment.