Bug 2278981

Summary: Kernel uninstall failing since fc40 upgrade
Product: [Fedora] Fedora Reporter: Andreas G <uriesk>
Component: dracutAssignee: dracut-maint-list
Status: CLOSED DUPLICATE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 40CC: dracut-maint-list, dtardon, jamacku, lnykryn, pvalena
Target Milestone: ---Keywords: Desktop
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2024-05-10 06:20:09 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Andreas G 2024-05-03 20:07:14 UTC
50-dracut.install fails during uninstall with

>rm: cannot remove '/boot/efi/04415f4205a64c0691dcaf68b2389ae1/6.7.9-200.fc39.aarch64/': Is a directory
>Apr 29 02:08:21 localhost dnf-3[775]: /usr/lib/kernel/install.d/50-dracut.install failed with exit status 1.

The cause seems to be the following lines in /usr/lib/kernel/install.d/50-dracut.install

>if [[ -d "$BOOT_DIR_ABS" ]]; then
>    INITRD="initrd"
>else
>    # No layout information, use users --uefi/--no-uefi preference
>    UEFI_OPTS=""
>    if [[ -d $BOOT_DIR_ABS ]]; then
>        IMAGE="initrd"
>    else
>        BOOT_DIR_ABS="/boot"
>        IMAGE="initramfs-${KERNEL_VERSION}.img"
>    fi
>fi

Which makes no sense to me, cause $INITRD is nowhere referenced in the script again. While $IMAGE isn't being set if $BOOT_DIR_ABS is a directory (which it is), so later in:
>rm -f -- "$BOOT_DIR_ABS/$IMAGE"
It tries to remove the $BOOT_DIR_ABS and fails, cause that's a directory.

It seems to be caused by this patch:

https://src.fedoraproject.org/rpms/dracut/blob/rawhide/f/0001-feat-kernel-install-do-nothing-when-KERNEL_INSTALL_I.patch

Reproducible: Always

Steps to Reproduce:
1.Uninstall any kernel



Running with systemd-boot.

Comment 1 Andreas G 2024-05-03 20:08:29 UTC
As reference, someone else noticing the same problem:

https://discussion.fedoraproject.org/t/kernel-uninstall-failed-during-f39-to-f40-upgrade/114788/1

Comment 2 David Tardon 2024-05-10 06:20:09 UTC

*** This bug has been marked as a duplicate of bug 2274356 ***