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
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.
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.
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
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?
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.
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 :)
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.