projg2 / eclean-kernel

Installed kernel cleanup tool
GNU General Public License v2.0
32 stars 11 forks source link

Can’t handle different file names. #25

Open navid-zamani opened 3 years ago

navid-zamani commented 3 years ago

I stopped calling my kernel files “vmlinuz” a long time ago, because it doesn’t fit modern systems and formats. And eclean-kernel just removed ALL my kernels! If the config files hadn’t been saved somewhere else too, they’d be gone and I would have had to re-install from backups before rebooting, or been left with a broken system. :/

My layout is as follows: In /boot, there are symlinks .config -> /boot/.config-$currentVersion .config.stable -> /boot/.config-$lastVersion System.map -> /boot/System.map-$currentVersion System.map.stable -> /boot/System.map-$lastVersion kernel -> /boot/kernel-$currentVersion kernel.stable -> /boot/kernel-$lastVersion

E.g. currentVersion=5.13.10-zen1.0 lastVersion=5.13.4-zen1.0

eclean-kernel deleted every System.map- and every kernel- and then all /etc/src/linux-* directories too, including the .config files therein.

Looking at its, frankly, gigantic amount of source code for such a simple program, I cannot even locate where to alter what it looks for to determine which kernels are still in use. It seems to all be much too generic code. So I’m even more surprised it failed for my case. (Did it fail because of the symlinks?)

So can you please enable people to specify how they named their stuff inside /boot? Because like this, eclean-kernel is not only useless for all but “I don’t care, just do it the standard way” cases… when the whole point of Gentoo is that you care and customize… but it also can be out-performed by a 5-line bash script. (Or a Haskell one-liner, albeit in write-only code ;)

thesamesam commented 3 years ago

I stopped calling my kernel files “vmlinuz” a long time ago, because it doesn’t fit modern systems and formats. And eclean-kernel just removed ALL my kernels! If the config files hadn’t been saved somewhere else too, they’d be gone and I would have had to re-install from backups before rebooting, or been left with a broken system. :/

My layout is as follows: In /boot, there are symlinks .config -> /boot/.config-$currentVersion .config.stable -> /boot/.config-$lastVersion System.map -> /boot/System.map-$currentVersion System.map.stable -> /boot/System.map-$lastVersion kernel -> /boot/kernel-$currentVersion kernel.stable -> /boot/kernel-$lastVersion

E.g. currentVersion=5.13.10-zen1.0 lastVersion=5.13.4-zen1.0

eclean-kernel deleted every System.map- and every kernel- and then all /etc/src/linux-* directories too, including the .config files therein.

I would use --pretend in future, but it's of course unfortunate.

Looking at its, frankly, gigantic amount of source code for such a simple program, I cannot even locate where to alter what it looks for to determine which kernels are still in use. It seems to all be much too generic code. So I’m even more surprised it failed for my case. (Did it fail because of the symlinks?)

Nobody is making you use this, to be fair.

So can you please enable people to specify how they named their stuff inside /boot? Because like this, eclean-kernel is not only useless for all but “I don’t care, just do it the standard way” cases… when the whole point of Gentoo is that you care and customize… but it also can be out-performed by a 5-line bash script. (Or a Haskell one-liner, albeit in write-only code ;)

Sure, Gentoo might have a lot of use for customisation, but that doesn't mean one particular upstream is obligated to make their software do what you want. It's worth being a little bit more polite when making feature requests IMO.

jstrieter commented 6 months ago

The Gentoo distribution kernel package sys-kernel/gentoo-kernel has started calling their kernel "kernel-" instead of vmlinuz as of 6.6 so either this issue should be taken seriously or the eclean-kernel package deprecated and it's use discouraged on the Kernel/Removal page - or at least a warning added.

Edit: added output of --pretend.

% sudo eclean-kernel -p

Legend: [-] file being removed [+] file being kept (used by other kernels)

These are the kernels which would be removed:

yaaarg32 commented 3 months ago

Ran into this same issue today when trying to automate some of my tasks.

eclean-kernel -n 4 -p 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.

I see a long list of "modules-only": eclean-kernel --list-kernels modules-only 6.9.6-gentoo-x86_64 [None]

Debug: DEBUG:root:Sorter: <ecleankernel.sort.VersionSort object at 0x7fd8e9a335f0> DEBUG:root:Layout: <ecleankernel.layout.blspec.BlSpecLayout object at 0x7fd8e97a2870> DEBUG:root:Bootloader failed: <class 'ecleankernel.bootloader.lilo.LILO'> DEBUG:root:/boot/grub/grub.cfg found DEBUG:root:Bootloader: <ecleankernel.bootloader.grub2.GRUB2 object at 0x7fd8e97a2810> DEBUG:root:in get_removal_list() Traceback (most recent call last): File "/usr/lib/python-exec/python3.12/eclean-kernel", line 8, in sys.exit(setuptools_main()) ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/ecleankernel/main.py", line 391, in setuptools_main sys.exit(main(sys.argv[1:])) ^^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/ecleankernel/main.py", line 251, in main removals = get_removal_list( ^^^^^^^^^^^^^^^^^ File "/usr/lib/python3.12/site-packages/ecleankernel/process.py", line 81, in get_removal_list raise SystemError( SystemError: No vmlinuz found. This seems ridiculous, aborting.