I've seen my share of Yum problems, because I run yum on low memory systems (256-512 MB) and yum needs at least a gig or so to run comfortably. Never mind that Debian has this problem solved long ago, but hey -- what can you do?

Yum hangs forever without output

Sometimes, yum hangs forever without output. CTRL-C doesn't work, only a hard kill will stop the process. Also, neither the --verbose flag nor the -d debugging flag will have any effect.

To fix this, run the following commands:

 # ls -l /var/lib/rpm 
 # rm -f /var/lib/rpm/__db*
 # rpm -vv --rebuilddb
 # yum clean all
 # rm /var/run/yum.pid
 # yum clean all

Then finally, think about running:

 # yum update

But you might want to list the updates, and update them one-by-one.

Useful options

When you run yum, it's always a good idea to nice the process. In case of heavy CPU usage, it's easy to log in and kill the process:

  $ sudo nice -n 19 yum .......

In order to weed out possible problems, add the --noplugins option. To check that yum is actually doing something, use the --verbose flag.

Letting yum run overnight

Be careful when running a large number of transactions. When certain cronjobs kick off around midnight, they may run RPM, and lock the database somehow. This will result in both a hanging cronjob as well as a hanging yum. On small machines, it's always better to list possible updates (don't use sudo for this one, it makes it more difficult killing the process):

 $ yum check-update

Then, run them one by one:

 $ sudo nice -n 19 yum update xxxxx