projg2 / eclean-kernel

Installed kernel cleanup tool
GNU General Public License v2.0
31 stars 10 forks source link

Support for UEFI bootloader with ESP layout #28

Closed nE0sIghT closed 2 months ago

nE0sIghT commented 2 years ago

It would be nice to have EFI Stub kernel support with plain UEFI bootloader.

https://wiki.gentoo.org/wiki/EFI_stub https://wiki.gentoo.org/wiki/EFI_System_Partition

AndrewAmmerlaan commented 1 year ago
andrew-gentoo-pc andrew # eclean-kernel -aA
eclean-kernel has met the following issue:

SystemError('No vmlinuz found. This seems ridiculous, aborting.')

If you believe that the mentioned issue is a bug, please report it
to https://github.com/mgorny/eclean-kernel/issues. If possible,
please attach the output of 'eclean-kernel --list-kernels' and your
regular eclean-kernel call with additional '--debug' argument.

In fact it is not ridiculous at all :P!

A /etc/kernel/install.conf with layout=uki will result in $BOOT that looks like this:

andrew-gentoo-pc andrew # tree /boot
/boot
├── EFI
│   ├── BOOT
│   │   └── BOOTX64.EFI
│   ├── Linux
│   │   ├── linux-6.3.8-gentoo-dist.efi
│   │   ├── linux-6.3.9-gentoo-dist.efi
│   │   └── linux-6.4.0-rc7-gentoo-dist+.efi
│   └── systemd
│       └── systemd-bootx64.efi
├── linux
└── loader
├── entries
├── entries.srel
├── loader.conf
└── random-seed

This is the type 2 Boot Loader Specification instead of the default type 1.

So in addition to checking for $BOOT/vmlinuz_$KERNEL_VERSION and $BOOT/$ENTRY_TOKEN-$KERNEL_VERSION/linux we should also check $ESP/Linux/$ENTRY_TOKEN-$KERNEL_VERSION.efi and if necessary clean it up.

AndrewAmmerlaan commented 9 months ago

This issue should be fixed with the latest release and can probably be closed.

mmatous commented 9 months ago

2.99.6: SystemError('No vmlinuz found. This seems ridiculous, aborting.') Not working for $BOOT/EFI/Linux/linux-x.y.z-gentoo.efi format. Both specs state that the machine id/entry token is optional. I think that if no matching entry is found, eclean should fall back to looking for *-gentoo.efi (or *-<currentdistro>.efi) files.

AndrewAmmerlaan commented 7 months ago

Not working for $BOOT/EFI/Linux/linux-x.y.z-gentoo.efi format. Both specs state that the machine id/entry token is optional.

The problem with cleaning up entries that do not match our machine-id/entry-token is that they might belong to other distributions. Therefore I don't think we can properly support that configuration.

avollmerhaus commented 3 months ago

According to the Gentoo wiki, mounting the ESP at /boot/efi is not recommended any more. I now have it at /efi, with the Gentoo kernels at /efi/EFI/GENTOO. It would be a treat if eclean-kernel could support that :)

AndrewAmmerlaan commented 3 months ago

According to the Gentoo wiki, mounting the ESP at /boot/efi is not recommended any more. I now have it at /efi, with the Gentoo kernels at /efi/EFI/GENTOO. It would be a treat if eclean-kernel could support that :)

Please try with this patch: https://github.com/projg2/eclean-kernel/pull/50

avollmerhaus commented 2 months ago

Please try with this patch: #50

At the moment, make install from the kernel sources directory only copies vmlinuz to /efi/EFI/GENTOO and moves the previous one to vmlinuz.old. I'm not entirely sure why this is the case, something something installkernel. I'll test the patch when this is resolved. Though I have to admit I'm mostly fine with the two vmlinuz files.

AndrewAmmerlaan commented 2 months ago

At the moment, make install from the kernel sources directory only copies vmlinuz to /efi/EFI/GENTOO and moves the previous one to vmlinuz.old. I'm not entirely sure why this is the case, something something installkernel. I'll test the patch when this is resolved. Though I have to admit I'm mostly fine with the two vmlinuz files.

Could you show me the version and USE configuration of sys-kernel/installkernel and the full output of make install?