Linux Commands

How to Remove Protected Packages from Fedora/CentOS/RHEL/Rocky Linux

Protected packages are the packages of RPM-based Linux distributions like Fedora/CentOS/RHEL/Rocky Linux that you can’t uninstall or remove from your computer very easily. These packages are protected because uninstalling them without knowing the consequences might render your computer unbootable or hamper important system services of your computer.

If you ever need to uninstall these protected packages from Fedora/CentOS/RHEL/Rocky Linux or any other RPM-based Linux distributions and you need any assistance in doing so, this article is for you.

In this article, we will show you how to list the protected packages of Fedora/CentOS/RHEL/Rocky Linux or any other RPM-based Linux distributions. We will also show you how to remove the protected packages from Fedora/CentOS/RHEL/Rocky Linux.

Topic of Contents:

  1. Listing the Protected Packages of Fedora/CentOS/RHEL/Rocky Linux
  2. Removing the Protected Packages of Fedora/CentOS/RHEL/Rocky Linux
  3. Conclusion

Listing the Protected Packages of Fedora/CentOS/RHEL/Rocky Linux

To list all the protected packages of Fedora/CentOS/RHEL/Rocky Linux or any other RPM-based Linux distribution, run the following command:

$ cat /etc/dnf/protected.d/*

All the protected packages of your RPM-based Linux distribution should be listed.

We will show you how to remove the “plasma-desktop” protected package from our Fedora 38 machine for the demonstration.

Removing the Protected Packages of Fedora/CentOS/RHEL/Rocky Linux

If you try to uninstall any protected package from Fedora/CentOS/RHEL/Rocky Linux (or any other RPM-based Linux distributions) with the usual DNF “remove” command, you will see the following error message:

$ sudo dnf remove plasma-desktop

To remove the “plasma-desktop” protected package (let’s say) from Fedora/CentOS/RHEL/Rocky Linux (or any other RPM-based Linux distributions), run the DNF “remove” command with the “protected_packages” flag as follows:

$ sudo dnf remove –setopt protected_packages= plasma-desktop

To confirm the removal operation, press “Y” and then press <Enter>.

The “plasma-desktop” protected package is being removed. It takes a while to complete.

At this point, your desired protected package should be removed.

Conclusion

In this article, we showed you how to list the protected packages of Fedora/CentOS/RHEL/Rocky Linux or any other RPM-based Linux distributions. We also showed you how to remove the protected packages from Fedora/CentOS/RHEL/Rocky Linux.

About the author

Shahriar Shovon

Freelancer & Linux System Administrator. Also loves Web API development with Node.js and JavaScript. I was born in Bangladesh. I am currently studying Electronics and Communication Engineering at Khulna University of Engineering & Technology (KUET), one of the demanding public engineering universities of Bangladesh.