xbps icon indicating copy to clipboard operation
xbps copied to clipboard

xbps-remove kernel artifacts

Open ErinVoid opened this issue 2 years ago • 3 comments

Not sure if this is a feature or a bug. Kernels updated from stock repos and periodically purged. Removed via vkpurge rm all, xbps-remove -Oo or xbps-remove linux-n.nn. Recent kernels leave behind their modules in /usr/lib/modules and xbps files in cache. This install is probably four or so years old.

Shouldn't xbps-remove delete the modules and cached package[s] as well?

xuname Void 5.15.11_1 x86_64-musl AuthenticAMD uptodate hold rrnFF

xbps-query -Rs linux | grep * linux-5.15_1 linux-base-2021.07.21_1

xbps's cache folder linux5.11-5.11.22_1.x86_64-musl.xbps linux5.12-5.12.19_1.x86_64-musl.xbps linux5.13-5.13.19_1.x86_64-musl.xbps linux5.14-5.14.14_1.x86_64-musl.xbps linux5.14-5.14.21_1.x86_64-musl.xbps linux5.15-5.15.12_1.x86_64-musl.xbps linux5.6-5.6.19_1.x86_64-musl.xbps inux5.7-5.7.19_1.x86_64-musl.xbps linux5.8-5.8.18_1.x86_64-musl.xbps linux5.9-5.9.16_1.x86_64-musl.xbps

ErinVoid avatar Jan 23 '22 10:01 ErinVoid

Shouldn't xbps-remove delete the modules and cached package[s] as well?

No, vkpurge should remove the modules and xbps-remove only deletes "obsolete" packages from the cache. Obsolete here means they are not part of the repository anymore, its not about the installation state.

Duncaen avatar Jan 23 '22 14:01 Duncaen

Thank you for the clarification about xbps's cache. However, that leaves the modules not being deleted so is there a gap between vkpurge and xbps-remove in that if you remove a kernel version with xbps-remove before vkpurge has run it will leave artifacts taht require manual intervention? Should xbps-remove -o also remove the redundant module directories when it removes linux-n.nn?

ErinVoid avatar Jan 23 '22 17:01 ErinVoid

Should xbps-remove -o also remove the redundant module directories when it removes linux-n.nn?

It does or should, but only for the current version, the kernel packages use the "preserve" feature that is not well defined, on update it will just leave the files behind, so they can be handled with vkpurge, since this has some extra checks like disallowing removing the currently booted kernel. But when removing a kernel package with xbps-remove, then it will also remove the files, circumventing the running kernel checks i.e. vkpurge provides. Which is imho a bad decision or bug, we have vkpurge to avoid situations where no bootable kernel is available, this "preserve" should probably be changed to preserve files on removal too.

That said, I'm not sure what modules are left behind in your case, could be that its just not fully removed because there are dkms modules, which the kernel package doesn't know about or there was an issue with removing those with vkpurge. vkpurge currently only looks for kernel versions by looking at the actual kernel file in /boot, if there is no matching kernel but there are still module directories, then vkpurge does not list or delete them.

Duncaen avatar Jan 23 '22 17:01 Duncaen