rpm and yum rescue tips on Fedora

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

From: Linuxbyexample


One thought on “rpm and yum rescue tips on Fedora

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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