[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: rpmdb crashed, how to repair? [FC3]



yum died on me once and left a bunch of dup packages on my system
since the cleanup part never ran on these packages.  I wrote a script
to fix these:

#!/bin/bash

        for package in $(rpm -qa --qf '%{name}.%{arch}\n' | sort | uniq -d) ; do
                remove=`rpm -q $package | grep -v $(repoquery --quiet
-C --queryformat '%{version}-%{release}' $package)`
                echo "Removing $remove.i386 ...";
                rpm -e --nodeps "$remove.i386";
                echo "Removing $remove.x86_64 ...";
                rpm -e --nodeps "$remove.x86_64";
        done

This script only gets i386 and x86_64 packages,  the noarch and i686
packages will have to be done by hand

On 2/5/06, Andy Green <andy warmcat com> wrote:
> Jim Cornette wrote:
>
> > There was a script out there that someone made that made a file in the
> > /tmp directory, then compared the uniq version and outputted the version
>
> I was the someone.  The script is available at
>
> http://warmcat.com/listrpmdupes
>
> (Use Rightclick | Save As... )
>
> but note it will not work right on x86_64, since duplicated packages
> differing only by arch are normal there.
>
> What it does is not only list duped packages but specifically lists the
> ones it thinks can be deleted.  So if you have blah-1.00 and blah-1.01
> installed, the script will only output blah-1.00, which can be fed
> directly to rpm -e.  If only one version of blah is installed it outputs
> nothing about blah.  On a happy machine it won't output anything at all.
>
> I used it several times with success, but it does no harm to review its
> output and convince yourself it makes sense considering rpm -qa before
> feeding it to rpm -e :-)
>
> -Andy
>
>
>
> --
> fedora-list mailing list
> fedora-list redhat com
> To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
>
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]