summaryrefslogtreecommitdiff
path: root/src/fstab-generator
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-12 11:43:21 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-15 06:30:42 +0900
commit18f0eaafd7f180f5d0d2d65349835374146efdb3 (patch)
treee237e75468cc3df2c7097fd771422222a4010608 /src/fstab-generator
parenta2d7654f99eba250eddf988db262abef96ebbe7a (diff)
downloadsystemd-18f0eaafd7f180f5d0d2d65349835374146efdb3.tar.gz
fstab-generator: do not remount /sys when running in a container
Closes #21744.
Diffstat (limited to 'src/fstab-generator')
-rw-r--r--src/fstab-generator/fstab-generator.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/fstab-generator/fstab-generator.c b/src/fstab-generator/fstab-generator.c
index f9a954a308..63113ea659 100644
--- a/src/fstab-generator/fstab-generator.c
+++ b/src/fstab-generator/fstab-generator.c
@@ -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);