Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-11781

Switchroot may happen before /sysroot/usr gets effectively mounted, causing boot to fail

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • None
    • rhel-7.9.z, rhel-8.8.0.z, rhel-9.2.0.z
    • systemd
    • None
    • None
    • Low
    • rhel-systemd
    • ssg_core_services
    • 3
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • All
    • None

      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

      1. Configure a system with dedicated /usr
      2. Add nofail to entry in /etc/fstab
      3. 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 
      1. Reboot

      Expected results

      No switchroot failure

      Actual results

      Failure

              msekleta@redhat.com Michal Sekletar
              rhn-support-rmetrich Renaud Métrich
              systemd maint mailing list systemd maint mailing list
              Frantisek Sumsal Frantisek Sumsal
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Created:
                Updated: