eclean-kernel icon indicating copy to clipboard operation
eclean-kernel copied to clipboard

systemd-boot support

Open lovesegfault opened this issue 5 years ago • 12 comments

It'd be nice if systemd-boot, former gummiboot, was supported.

lovesegfault avatar Sep 23 '19 21:09 lovesegfault

Good news, everyone. I've started reviving the project, and this is next on my TODO list. So maybe tomorrow.

mgorny avatar May 22 '20 18:05 mgorny

tomorrow, eh?

prometheanfire avatar Mar 04 '21 20:03 prometheanfire

tomorrow, eh?

Don't you see the commit, though?

mgorny avatar Mar 04 '21 20:03 mgorny

I do, it looks like it's not finding my kernel because it was installed as linux and not vmlinuz as it expects.

prometheanfire avatar Mar 04 '21 21:03 prometheanfire

or being placed in a subdir of /boot/<machine_id> like /boot/<machine_id>/<KERNEL_VER>

prometheanfire avatar Mar 04 '21 21:03 prometheanfire

clean-kernel -n 5 -p --debug

DEBUG:root:Layout: <ecleankernel.layout.blspec.BlSpecLayout object at 0x7f501b934df0>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.lilo.LILO'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.grub2.GRUB2'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.grub.GRUB'>
DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.yaboot.Yaboot'>
DEBUG:root:Bootloader: <ecleankernel.bootloader.symlinks.Symlinks object at 0x7f501b934eb0>
DEBUG:root:Sorter: <ecleankernel.sort.VersionSort object at 0x7f501b934e20>
DEBUG:root:in get_removal_list()
Preserving currently running kernel (5.11.2)
Legend:
[-] file being removed
[+] file being kept (used by other kernels

These are the kernels which would be removed:
- 5.10.18: vmlinuz does not exist
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.18/initrd
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.18/linux
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.18
 [-] /lib/modules/5.10.18/../../../usr/src/linux-5.10.18
 [-] /lib/modules/5.10.18
- 5.10.19: vmlinuz does not exist
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.19/initrd
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.19/linux
 [-] /boot/dbca93ecd27d4e08aa36d39eedea459f/5.10.19
 [-] /lib/modules/5.10.19/../../../usr/src/linux-5.10.19
 [-] /lib/modules/5.10.19
- 5.6.13-gentoo: vmlinuz does not exist
 [-] /usr/src/linux-5.6.13-gentoo
 [-] /lib/modules/5.6.13-gentoo
- 5.9.3-gentoo: vmlinuz does not exist
 [-] /usr/src/linux-5.9.3-gentoo
 [-] /lib/modules/5.9.3-gentoo

prometheanfire avatar Mar 04 '21 21:03 prometheanfire

magic number returned is ynam and not HdrS. However, my kernel version is also at 61440 bytes into the file and not 14848 bytes in.

prometheanfire avatar Mar 05 '21 02:03 prometheanfire

I guess you need to teach it how to find the (compressed?) kernel image.

mgorny avatar Mar 05 '21 13:03 mgorny

Ya, how to read the efi binary to find the kernel image and then from that read the kernel version (as I mentioned on irc last night).

prometheanfire avatar Mar 05 '21 14:03 prometheanfire

If you need inspiration for parsing the PE file headers, I threw this together in a hurry - though I did this for self-practice and I don't mean to steal the show from prometheanfire. https://github.com/Jannik2099/eclean-kernel/blob/efistub/ecleankernel/file.py#L169

Jannik2099 avatar Mar 05 '21 19:03 Jannik2099

I can confirm that the the edit seems to work. https://github.com/Jannik2099/eclean-kernel/commit/32b1a2d48813fec60826fa5f23a54c9ff4774588

prometheanfire avatar Oct 12 '21 02:10 prometheanfire

Oh, I'm positively surprised that this is in working condition, heh - I can't predict when I'll find time to work on this, so anyone may feel free to pick up from here.

Jannik2099 avatar Oct 12 '21 16:10 Jannik2099