From c41fff1e0897df5731881225d831febaebf70413 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 13 Dec 2022 14:38:06 +0100 Subject: [PATCH] fstab-generator: use log message that matches reality 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 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c index bca2f389c4a..b0ea536eb29 100644 --- a/src/fstab-generator/fstab-generator.c +++ b/src/fstab-generator/fstab-generator.c @@ -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; } } -- 2.47.3