How do I tell yum not to remove itself?

6,679

You are trying to remove some essential packages which would break your system if removed:

  • python: yum is written in Python, so this package cannot be removed, or else you lose your package manager.
  • binutils: systemd needs this package, and systemd is your init system, which is crucial to using CentOS 7.
  • gawk: A ton of things depend on gawk, including both yum and systemd.

You cannot remove those critical system packages, so exclude python, binutils, and gawk from your list of packages to remove.

Note that you are still trying to remove some useful packages like gettext, sudo, and wget, which might not horribly break your system but could reduce usability.

Share:
6,679

Related videos on Youtube

Chloe
Author by

Chloe

Updated on September 18, 2022

Comments

  • Chloe
    Chloe over 1 year

    When I run this command

    $ sudo yum erase git make gcc g++ zlib1g-dev libssl-dev wget subversion file python apt-utils binfmt-support vim apt-file xz-utils sudo subversion zlib1g-dev gawk flex unzip bzip2 gettext build-essential libncurses5-dev libncursesw5-dev libssl-dev binutils cpp psmisc docbook-to-man gcc-multilib g++-multilib
    

    I get this error:

    Error: Trying to remove "systemd", which is protected
    Error: Trying to remove "yum", which is protected
    

    But those aren't packages I gave. I tried -t to tolerate errors, and -x yum -x systemd to specifically exclude those two, but it still gave the error.

    $ sudo yum -x yum -x systemd erase git make gcc ...
    
  • Chloe
    Chloe about 7 years
    It still gave the error. Isn't there a way to tell it to ignore any packages that yum depends on?
  • Deltik
    Deltik about 7 years
    @Chloe: Reload my answer. I forgot to address systemd's dependency on binutils.
  • Chloe
    Chloe about 7 years
    It still complains about both of them.
  • Ramhound
    Ramhound about 7 years
    Update your question with the current command your using
  • Deltik
    Deltik about 7 years
    @Chloe: How about now?
  • Chloe
    Chloe about 7 years
    I just kept running it one package at a time (well maybe 3 at a time) until it worked. I really wanted a way for it to figure it out automatically. Yes, I should not remove sudo either. It's a Vagrant box so it's pretty disposable. I want to keep the virtual disk as small as possible. If I need one of those, I'll just re-install it.
  • Martian
    Martian almost 7 years
    perhaps you should use cloud images - just a search away: centos cloud vagrant. - cloud.centos.org/centos/7/vagrant/x86_64/images
  • Pierre.Vriens
    Pierre.Vriens over 6 years
    i do not get it
  • Darren
    Darren over 6 years
    Could you add some more detail such as what this does.