rpm-software-management/yum

yum autoremove tries to remove systemd

jamescassell opened this issue · 1 comments

When running yum autoremove, yum tries to remove systemd, even though systemd is marked as 'reason: user' in yumdb.

In my case, I'm trying to remove policycoreutils-python (in a container), which indirectly depends on shadow-utils, which is required by systemd.

I can workaround the issue by yumdb set reason user shadow-utils to make the autoremove successful.

The reason seems to be that required_packages() and requiring_packages() do not run recursively:

yum/yum/rpmsack.py

Lines 115 to 128 in 1222f37

def requiring_packages(self):
"""return list of installed pkgs requiring this package"""
pkgset = set()
for (reqn, reqf, reqevr) in self.provides:
for pkg in self.rpmdb.getRequires(reqn,reqf,reqevr):
if pkg != self:
pkgset.add(pkg)
for fn in self.filelist + self.dirlist:
for pkg in self.rpmdb.getRequires(fn, None, (None, None, None)):
if pkg != self:
pkgset.add(pkg)
return list(pkgset)

yum/yum/rpmsack.py

Lines 131 to 138 in 1222f37

def required_packages(self):
pkgset = set()
for (reqn, reqf, reqevr) in self.strong_requires:
for pkg in self.rpmdb.getProvides(reqn, reqf, reqevr):
if pkg != self:
pkgset.add(pkg)
return list(pkgset)

dmnks commented

Thank you for the report. However, please note that this project has been deprecated and is no longer maintained upstream. Please consider migrating to DNF which is the successor of YUM. That said, I’ll close this issue now.