24

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?

rogerdpack
  • 1,715
  • 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 '17 at 23:02

2 Answers2

32

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...

rogerdpack
  • 1,715
  • 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 '19 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 '19 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. https://forums.centos.org/viewtopic.php?f=13&t=1323 – Mark Aug 05 '20 at 16:01
  • 1
    In case you want to left files: rpm -e --nodeps --justdb packageA – Oleg Neumyvakin Sep 08 '21 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 '21 at 14:45
16

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

sudo yum remove --noautoremove <package name>
Jaime
  • 196