summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuca BRUNO <luca.bruno@coreos.com>2021-10-07 14:40:31 +0000
committerLuca BRUNO <luca.bruno@coreos.com>2021-10-07 14:56:47 +0000
commitf4be52ba2423858cf82fb0315bcf9b437c6d7f8f (patch)
tree517be69c0abfb4184440611e162bbd97da0db0fd
parentcc70ab27fa3b975823c20c5a31af7c29a4807237 (diff)
downloadostree-f4be52ba2423858cf82fb0315bcf9b437c6d7f8f.tar.gz
prepare-root: tweak log messages to clarify errors
This rewords errors and log messages in the functions which take care of preparing sysroot in initramfs. Depending on the boot flow, it is possible to reach this logic with a sysroot mounted (unexpectedly) as read-only. In that case, let's clearly point out the problematic mountpoint.
-rw-r--r--src/switchroot/ostree-prepare-root.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/switchroot/ostree-prepare-root.c b/src/switchroot/ostree-prepare-root.c
index 6bc2c374..3116bef1 100644
--- a/src/switchroot/ostree-prepare-root.c
+++ b/src/switchroot/ostree-prepare-root.c
@@ -189,6 +189,10 @@ main(int argc, char *argv[])
err (EXIT_FAILURE, "usage: ostree-prepare-root SYSROOT");
root_arg = argv[1];
}
+#ifdef USE_LIBSYSTEMD
+ sd_journal_send ("MESSAGE=preparing sysroot at %s", root_arg,
+ NULL);
+#endif
struct stat stbuf;
if (stat ("/proc/cmdline", &stbuf) < 0)
@@ -238,15 +242,20 @@ main(int argc, char *argv[])
*/
const bool sysroot_readonly = sysroot_is_configured_ro (root_arg);
const bool sysroot_currently_writable = !path_is_on_readonly_fs (root_arg);
-
#ifdef USE_LIBSYSTEMD
- sd_journal_send ("MESSAGE=sysroot configured read-only: %d, currently writable: %d",
- (int)sysroot_readonly, (int)sysroot_currently_writable, NULL);
+ sd_journal_send ("MESSAGE=filesystem at %s currently writable: %d", root_arg,
+ (int)sysroot_currently_writable,
+ NULL);
+ sd_journal_send ("MESSAGE=sysroot.readonly configuration value: %d",
+ (int)sysroot_readonly,
+ NULL);
#endif
+
if (sysroot_readonly)
{
if (!sysroot_currently_writable)
- errx (EXIT_FAILURE, "sysroot=readonly currently requires writable / in initramfs");
+ errx (EXIT_FAILURE, "sysroot.readonly=true requires %s to be writable at this point",
+ root_arg);
/* Now, /etc is not normally a bind mount, but if we have a readonly
* sysroot, we still need a writable /etc. And to avoid race conditions
* we ensure it's writable in the initramfs, before we switchroot at all.