void-linux / xbps

The X Binary Package System (XBPS)
https://voidlinux.org/xbps/
Other
822 stars 124 forks source link

xbps-remove kernel artifacts #465

Open ErinVoid opened 2 years ago

ErinVoid commented 2 years ago

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

Duncaen commented 2 years ago

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.

ErinVoid commented 2 years ago

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?

Duncaen commented 2 years ago

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.

dkwo commented 4 months ago

Once/if /boot is not touched by xbps (if kernels are moved out of /boot), would it make sense to also manage these preserve=yes packages in the package manager, and e.g. keep prior 5 versions or something similar configured by the user, without the need to run vkpurge or similar scripts?