fstab-generator: do not remount /sys when running in a container

Closes #21744.
This commit is contained in:
Yu Watanabe
2021-12-15 06:30:42 +09:00
parent a2d7654f99
commit 18f0eaafd7
+10 -3
View File
@@ -601,9 +601,16 @@ static int parse_fstab(bool initrd) {
if (!what)
return log_oom();
if (is_device_path(what) && path_is_read_only_fs("/sys") > 0) {
log_info("Running in a container, ignoring fstab device entry for %s.", what);
continue;
if (path_is_read_only_fs("/sys") > 0) {
if (streq(what, "sysfs")) {
log_info("Running in a container, ignoring fstab entry for %s.", what);
continue;
}
if (is_device_path(what)) {
log_info("Running in a container, ignoring fstab device entry for %s.", what);
continue;
}
}
where = strdup(me->mnt_dir);