rpm and yum rescue tips on Fedora

April 22nd, 2008 mysurface Posted in Admin, awk, rpm, which, yum | Hits: 91915 | 3 Comments »

You have to be careful when you run yum update and yum install, DON’T force kill it, kill -9 or pkill -9. Those action are consider very dangerous, may lead you to losing certain files. Seriously, I hate yum, when I really wanna cancel the process in the middle, by hitting ctrl+c doesn’t really work! So, I do pkill -9, and I bare the consequences!

Some binaries are missing although the rpm query indicates those packages are successfully installed; some icons are missing, and I have no idea what’s wrong, I almost lose hope to reinstall everything. Thanks to my comrades Kagesenshi guiding me through finding the cause and I eventually fix it. Now, I share what I have done during the rescue.

First, let us look at how you can know better of what was installed in your system. With rpm query command lines, you can find out a lots of information.

Query All:

rpm -qa

This is what people usually do, combines with grep you can check whether a particular package is it install into your system.:

rpm -qa | grep mplayer

It takes sometimes if your system installed with tons of packages, you can also ignores the ‘a’ if you know the package name:

rpm -q mplayer

What files the particular package contains:
This is very important, sometimes the binary do not appear as the same as package name, for example: vim. And sometimes the package contains more than one binary.

rpm -qs vim-enhanced-7.1.245-1.fc8

normal        /etc/profile.d/vim.csh
normal        /etc/profile.d/vim.sh
normal        /usr/bin/ex
normal        /usr/bin/rvim
normal        /usr/bin/vim
normal        /usr/bin/vimdiff
normal        /usr/bin/vimtutor
normal        /usr/share/man/man1/rvim.1.gz
normal        /usr/share/man/man1/vimdiff.1.gz
normal        /usr/share/man/man1/vimtutor.1.gz

This binary is from which package?
This is also important, as sometimes I know the binary name but I do not know what package it bundle with, for example: ifconfig. To check for this, I need to specified absolute path of the binary, therefore i use which.

rpm -qf `which ifconfig`

Ok, now lets look at one of the yum utils command, package-cleanup.
package-cleanup allows you to detects package duplication, performs clean up and also checks on the missing dependency packages etc.

Any dependency problems?

package-cleanup --problems

Any duplication packages?

package-cleanup -d

Clean up those duplicated packages.

package-cleanup --cleandupes

If yum crashed, or interrupted halfway, you may try this to resume those yum transaction.


Sometimes, when rpm returns the result state that you have installed certain packages, some binaries might be missing if yum is been interrupted during installation process. For my case, my nm-applet binary was missing, nm-applet is bundle in NetworkManager-gnome package, but rpm query indicates my system was installed with NetworkManager-gnome.

Therefore, goes back to rpm, I verify all the packages to ensure all binaries from those packages was still there.

rpm -Va > rpmva.txt

Store that into a file, I will need that info to rescue my system. Here is a portion of the output:

missing   /usr/share/devhelp/images
missing   /usr/share/devhelp/images/book_closed.png
missing   /usr/share/devhelp/images/book_open.png
missing   /usr/share/devhelp/images/helpdoc.png
missing   /usr/share/devhelp/ui
missing   /usr/share/devhelp/ui/window.ui
S.5....T c /etc/passwd

You only want to focus on packages that its binaries are missing, therefore, perform awk to filter it.

awk ' $1 ~ /^missing$/ {print $2}' rpmva.txt > rpm-filemissing.txt

With missing file information, you can obtain package’s name by rpm -qf. The same package ‘s name may appear multiple times, you can use uniq to filter it.

rpm -qf `cat rpm-filemissing.txt` | uniq > pkg-reinstall.txt 

WARNING! Make sure you have internet access! check the package list, removes yum from the list or you can download yum rpm from the internet first, you are going to perform rpm removes on next step, after that yum the packages from the internet.

1. Removes problem’s rpm!

rpm -e --nodeps `cat pkg-reinstall.txt`

2. Clean all rpm cache downloaded by yum (optional)

yum clean all

3. Reinstall those packages!

yum -y install `cat pkg-reinstall.txt`

4. Check again to make sure all solves!

rpm -Va; package-cleanup --problem

DISCLAIMER: These are the steps I do, and it does recover my broken packages, you should only treat this post as a reference to help you solve your problem, as your problem may not equivalent to mine,

3 Responses to “rpm and yum rescue tips on Fedora”

  1. Oh my goodness! an amazing article dude. Thanks Nonetheless I am experiencing difficulty with ur rss . Don’t know why Unable to subscribe to it. Is there anyone getting an identical rss problem? Anyone who is aware of kindly respond. Thnkx

  2. I think this is a real great post.Much thanks again. Much obliged.

  3. Hi my friend! I want to say that this post is awesome, great
    written and come with approximately all vital infos.
    I would like to see extra posts like this .

Leave a Reply