Like lunaryorn said, dracut-remove is assuming the ESP is mounted at /boot. But that's only dracuts last fallback path, if neither /efi, nor /boot/efi exists. (details: https://git.kernel.org/pub/scm/boot/dracut/dracut.git/tree/dracut.sh?h=053#n851 )
I changed my dracut-remove to use the same mechanism.
--- dracut-remove 2021-04-09 20:54:04.985000688 +0200
+++ dracut-remove.new 2021-04-09 20:57:11.924297085 +0200
@@ -3,6 +3,16 @@
while read -r line; do
if [[ "$line" == 'usr/lib/modules/'+([^/])'/pkgbase' ]]; then
kver=$(basename $(dirname ${line}))
- rm -v /boot/EFI/Linux/linux-${kver}-$(cat /etc/machine-id)-*.efi
+
+ if [[ -d /efi ]] && mountpoint -q /efi; then
+ efidir=/efi/EFI
+ else
+ efidir=/boot/EFI
+ if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
+ efidir=/boot/efi/EFI
+ fi
+ fi
+
+ rm -v ${efidir}/Linux/linux-${kver}-$(cat /etc/machine-id)-*.efi
fi
done
Pinned Comments
swsnr commented on 2023-05-29 07:52 (UTC)
I no longer use dracut, and do not maintain this hook anymore.