dracutdevs / dracut

dracut the event driven initramfs infrastructure
https://github.com/dracutdevs/dracut/wiki
GNU General Public License v2.0
597 stars 396 forks source link

fix(install.d): do not create initramfs if the supplied image is UKI #2521

Closed vittyvk closed 10 months ago

vittyvk commented 11 months ago

When the supplied kernel image is a UKI, there's no point in creating initramfs as the UKI has it built-in already. This is the situation when dracut.install is called for a distro shipped UKI.

Note, KERNEL_INSTALL_IMAGE_TYPE == "uki" is different from KERNEL_INSTALL_LAYOUT == "uki", the later can be used to create UKI upon installing a standard kernel image.

This pull request changes...

Changes

Checklist

vittyvk commented 11 months ago

Looking at the failed integration test,

./test.sh: line 24:  2497 Segmentation fault      (core dumped) "$testdir"/run-qemu "${disk_args[@]}" -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" -initrd "$TESTDIR"/initramfs.makeroot
TEST: root filesystem on a ext4 filesystem   [FAILED] 

I honestly don't think this has anything to do with my tiny patch but please let me know if there's anything I can take care of.

aafeijoo-suse commented 11 months ago

Looking at the failed integration test,

./test.sh: line 24:  2497 Segmentation fault      (core dumped) "$testdir"/run-qemu "${disk_args[@]}" -append "root=/dev/dracut/root rw rootfstype=ext4 quiet console=ttyS0,115200n81 selinux=0" -initrd "$TESTDIR"/initramfs.makeroot
TEST: root filesystem on a ext4 filesystem   [FAILED] 

I honestly don't think this has anything to do with my tiny patch but please let me know if there's anything I can take care of.

Unrelated to this patch. See #2506

vittyvk commented 11 months ago

@haraldh @johannbg could you please take a look? Thanks!

aafeijoo-suse commented 11 months ago

You should request that to @lnykryn these days. FTR, see #2274

vittyvk commented 11 months ago

I missed that there was a discussion already. I don't fully agree with the resolution on #2274: it is perfectly valid to have a mix of Type-1 BLS entries (standard kernels which require initramfs) and Type-2 entries (which already have initramfs inside) and the patch just skips creating useless initramfs-es for the later. Such 'mixed' cases can't be resolved by not installing dracut.

johannbg commented 11 months ago

@vittyvk care to explain those use cases in detail?

vittyvk commented 11 months ago

@johannbg sure, let me try.

AndrewAmmerlaan commented 11 months ago

Plus with this change distro's that currently rely on kernel-install to generate the initrd and install the kernel (e.g. Gentoo) won't have to change the installation logic when/if they in the future decide to distribute the pre-built kernel in UKI format instead. Without this change the UKI would be generated locally by kernel-install again, which is a) pointless and b) probably results in installing the locally generated unsigned UKI instead of the one that was pre-built and pre-signed. Therefore I think this change makes sense.

vittyvk commented 10 months ago

Gentle ping)