21

Today if I do $ yum remove packageA I am greeted with:

Removing:
packageA                        noarch                 3.5.1.b37-15                                 @yumFS                 293 k
Removing for dependencies:
 packageB                      noarch                 3.5.1.b125-7                                 @yumFS                  87 M
..
Is this ok?

I would like to remove packageA without removing packageB (etc) is this possible?

1
  • 2
    Possible? Yes. But the entire purpose of package managers is to prevent exactly this. Google around for "RPM Hell" for a good idea of what you're setting yourself up for by doing such a thing.
    – DopeGhoti
    Jun 21, 2017 at 23:02

2 Answers 2

31

Appears possible, by using rpm:

$ rpm -e --nodeps packageA

though obviously be very careful, since if you remove a dependency package and don't put it back that could lead to unexpected results for the packages still installed that depend on it and anticipate it being present...

5
  • Question about this. I was having a dependency version issue, the warning was Application built with libpng-1.6.16 but running with 1.5.13. I thought I'd just swap it, but yum wanted to remove a ton of stuff if I first removed libpng. So I used the approach you show here to remove both libpng and libpng-devel, then built and installed libpng-1.6.1 from source, and my problem went away. While it worked for software I immediately needed (Mapnik), can I trust that I didn't break something else back upstream, for example something yum initially wanted to remove along with libpng?
    – elrobis
    Jun 18, 2019 at 20:36
  • So there was no package option to install 1.6? Hmm my hunch is they use shared libraries and you're good, but they weren't tested by the package managers either so...I dunno how the package management system works.
    – rogerdpack
    Jun 18, 2019 at 21:20
  • 1
    WARNING be careful running this command, it will potentially break yum with There was a problem importing one of the Python modules required to run yum. forums.centos.org/viewtopic.php?f=13&t=1323
    – Mark
    Aug 5, 2020 at 16:01
  • 1
    In case you want to left files: rpm -e --nodeps --justdb packageA Sep 8, 2021 at 13:50
  • I had to use this technique to install both the remi php74 package (which depends on httpd) and httpd24-httpd, which conflicts with httpd. I was able to remove httpd and install httpd24-httpd, which still worked as a dependency to the remi php74 package.
    – Mike Godin
    Nov 23, 2021 at 14:45
13

I found it was possible to do this with yum like so:

sudo yum remove --noautoremove <package name>
3
  • 5
    Hmm...I tried it out on CentOS 6 and 7 and got "no such option: --noautoremove" any ideas?
    – rogerdpack
    Jun 6, 2019 at 16:05
  • 3
    I was on fedora 29 when I did this testing a new package I just created. Hmm.. wonder if its a fedora only thing.
    – Jaime
    Jun 6, 2019 at 21:08
  • 4
    Works on CentOS 8 May 23, 2020 at 16:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .