Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 521756 - app-admin/eclean-kernel should keep sources not in /usr/src
Summary: app-admin/eclean-kernel should keep sources not in /usr/src
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-30 16:07 UTC by Alexander E. Patrakov
Modified: 2016-08-21 23:01 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Still the same after this (grub2-fix.patch,1.05 KB, patch)
2016-08-21 18:27 UTC, Kajzer
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexander E. Patrakov 2014-08-30 16:07:52 UTC
I usually build kernels from gentoo-sources, and this process is known to leave old kernels behind. That's why I also use eclean-kernel.

Recently, I needed to bisect a bug, and thus cloned the linux git repository to /home/aep/linux and built several kernels from it. The bug was successfully bisected.

Then I ran "eclean-kernel -a" in order to erase old kernels. It successfully erased old kernels that I no longer needed, as well as their sources in /usr/src. That's what I wanted.

It also erased all directories with modules that accumulated due to git-bisection. That's also what I wanted.

It also erased /home/aep/linux, because it was the source of those bisected kernels. That's what I didn't want, and thus have a feature request: erase kernel sources only from /usr/src, or only if they don't have a .git subdirectory.

Reproducible: Always
Comment 1 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2014-09-03 09:37:55 UTC
Sorry, I didn't think about that. I myself use a git clone but I build all kernels from it, so the newer kernel always keeps it alive. I will try to address this as soon as I am able to.

However, I suspect this brings question whether it shouldn't have any more specific heuristics to find out if kernel source directory i supposed to be removed.
Comment 2 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-07-19 13:36:57 UTC
I'm sorry but I still haven't found a good way of handling it. EK2 doesn't touch source directories by design but tries to clean up build directories. But that still triggers your problem for in-source builds.

I don't really think hardcoding any specific path is a good idea here. It would work in your original case but it's as common for people to work on their local copies in /usr/src.

I could make it clean only when build dir != source dir. But then, it wouldn't clean up the common case of in-place builds of ebuild-installed sources -- and cleaning that up is the main point here.

I could make it clean only when build_dir doesn't contain kernel sources (anymore). That would certainly prevent it from accidentally wiping the sources. However, it would also make cleaning up /usr/src impossible if 'emerge --depclean' does not remove the sources first. And once /lib/modules is wiped, ek2 will no longer be able to find the build directory.

Maybe I could combine the above idea with the other request to call 'emerge -C ...' on kernel sources, i.e. first ask emerge to unmerge the sources (if applicable), then clean up the remaining build dirs. However, that's certainly a non-trivial problem.
Comment 3 Kajzer 2016-08-21 11:56:34 UTC
Sorry for not opening new bug report for this but just wanted to inform you that since grub2 multislot USE flag is no longer enabled by default, I have problems using eclean-kernel, before I used to run "eclean-kernel -n 1 --ask" and it was working fine, now when I run that it says :

Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.4-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.4-gentoo
No outdated kernels found.

I'm currently on kernel 4.7.2 (gentoo-sources) and I have 4.7.1 and 4.7.0 left behind, so it should pick those two for removal with -n 2 , however it doesn't and instead it gives me what I pasted above.
Also, I don't have 4.4.5 anywhere so I don't know how it picked that up.

grub2-mkconfig is now grub-mkconfig , so I guess that's why there's a problem.

Using sys-boot/grub-2.02_beta3-r1 , eclean-kernel-0.4.2
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2016-08-21 17:00:17 UTC
Damn renames. I'm sorry but I have very little time to attend to eclean-kernel now. Would you be able to wrap up a quick patch for me to apply?
Comment 5 Kajzer 2016-08-21 18:27:26 UTC
Created attachment 443832 [details, diff]
Still the same after this

Would be happy to, problem is that I don't speak Python much, I tried what I could in the attached patch, it applied correctly but I got same results as before when I run it.
I'm not sure what else is there to change regarding this rename, if you can give me some directions what else is there that needs to be patched then I can test it.
Comment 6 Kajzer 2016-08-21 20:09:22 UTC
There's no rush btw, I can clean it manually or just leave it, doesn't matter much.
Fix it whenever you can, main thing is that you're aware of it :)
Comment 7 Kajzer 2016-08-21 23:01:00 UTC
Well, it's the same as before because bootloader part wasn't reached, that stage happens after removal, but I have no clue from the rest of the code why it can't find kernels for removal.
Anyway, here's the complete output with debug option included :

# eclean-kernel -n 2 --ask -p -D
* Trying bootloader lilo
* Trying bootloader grub
** /boot/grub/grub.cfg found
* In get_removal_list()
** matching...
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.2-gentoo
**** from line: 	linux	/boot/kernel-genkernel-x86_64-4.7.2-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.2-gentoo
**** from line: 		linux	/boot/kernel-genkernel-x86_64-4.7.2-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.2-gentoo
**** from line: 		linux	/boot/kernel-genkernel-x86_64-4.7.2-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.1-gentoo
**** from line: 		linux	/boot/kernel-genkernel-x86_64-4.7.1-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.1-gentoo
**** from line: 		linux	/boot/kernel-genkernel-x86_64-4.7.1-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.0-gentoo
**** from line: 		linux	/boot/kernel-genkernel-x86_64-4.7.0-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.7.0-gentoo
**** from line: 		linux	/boot/kernel-genkernel-x86_64-4.7.0-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.4.5-gentoo
**** from line: 	linux /boot/kernel-genkernel-x86_64-4.4.5-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.4.5-gentoo
**** from line: 		linux /boot/kernel-genkernel-x86_64-4.4.5-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.4.5-gentoo
**** from line: 		linux /boot/kernel-genkernel-x86_64-4.4.5-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.4.5-gentoo
**** from line: 		linux /boot/kernel-genkernel-x86_64-4.4.5-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.4.4-gentoo
**** from line: 		linux /boot/kernel-genkernel-x86_64-4.4.4-gentoo
*** regexp matched path /boot/kernel-genkernel-x86_64-4.4.4-gentoo
**** from line: 		linux /boot/kernel-genkernel-x86_64-4.4.4-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.5-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.4-gentoo
Note: referenced kernel does not exist: /boot/kernel-genkernel-x86_64-4.4.4-gentoo
No outdated kernels found.