Issue
What were you trying to do that didn't work?
When /usr has nofail option in /etc/fstab, systemd-fstab-generator doesn't add the required dependency Before=initrd-fs.target, causing a race to occur during switchroot.
This may lead to getting the following boot error:
[ OK ] Reached target Switch Root.
Starting Switch Root...
[
1.888507] systemd-journald[116]: Received SIGTERM from PID 1 (systemd).
[
1.892990] systemd[1]: No /sbin/init, trying fallback
[
1.893688] systemd[1]: Failed to execute /bin/sh, giving up: No such file or directory
Because it's a configuration error to have nofail, I'm filing this at Minor severity.
Please provide the package NVR for which bug is seen:
All systemd releases
How reproducible:
Always
Steps to reproduce
Configure a system with dedicated /usr
Add nofail to entry in /etc/fstab
Add a sleep service sysroot-usr.mount will depend on in the initramfs
# cat > /etc/systemd/system/sleeper.service << EOF
[Unit]
DefaultDependencies=no[Service]
Type=oneshot
ExecStart=/bin/sleep 5
EOF
# mkdir /etc/systemd/system/sysroot-usr.mount.d
# cat > /etc/systemd/system/sysroot-usr.mount.d/after_sleeper.conf << EOF
[Unit]
After=sleeper.service
Requires=sleeper.service
EOF
# dracut -f --include /etc/systemd/system/sysroot-usr.mount.d/after.conf /etc/systemd/system/sysroot-usr.mount.d/after.conf --include /etc/systemd/system/sleeper.service /etc/systemd/system/sleeper.service
Reboot
Expected results
No switchroot failure
Actual results
Failure