package-cleanup --leaves

Issues related to applications and software problems
Post Reply
fuzzy4096
Posts: 12
Joined: 2020/12/14 16:29:11

package-cleanup --leaves

Post by fuzzy4096 » 2021/01/11 14:37:42

While following https://access.redhat.com/solutions/64069 General documentation of the system state both prior to and after patching is always good practice. This should include running package-cleanup with following flags, --orphans, --problems, --dupes, --leaves.

Looking for orphans (packages which are not available from currently configured repositories) I did get kernel-3.10.0-1127.el7.x86_64 and it would be true, because I've installed CentOS 7.8 and upgraded to 7.9 and the kernel package is in the https://vault.centos.org/7.8.2003/os/Source/SPackages/ repo not the 7.9.

Code: Select all

[root@localhost boot]# package-cleanup --orphans
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: centos.wielun.net
 * extras: centos.wielun.net
 * updates: centos.wielun.net
kernel-3.10.0-1127.el7.x86_64
[root@localhost boot]# rpm -qa kernel
kernel-3.10.0-1160.6.1.el7.x86_64
kernel-3.10.0-1127.el7.x86_64
I can imagine that it would be advisable to run the above command in case I would like to use yum history undo to revert last made changes, and that a given rpm package would have to be available on the system, but if it was not removed during yum update then do I need really to care if the package is marked as orphaned ?

Next, I executed the following command, to get a list of leaves ( Leaf nodes are RPMs that are not relied upon by any other RPM):

Code: Select all

[root@localhost boot]# package-cleanup --leaves
Loaded plugins: fastestmirror
libsysfs-2.1.0-16.el7.x86_64
[root@localhost boot]# rpm -q --requires libsysfs-2.1.0-16.el7.x86_64
/sbin/ldconfig
/sbin/ldconfig
libc.so.6()(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
rpmlib(PayloadIsXz) <= 5.2-1
[root@localhost boot]# rpm -q --provides libsysfs-2.1.0-16.el7.x86_64
libsysfs = 2.1.0-16.el7
libsysfs(x86-64) = 2.1.0-16.el7
libsysfs.so.2()(64bit)
I've checked with rpm -q --provides what capabilities are provided with the libsysfs-2.1.0-16.el7.x86_64 package and it listed 3 items.

When I run now yum remove libsysfs-2.1.0-16.el7.x86_64 I get the following:

Code: Select all

[root@localhost boot]# yum remove libsysfs-2.1.0-16.el7.x86_64
Loaded plugins: changelog, fastestmirror
Resolving Dependencies
--> Running transaction check
---> Package libsysfs.x86_64 0:2.1.0-16.el7 will be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================================================================================================================
 Package                                     Arch                                      Version                                            Repository                                    Size
=============================================================================================================================================================================================
Removing:
 libsysfs                                    x86_64                                    2.1.0-16.el7                                       @anaconda                                    146 k

Transaction Summary
=============================================================================================================================================================================================
Remove  1 Package
Per my understanding yum resolved all the dependencies and it looks like I'm free to remove the pacakage, but I'm wondering about the output of the rpm -q --provides command. Is it correct to say that the 3 items listed is stuff that got installed together with the libsysfs.x86_64 0:2.1.0-16.el7 package AND since yum resolved all dependencies and no other stuff on the system requires this package + the packages/shared libraries it provides it can be removed without any issues ?

sml
Posts: 229
Joined: 2020/01/17 09:01:44

Re: package-cleanup --leaves

Post by sml » 2021/01/11 18:25:56

No. --requires/-R lists capabilities that are required by the package and --provides lists capabilities provided by the package itself, in this case by libsysfs.

The stuff that got installed with the package can be listed with --list/-l:

Code: Select all

$ rpm -ql libsysfs
/lib64/libsysfs.so.2
/lib64/libsysfs.so.2.0.1
/usr/share/doc/libsysfs-2.1.0
/usr/share/doc/libsysfs-2.1.0/AUTHORS
/usr/share/doc/libsysfs-2.1.0/COPYING
/usr/share/doc/libsysfs-2.1.0/CREDITS
/usr/share/doc/libsysfs-2.1.0/ChangeLog
/usr/share/doc/libsysfs-2.1.0/LGPL
/usr/share/doc/libsysfs-2.1.0/NEWS
/usr/share/doc/libsysfs-2.1.0/README
/usr/share/doc/libsysfs-2.1.0/libsysfs.txt
The packages that depend on capabilities provided by libsysfs can be listed with --whatrequires:

Code: Select all

$ rpm -q --whatrequires 'libsysfs.so.2()(64bit)'
no package requires libsysfs.so.2()(64bit)
So, no installed packages require libsysfs. But some not (yet) installed ones do:

Code: Select all

$ repoquery --whatrequires 'libsysfs.so.2()(64bit)'
edac-utils-0:0.16-16.el7.x86_64
libsysfs-devel-0:2.1.0-16.el7.x86_64
openhpi-0:3.8.0-1.el7.x86_64
rng-tools-0:6.3.1-5.el7.x86_64
sysfsutils-0:2.1.0-16.el7.x86_64
Unfortunately, the yum/dnf command provides corresponds to rpm/repoquery option --whatprovides (not to --provides!) which can be pretty confusing. That is,

Code: Select all

$ yum provides 'libsysfs.so.2()(64bit)'
libsysfs-2.1.0-16.el7.x86_64 : Shared library for interfacing with sysfs
Repo        : base
Matched from:
Provides    : libsysfs.so.2()(64bit)



libsysfs-2.1.0-16.el7.x86_64 : Shared library for interfacing with sysfs
Repo        : @anaconda
Matched from:
Provides    : libsysfs.so.2()(64bit)
is basically the same as

Code: Select all

$ repoquery --whatprovides 'libsysfs.so.2()(64bit)'
libsysfs-0:2.1.0-16.el7.x86_64
$ rpm -q --whatprovides 'libsysfs.so.2()(64bit)'
libsysfs-2.1.0-16.el7.x86_64

fuzzy4096
Posts: 12
Joined: 2020/12/14 16:29:11

Re: package-cleanup --leaves

Post by fuzzy4096 » 2021/01/12 08:28:06

Thank you for answering but I'm confused with your "No". Is it for the first or second question ? I'm confused because after removing the libsysfs package I can see that the shared libraries that it provides /lib64/libsysfs.so.2 and /lib64/libsysfs.so.2.0.1 got removed from the fs.


Code: Select all

[root@localhost ~]# package-cleanup --leaves
Loaded plugins: fastestmirror
libsysfs-2.1.0-16.el7.x86_64
[root@localhost ~]# rpm -q --provides libsysfs-2.1.0-16.el7.x86_64
libsysfs = 2.1.0-16.el7
libsysfs(x86-64) = 2.1.0-16.el7
libsysfs.so.2()(64bit)
[root@localhost ~]# rpm -ql libsysfs-2.1.0-16.el7.x86_64
/lib64/libsysfs.so.2
/lib64/libsysfs.so.2.0.1
/usr/share/doc/libsysfs-2.1.0
/usr/share/doc/libsysfs-2.1.0/AUTHORS
/usr/share/doc/libsysfs-2.1.0/COPYING
/usr/share/doc/libsysfs-2.1.0/CREDITS
/usr/share/doc/libsysfs-2.1.0/ChangeLog
/usr/share/doc/libsysfs-2.1.0/LGPL
/usr/share/doc/libsysfs-2.1.0/NEWS
/usr/share/doc/libsysfs-2.1.0/README
/usr/share/doc/libsysfs-2.1.0/libsysfs.txt
[root@localhost ~]# ls -l /usr/lib64/libsys
libsysfs.so.2                 libsystemd-daemon.so.0        libsystemd-id128.so.0         libsystemd-journal.so.0       libsystemd-login.so.0         libsystemd.so.0
libsysfs.so.2.0.1             libsystemd-daemon.so.0.0.12   libsystemd-id128.so.0.0.28    libsystemd-journal.so.0.11.5  libsystemd-login.so.0.9.3     libsystemd.so.0.6.0
[root@localhost ~]# ls -l /usr/lib64/libsys^C
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# yum remove -y -q libsysfs-2.1.0-16.el7.x86_64
[root@localhost ~]# package-cleanup --leaves
Loaded plugins: fastestmirror
[root@localhost ~]# ls -l /usr/lib64/libs
libsasl2.so.3                 libsepol.so.1                 libslapi-2.4.so.2.10.7        libsoftokn3.chk               libssl3.so                    libstdc++.so.6.0.19           libsystemd-journal.so.0.11.5
libsasl2.so.3.0.0             libsgutils2.so.2              libsmartcols.so.1             libsoftokn3.so                libssl.so.10                  libsystemd-daemon.so.0        libsystemd-login.so.0
libseccomp.so.2               libsgutils2.so.2.0.0          libsmartcols.so.1.1.0         libsqlite3.so.0               libssl.so.1.0.2k              libsystemd-daemon.so.0.0.12   libsystemd-login.so.0.9.3
libseccomp.so.2.3.1           libslang.so.2                 libsmime3.so                  libsqlite3.so.0.8.6           libss.so.2                    libsystemd-id128.so.0         libsystemd.so.0
libselinux.so.1               libslang.so.2.2.4             libsnappy.so.1                libssh2.so.1                  libss.so.2.0                  libsystemd-id128.so.0.0.28    libsystemd.so.0.6.0
libsemanage.so.1              libslapi-2.4.so.2             libsnappy.so.1.1.4            libssh2.so.1.0.1              libstdc++.so.6                libsystemd-journal.so.0

stevemowbray
Posts: 516
Joined: 2012/06/26 14:20:47

Re: package-cleanup --leaves

Post by stevemowbray » 2021/01/12 10:13:31

Not sure where your confusion lies. When you remove the package the files in the package are removed.

Post Reply

Return to “CentOS 7 - Software Support”