fstab-generator: do not remount /sys when running in a container
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 12 Dec 2021 02:43:21 +0000 (11:43 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 14 Dec 2021 21:30:42 +0000 (06:30 +0900)
Closes #21744.

src/fstab-generator/fstab-generator.c

index f9a954a30829edf304e0f8282a318649be0d2e35..63113ea659c3c627e5e2f87d10a605b330adf8a0 100644 (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);