How to prevent a package being removed on depclean

Packages recorded in the world file (at /var/lib/portage/world) will not be removed when you clean the dependencies via emerge --depclean. Gentoo will add a package name to the world file when you install it explicitly via emerge. Dependencies automatically pulled in by emerge will not be added to the world file.

For example, if you installed the kernel sources by installing the meta-package gentoo-sources, then a depclean may remove old versions (I say may because my world file seems to have recorded some specific versions and not others, though I didn’t start specifying the versions until recently. Perhaps default behaviour changed at some point). This may not be desirable because you could end up being unable to recompile your current kernel if its source was removed.

To prevent this, you’d install a specific package version via e.g. emerge -av =sys-kernel/gentoo-sources-3.2.1-r2 or emerge -av sys-kernel/gentoo-sources:3.2.1-r2. Using the --noreplace option will record the version in the world file without re-installing the package (e.g. emerge -av --noreplace sys-kernel/gentoo-sources:3.2.1-r2).

I believe you can also use the CONFIG_PROTECT environment variable to prevent the source being removed.


Last modified: 10/03/2012 Tags: , , ,

This website is a personal resource. Nothing here is guaranteed correct or complete, so use at your own risk and try not to delete the Internet. -Stephan

Site Info

Privacy policy

Go to top