Booting the system fails when switching root with "Failed to execute /bin/sh, giving up: No such file or directory"
Issue
-
When booting the system, it randomly fails while switching root, as seen below
[ 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
-
Alternatively the system enters early Emergency prompt after printing the following messages
[...] systemd[1]: Starting Switch Root... [...] systemctl[XXX]: Failed to switch root: Specified switch root path '/sysroot' does not seem to be an OS tree. os-release file is missing. [...] systemd[1]: initrd-switch-root.service: Main process exited, code=exited, status=1/FAILURE [...] systemd[1]: initrd-switch-root.service: Failed with result 'exit-code'. [...] systemd[1]: Failed to start Switch Root. [...] systemd[1]: initrd-switch-root.service: Triggering OnFailure= dependencies.
Environment
- Red Hat Enterprise Linux 7, 8 and 9
- systemd
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.