Trying to remove yum which is protected in Centos

39,897

Solution 1

The right way to do what I was looking for is by doing:

rpm -e --nodeps PACKAGE

in the command line.

Solution 2

The command yum remove <package> removes the package as well as any packages that depend on it.

In your case, you are trying to remove a package that has many other packages depending on it, including the yum package itself. It is as if you run yum remove yum, which is why you get this error message.

The command:

rpm -e --nodeps <package>

Can be used to remove a package without removing the packages which depend on it but this will obviously break all these other packages.

Installing or removing packages with rpm --nodeps can cause applications to misbehave and/or crash, and can cause serious package management problems or, possibly, system failure.

For more details see https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Deployment_Guide/sec-Removing.html

Share:
39,897
Uriel Hernández
Author by

Uriel Hernández

Updated on March 04, 2021

Comments

  • Uriel Hernández
    Uriel Hernández about 3 years

    Well, I'm trying to execute the following command.

    yum remove libffi-3.0.9-1.el5.rf.i386
    

    Because I need that file (?), however facing problems while installing ruby with rvm, as libffi-devel is a dependecy of rvm to install ruby.

    However it gives me the following error, and of course it doesn't delete anything.

    Error: Trying to remove "yum", which is protected
     You could try using --skip-broken to work around the problem
     You could try running: rpm -Va --nofiles --nodigest
    

    I've already tried with --skip-broken and I get this:

    Error: Trying to remove "yum", which is protected
     You could try running: rpm -Va --nofiles --nodigest
    

    As you may see, I'm not an expert in Linux, but I need to install Ruby with rvm and I can't because of this error, does anyone of you have an idea of what am i doing wrong?

    Thank you :)

  • Bren
    Bren about 10 years
    Thanks a lot, now yum does not work at all. It yum warns you this, apparently it means yum requires the lib you are trying to remove. So don't. Because it will break yum.
  • tschale
    tschale over 9 years
    Had the same problem as @gomyes, but as I was updating a package (installing it via rpm afterwards), yum worked again. So this should maybe only be used for updating a certain package, if for some reason you can't or won't update it via yum update.
  • McNab
    McNab over 9 years
    I had the same problem, the comments in this answer put me off using this command. I got desperate though, it worked fine and yum wasn't affected. Centos 6.6. rpm -e --nodeps libffi and then I installed libffi-devel with yum install libffi-devel. Ruby then installed fine. superuser.com/questions/841805/…
  • Bal
    Bal over 8 years
    This broke yum for me after i removed openssl. To fix it, I had to manually download the openssl rpm and re-install it.
  • Ahmad Abdelghany
    Ahmad Abdelghany about 7 years
    Installing or removing packages with rpm --nodeps can cause applications to misbehave and/or crash, and can cause serious package management problems or, possibly, system failure. access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Lin‌​ux/…