HowTo: remove protected packages on Fedora with dnf

Original Comment

  • How to remove a protected package
  • How to make dnf remove a protected package
  • How to fix “protected package” on Fedora
  • How to remove the GNOME desktop with dnf

This is a very common problem. Thanks @vgaetera for the command.

As Fedora Discussion is very well indexed, I would like to put this here.

NOTE

Make sure you exit to a “TTY” before removing a desktop!

Do this by pressing Ctrl Alt F3 after logging out, or when being at the initial login screen.

Example command to remove a single protected package:

sudo dnf remove gnome-shell --setopt protected_packages=

Command to open a dnf shell with custom parameters, do the changes and exit with run:

sudo dnf shell -y --setopt protected_packages=

Automated, this can look like:

sudo dnf shell -y --setopt protected_packages= << EOI
swap fedora-release-workstation fedora-release-kde
swap fedora-release-identity-workstation fedora-release-identity-kde
run
remove @gnome-desktop
run
remove *gnome* *gtk*
run
install @kde-desktop-environment
run
EOI

sudo systemctl restart sddm.service

This would remove the GNOME Desktop and replace it with the KDE Plasma Desktop, without reinstalling.

I would really upvote this for helpfulness, but the ‘remove Gnome for KDE’ part is triggering me just a bit too much for a generic HowTo, haha. Nice tutorial though. :+1:

Maybe replace the package names with fictional ones? :wink:

1 Like

yes I also thought of replacing package names… but… I am also a KDE user, and actually this exact issue is more common than others, as Fedora is GNOME by default and changing to any other Desktop fully, requires removing GNOME.

Added howto and removed proposed-howto