dracut icon indicating copy to clipboard operation
dracut copied to clipboard

busybox modprobe incompatibility

Open Geertsky opened this issue 7 months ago • 6 comments

Describe the bug Including busybox causes the emergency shell to get started due to incompatibility of modprobe.

Distribution used Fedora38

Dracut version 059-5.fc38

Init system systemd

To Reproduce

sudo dracut -NM -a "sshd busybox network lvm systemd-resolved" <path to initramfs> $(uname -r)

Expected behavior Normal bootup

Additional context It seems a problem with dropbox modprobe not supporting the --all flag. See rdsosreport.txt line 1099

rdsosreport.txt

Geertsky avatar Dec 09 '23 15:12 Geertsky

Caused by the iscsi dracut module https://github.com/dracutdevs/dracut/blob/master/modules.d/95iscsi/parse-iscsiroot.sh#L98

LaszloGombos avatar Dec 09 '23 17:12 LaszloGombos

Tried to exclude the iscsi module but the problem persists...

sudo dracut -NM -m bash systemd systemd-initrd systemd-resolved systemd-sysusers modsign busybox nss-softokn dbus-broker dbus i18n network-manager network ifcfg sshd drm plymouth bcache btrfs crypt dm dmraid kernel-modules kernel-modules-extra kernel-network-modules lvm mdraid nvdimm qemu qemu-net cifs  lunmask nfs resume rootfs-block terminfo udev-rules virtiofs dracut-systemd usrmount base fs-lib memstrack shutdown /tmp/initramfs-test.img 6.6.3-100.fc38.x86_64 --force

rdsosreport.txt

Geertsky avatar Dec 09 '23 19:12 Geertsky

@Geertsky Are you in a position to help test https://github.com/dracutdevs/dracut/pull/2582 ? Thanks !

LaszloGombos avatar Dec 10 '23 14:12 LaszloGombos

@LaszloGombos Seems to work. I'm still having problems with busybox mount not being able to mount xfs or vfat filesystems though...

Geertsky avatar Dec 10 '23 17:12 Geertsky

@LaszloGombos Seems to work. I'm still having problems with busybox mount not being able to mount xfs or vfat filesystems though...

Try rd.driver.pre=xfs rd.driver.pre=vfat kernel command line. Thanks

LaszloGombos avatar Dec 10 '23 17:12 LaszloGombos

@LaszloGombos Sorry for the late reply... But you're right! That did it! Wondering why dracut with busybox doesn't autoload these modules though...

Geertsky avatar Dec 11 '23 16:12 Geertsky

It would be nice if you could provide an allowlist or denylist for the busybox programs. We recently ran into failures because the busybox blkid implementation is a toy that's nothing like the real thing. Something like busyboxapplets and omit_busyboxapplets. Would something like that be acceptable?

dbnicholson avatar Feb 28 '24 17:02 dbnicholson

@dbnicholson In most cases blkid can be replaced by udevadm and dracut can be more portable with changes like this - https://github.com/dracutdevs/dracut/pull/2033 .

LaszloGombos avatar Feb 29 '24 15:02 LaszloGombos

@dbnicholson In most cases blkid can be replaced by udevadm and dracut can be more portable with changes like this - #2033 .

In some cases, sure. In our case we have a dracut module that expands the root partition. In order to know what type of partitioning is needed, we use blkid -o value -s PTTYPE. We could switch to lsblk or similar, but that depends on udev setting the properties. That introduces a potential failure if that hasn't happened yet. Whereas blkid will probe the block device directly.

Anyways, that's just papering over the issue. The busybox implementations of several utilities (especially the util-linux ones) are very minimal. If you enable the busybox module, it will happily symlink any applet that's included by busybox. The only way to replace the busybox symlinks with the real thing is to manually delete the symlink and install again. If you enable the busybox module and you get a toy program, there's little you can do about it.

dbnicholson avatar Feb 29 '24 16:02 dbnicholson

@dbnicholson this is good background, but we need to narrow this down for actionable improvements that is in scope for the dracut project to improve (and not the busybox project).

If you enable the busybox module and you get a toy program, there's little you can do about it.

Would --include help here as that would overwrite the symlink ? dracut --include SOURCE TARGET

In our case we have a dracut module

Depending on the "ordering of your dracut module" are you not able to manually opt in to some util-linux binaries in your dracut module ?

LaszloGombos avatar Feb 29 '24 16:02 LaszloGombos

@dbnicholson this is good background, but we need to narrow this down for actionable improvements that is in scope for the dracut project to improve (and not the busybox project).

Of course. Here is a patch I wrote yesterday to workaround our specific breakage. That simply hardcodes blkid (with potential for later additions like modprobe) to be skipped. I'm confident you don't want busybox's blkid as it would break every usage within dracut except for the single bare blkid in rdsosreport.

What I suggested earlier was providing configuration options such as busyboxapplets/omit_busyboxapplets. In the busybox module setup you'd either use the list in busyboxapplets, start with busybox --list and trim out omit_busyboxapplets, or just use the full busybox --list like is done now.

If you enable the busybox module and you get a toy program, there's little you can do about it.

Would --include help here as that would overwrite the symlink ? dracut --include SOURCE TARGET

I don't think so. The --include processing happens after the modules and uses inst for files. That silently skips if the target already exists.

In our case we have a dracut module

Depending on the "ordering of your dracut module" are you not able to manually opt in to some util-linux binaries in your dracut module ?

We'd have to order our module before 05busybox, which is possible but not what I'd expect to do if I was just writing a regular dracut module. However, at present I'm pretty sure it wouldn't work since the busybox module doesn't check for a target that already exists and then forcefully overwrites with ln_r.

dbnicholson avatar Feb 29 '24 17:02 dbnicholson