Kdump initrd run failed

Describe the bug

kdump initramfs with squashfs fails to boot with Failed to execute /init (error -2). The squash loader’s init-squash.sh (installed as /init) uses #!/bin/sh shebang, but /usr/bin/sh does not exist in the outer cpio layer — only /usr/sbin/sh is present.

...
2026-05-25 11:58:48 [    0.521438] Run  as init process
2026-05-25 11:58:48 [    0.521613] Failed to execute /init (error -2)
2026-05-25 11:58:48 [    0.521768] Run /sbin/init as init process
2026-05-25 11:58:48 can't run '/etc/init.d/rcS': No such file or directory
2026-05-25 11:58:48 can't open /dev/tty4: No such file or directory
2026-05-25 11:58:48 can't open /dev/tty2: No such file or directory
2026-05-25 11:58:48 can't open /dev/tty3: No such file or directory
2026-05-25 11:58:48 Please press Enter to activate this console.

The busybox module creates applet symlinks based on find_binary() results. Since DRACUT_PATH defaults to /usr/sbin /sbin /usr/bin /bin, and the Fedora busybox package places applet symlinks under /usr/sbin/, find_binary("sh") returns /usr/sbin/sh. The module only creates that symlink, leaving /usr/bin/sh (i.e. /bin/sh on merged-usr) absent.

Distribution used

Fedora 43 (also affects Fedora 42)

Dracut version

dracut-107-8.fc43

Init system

systemd

To Reproduce

  1. Install Fedora 43 with busybox (1.37.0-3.fc43) and kexec-tools
  2. Enable kdump with squashfs (kdump-utils adds --add 'squash-squashfs' --squash-compressor 'zstd')
  3. kdumpctl rebuild
  4. echo c > /proc/sysrq-trigger
  5. Crash kernel fails with Failed to execute /init (error -2)

Expected behavior

/usr/bin/sh should always exist when busybox module is installed (POSIX mandates /bin/sh). kdump should successfully capture vmcore.

Additional context

Triggered by Fedora 42’s Unify /usr/bin and /usr/sbin transition — /usr/sbin still exists as a separate directory and busybox places applet symlinks there.

Diagnosis:

$ lsinitrd /boot/initramfs-$(uname -r)kdump.img | grep -E "usr/bin/sh|usr/sbin/sh"
lrwxrwxrwx   1 root     root           14 ... usr/sbin/sh -> ../bin/busybox
# /usr/bin/sh is ABSENT

Workaround:

echo 'DRACUT_PATH="/usr/bin /bin /usr/sbin /sbin"' > /etc/dracut.conf.d/fix-path-order.conf
kdumpctl rebuild

My Patch:

diff --git a/modules.d/81busybox/module-setup.sh b/modules.d/81busybox/module-setup.sh
index abcdef1..1234567 100755
--- a/modules.d/81busybox/module-setup.sh
+++ b/modules.d/81busybox/module-setup.sh
@@ -36,4 +36,11 @@ install() {
 
         ln_r /usr/bin/busybox "$_path"
     done
+
+    # Ensure /usr/bin/sh is always available.
+    # POSIX mandates /bin/sh and most scripts use #!/bin/sh (-> /usr/bin/sh
+    # on merged-usr). find_binary may locate 'sh' at a non-standard path
+    # (e.g. /usr/sbin/sh) depending on $DRACUT_PATH ordering, so create
+    # the symlink explicitly if absent.
+    [[ -e "${_dstdir}/usr/bin/sh" ]] || ln_r /usr/bin/busybox /usr/bin/sh
 }

I have created issues on upstream project - dracut, and bugzilla!!!