Product SiteDocumentation Site

7.3. package-cleanup

This utility provided by yum-utils package helps to detect problems in the rpm database and to solve them, below is a listing showing the most common usages.
Orphaned packages
To list the orphaned packages, those packages are not provided by any of the configured repositories, "are repository orphans", use the --orphans option.
# package-cleanup --orphans 
...
8Kingdoms-1.1.0-6.fc9.i386
WorldOfGooDemo-1.41-1.i386
adobe-release-i386-1.0-1.noarch
apollon-1.0.1-14.fc11.i586
...
Duplicate Packages
To list the packages with duplicates in the RPM database use the --dupes option.
$ package-cleanup --dupes 
...
samba-3.2.8-0.27.fc10.i386
samba-3.2.8-0.26.fc10.i386
libtalloc-1.2.0-26.fc10.i386
libtalloc-1.2.0-27.fc10.i386
wireshark-gnome-1.0.6-1.fc10.i386
wireshark-gnome-1.0.5-1.fc10.i386
Dependency Problems
To list the dependencies problems in the RPM database use the --problems option.
$ package-cleanup --problems 
...
Reading local RPM database
Processing all local requires
Missing dependencies:
Package samba requires samba-common = 0:3.2.8-0.26.fc10
Package wireshark-gnome requires wireshark = 1.0.5-1.fc10
Removing old kernels
package-cleanup is also useful for removing old kernel installations and for removing old kernel related packages use the --oldkernel option:
# package-cleanup --oldkernel
Setting up yum
Loaded plugins: dellsysidplugin2, fastestmirror, kernel-module, presto,
              : priorities, protectbase, upgrade-helper, versionlock
Loading mirror speeds from cached hostfile
I will remove the following 3 kernel related packages:
kernel-2.6.30.5-43.fc11.i586
kernel-devel-2.6.29.6-217.2.16.fc11.i586
kernel-devel-2.6.30.5-43.fc11.i586
Is this ok [y/N]: y

# rpm -qa kernel*
[root@movix ~]# rpm -qa kernel*
kernel-headers-2.6.30.9-90.fc11.i586
kernel-2.6.30.8-64.fc11.i586
kernel-devel-2.6.30.8-64.fc11.i586
kernel-2.6.30.9-90.fc11.i586
kernel-devel-2.6.30.9-90.fc11.i586
kernel-doc-2.6.30.9-90.fc11.noarch
kernel-firmware-2.6.30.9-90.fc11.noarch
# uname -r
2.6.30.9-90.fc11.i586

It does not interpret installonly_limit

Note that an old kernel has been left according to the common yum practice to maintain two full kernels installed. Beware that this command does not interpret the option installonly_limit in the file yum.conf.

7.3.1. Usage Examples

# package-cleanup --orphans
Setting up yum
libsndfile-1.0.14-1.fc5.i386
grisbi-0.5.8-2.fc5.i386
gedit-2.14.1-1.i386
...
Because of the way the updates are managed, package-cleanup only considers the latest version of the package, the outdated packages provided by the configured repositories will appear as orphans, ie the Updates repository for example, does not continue to offer the previous version for the effects of package-cleanup. That is, before making a package-cleanup --orphans, it is recommended to make a full update if possible, and to be careful not to remove these packages easily, because the can be manually installed packages working perfectly well, or simply the repository from which the were installed was disabled.
With package-cleanup and the --dupes option you can detect duplicate packages in the RPM database, in this example gedit-2.14.1-1.i386.
# package-cleanup --dupes
...
gedit
...
# rpm -qa | grep gedit
gedit-2.14.1-1
gedit-2.14.3-1
We have two installed versions and the older version remained, probably due to some mismanagement. You can now easily start a cleaning job, and that's what package-cleanup is about.
# yum remove gedit-2.14.1-1
...
Setting up Remove Process
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Package gedit.i386 1:2.14.1-1 set to be erased
--> Running transaction check

Dependencies Resolved

=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
gedit                   i386       1:2.14.1-1       installed          13 M

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)
Is this ok [y/N] : y
Downloading Packages:
Running Transaction Test
After this operation is completed, some space on disk has been recovered, has been cleaned up, at least in part, the rpm database that represents the installed software on your Fedora system. For more usage details check the man page, man package-cleanup.