]> git.ipfire.org Git - thirdparty/systemd.git/commit - src/fstab-generator/fstab-generator.c
fstab-generator: add a flag to accept entry for "/" in initrd
authorYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 26 Jul 2023 00:39:23 +0000 (09:39 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Wed, 26 Jul 2023 15:50:15 +0000 (00:50 +0900)
commit22f5a825e40ad9c8eeae18b763676759d24bb434
tree02dd882a7534f9033c7affa25fabd1e85a58188c
parentdfd10549ac5aec1379ee83d633aadd1296450dac
fstab-generator: add a flag to accept entry for "/" in initrd

When both prefix_sysroot and accept_root is true, the entry for "/" will
be accepted and converted to "/sysroot/".

Why? If the entry is read from the main system's fstab, then we already
mounted /sysroot/, hence it is not and should not re-add the .mount unit
for /sysroot/. However, if we want to specify the root mount through the
kernel command line or credential, without this change, we need to
specify the same entry in the two options. E.g.
===
systemd.mount-extra=/dev/sda1:/:auto:defaults
rd.systemd.mount-extra=/dev/sda1:/sysroot:auto:defaults
===
That's inconvenient. Of course, we can dedup that by using traditional
options, but cannot when defined in credential.
src/fstab-generator/fstab-generator.c