Help: aborted 'yum upgrade' and corrupted rpm database resulted

Paul Johnson pauljohn32 at gmail.com
Thu May 18 06:06:07 UTC 2006


If you run this all on one line, it will list all of your RPMS, find
the packages that have 2 or more listed entries, sort them from new to
old, and tell rpm to delete them.  Cut off the last bit, the xargs
part, if you just want to see a list of the redundant packages.

 Even if you don't need it right now, you should save it, because it
has come in handy for me a couple of times.

for file in `rpm -qa --queryformat="%{NAME} %{ARCH}\n" | sort | uniq
-c | grep -v "  1 " | cut -c 9- | cut -d" " -f1`; do rpm -q --last
$file | tail -1 | cut -d" " -f1; done | grep -v gpg-pubkey | grep -v
kernel | xargs rpm -e

It seems to me that EVERY single time I've tried to run a DVD upgrade
of Fedora Core 4, the install bogs down and quits after installing
about three-fourths of the packages.  That's bad because it leaves a
full set of FC4 packages as well as the FC5 new ones.  This script
really helps to kill the duplicates.

On 4/28/06, Sam Varshavchik <mrsam at courier-mta.com> wrote:
> Robinson Tiemuqinke writes:
>
> > But when I tried to see what's in my rpm database, I
> > found that there are duplicate entries for all
> > packages upgraded before hang -- Yum doesn't cleanup
> > the old version info from rpm database because it
> > hanged and then be killed.
> >
> > Any one know how to deal with this problem
> > effectively? I hate to list tens of obsoleted rpms one
> > by one and feed them to "rpm -e --justdb" command.
>
> Well, that's just what you'll have to do.
>
> When I upgraded from FC3 to FC4, for some reason every invocation of
> /sbin/ldconfig from a %post and %postun segfaulted, when anaconda was doing
> its business.  The end result was a crapload of packages that had both the
> old and the new package versions in rpmdb.  This was 100% reproducible, with
> each machine that I upgraded from FC3 to FC4.  This was even more fun with
> the x86_64 FC, with multilib packages.
>
> rpm can really blow goats, sometimes.
>
> So, I just had to write a script to find every package with dupe versions
> installed, and remove the obsoleted version of the package.
>
> That's life.
>
>
>
> --
> fedora-list mailing list
> fedora-list at redhat.com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
>
>


-- 
Paul E. Johnson
Professor, Political Science
1541 Lilac Lane, Room 504
University of Kansas




More information about the fedora-list mailing list