Cleaning unused RPM packages

On a Fedora, Red Hat, CentOS, Mandriva, or RPM-based similar system, you may have installed some RPM software you don’t use. There are some easy ways to check.

First, look through the biggest packages. This command displays the packages in order from smallest to largest.

rpm -qa --queryformat="%{NAME} %{SIZE}\n" | sort -k 2 -n

On my Fedora 11 system, the end looks like this:

gnome-user-docs 48174253
jre 48824854
kernel 49087730
kernel 49247033
kernel 49264829
libgcj 49666075
wine-core 57989940
thunderbird 70502350
libgweather 79809273
java-1.6.0-openjdk 88175735
gutenprint-foomatic 89742590
ooobasis3.1-core04 91459112
VirtualBox 95813539
glibc-common 97556081
git 100008386
VMware-Player 101075736
texlive-texmf-fonts 112425640
AdobeReader_enu 150806101

What is texlive-texmf-fonts It eats 107MB! This command prints the RPM package description:

[z@a scripts]$ rpm -qi texlive-texmf-fonts
Name        : texlive-texmf-fonts          Relocations: (not relocatable)
Version     : 2007                              Vendor: Fedora Project
Release     : 28.fc11                       Build Date: Wed 25 Feb 2009 03:35:16 PM MST
Install Date: Fri 24 Jul 2009 03:16:31 PM MDT      Build Host:
Group       : Applications/Publishing       Source RPM: texlive-texmf-2007-28.fc11.src.rpm
Size        : 112425640                        License: Artistic 2.0 and GPLv2 and GPLv2+ and LGPLv2+ and LPPL and MIT and Public Domain and UCD and Utopia
Signature   : RSA/8, Mon 16 Mar 2009 04:23:06 PM MDT, Key ID 1dc5c758d22e77f2
Packager    : Fedora Project
URL         :
Summary     : Font files needed for TeXLive
Description :
This package contains the components of the TEXMF tree needed for the
texlive-fonts package.

I don’t use that directly, so let’s try removing it to see if other software uses it. Using yum remove is better than calling rpm -e because yum checks the dependencies.

[z@a ~]$ sudo yum remove texlive-texmf-fonts

Now pay attention! With dependencies, this will remove 11 packages. I know I don’t need these particular packages, so I approve the change and save about 140MB.

Next, you noticed I had three kernels installed? Since I last rebooted a month ago, and I’ve installed two kernel updates. That means I’m using the oldest kernel, and when I reboot, I will use the newest kernel, so I can remove the middle kernel.

[z@a ~]$ rpm -q kernel

This command shows which I am using:

[z@a ~]$ uname -a
Linux a.z #1 SMP Tue Jul 7 20:45:17 EDT 2009 i686 athlon i386 GNU/Linux

So I will remove the middle kernel package and save about 50MB.

[z@a ~]$ sudo rpm -e kernel-

To save more disk space, look for orphaned packages. These are old dependencies that aren’t needed any more. Install rpmorphan:

[z@a ~]# sudo yum -y install rpmorphan

Ironically this little 55KB package requires 5MB of dependencies itself. Let’s hope it’s worth it!

While rpmorphan has some command line options, I run it plain:

[z@a ~]# rpmorphan

Generally orphaned packages starting with lib are safe to delete. The following command deletes the orphans (and uses triple safety):

rpmorphan | grep ^lib | xargs sudo rpm -e

Another way to save disk space is to remove part of installed packages by using the localization (locale) cleaning feature in BleachBit. This saves disk space by removing languages you don’t use.

Finally, I remind you: don’t remove packages you don’t understand! You could destroy your system, though Linux is easy to repair advanced users) if you can boot in to recovery mode, identify the missing packages, and reinstall the missing packages. This repair takes some skills, but it’s simpler than fixing Windows.


One thought on “Cleaning unused RPM packages

  1. Pingback: Scientific Linux 5.5: Making it lean and mean for a base server setup | Unreliable, insecure scribbles by an incompetent

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s