]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fstab-generator: use log message that matches reality 25723/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 13 Dec 2022 13:38:06 +0000 (14:38 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 14 Dec 2022 21:12:44 +0000 (22:12 +0100)
We *assume* that when /sys is read-only, we're running in a container. But
there can other reasons, for example root is mount ro and nobody has mounted
/sys yet, or somebody forgot to add /sys to the list of filesystem not to
remount ro in a sandbox. So let's actually say what we know instead of assuming.

systemd-fstab-generator was reporting that it's running in a container and I
spent a good few minutes trying to figure out why 'systemd-detect-virt -c'
disagrees, before noticing that it's just checking a different condition.

src/fstab-generator/fstab-generator.c

index bca2f389c4ac7a9f106c865fb7fee9d9bbb38eca..b0ea536eb29778ca7f1f4a770210cb7572e1e612 100644 (file)
@@ -671,12 +671,12 @@ static int parse_fstab(bool initrd) {
 
                 if (path_is_read_only_fs("/sys") > 0) {
                         if (streq(what, "sysfs")) {
-                                log_info("Running in a container, ignoring fstab entry for %s.", what);
+                                log_info("/sys/ is read-only (running in a container?), ignoring fstab entry for %s.", me->mnt_dir);
                                 continue;
                         }
 
                         if (is_device_path(what)) {
-                                log_info("Running in a container, ignoring fstab device entry for %s.", what);
+                                log_info("/sys/ is read-only (running in a container?), ignoring fstab device entry for %s.", what);
                                 continue;
                         }
                 }