4.8.7. Configuration for Package Protection
This feature was recently added to yum from a plugin called yum-plugin-protect-packages and prevents yum from uninstalling itself and prevents to remove other protected packages. yum is by default the only protected package, but by extension this automatically protects everything that yum depends on(rpm, python, glibc, etc.). So then this functionality is very good even without the need to carefully construct lists of important packages.
In a standard way it is blocked the uninstall of yum and its dependencies, but if you want to add and protect other packages, you must create files in /etc/yum/protected.d/*.conf
and add a package name per line in each one of them.
Example situation, when you wish to protect the postgresql package. Configure a .conf file either creating or editing it, for example rdbms.conf
in the appropriate directory.
$ vi /etc/yum/protected.d/rbdms.conf
postgresql
:wq
Test to verify that YUM cannot uninstall the configured package by error.
# yum remove postgresql
Loaded plugins: aliases, changelog, fastestmirror, filter-data, keys, list-data, presto, refresh-packagekit, verify
Setting up Remove Process
Resolving Dependencies
--> Running transaction check
---> Package postgresql.i686 0:8.4.4-1.fc13 set to be erased
--> Processing dependencies: postgresql = 8.4.4-1.fc13 for package: postgresql-devel-8.4.4-1.fc13.i686
--> Processing dependencies: postgresql = 8.4.4-1.fc13 for package: postgresql-server-8.4.4-1.fc13.i686
--> Running transaction check
---> Package postgresql-devel.i686 0:8.4.4-1.fc13 set to be erased
---> Package postgresql-server.i686 0:8.4.4-1.fc13 set to be erased
--> Finished Dependency Resolution
Error: Trying to remove "postgresql", which is protected
You could try using --skip-broken to work around the problem
You could try running: rpm -Va --nofiles --nodigest
The error message is clear: the uninstall has failed. To be able to uninstall, it is necessary to remove the name of the package from rdbms.conf
.