1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-08-25 13:50:12 +03:00

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.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-12-13 14:38:06 +01:00
parent 9f563f2792
commit c41fff1e08

View 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;
}
}