Re: How to delete old yumdb entries?
Ljubomir Ljubojevic <[email protected]>
| Newsgroups | gmane.linux.rpm.yum |
|---|---|
| Organization | PL Computers s.z.t.r |
| Message-ID | <[email protected]> |
Време: 09/15/2011 02:52 PM, Ljubomir Ljubojevic пише: > Време: 09/15/2011 12:48 PM, Mike Fleetwood пише: >> On 15 September 2011 09:49, Frank Murphy<[email protected]> wrote: >>> On 15/09/11 09:15, Mike Fleetwood wrote: >>>> About 80% of >>>> my packages are new in Fedora 14, with 9% and 7% from Fedora 12 and 13 >>>> respectively and a handful from older one too. I still have nearly >>>> three times as many yumdb entries than the number of RPMs currently >>>> installed, which must be for old packages. >>>> >>>> Thanks, >>>> Mike >>> >>> if yo dont' want to go the full "yum clean all", >>> try "yumdb --help" >>> to see what options are available to you. >>> yum-utils must be installed for this (iirc). >> >> I tried yum clean all and it hasn't reduced the size of yumdb at all. >> > > "yum clean all" will only clean yum cache for the repositories. That has > nothing to do with database of already installed packages. > > Yum cache: /var/cache/yum.... > > > YumDB: > > Since yum 3.2.26 yum has started storing additional information about > > installed packages in a location outside of the rpmdatabase. None of > > the information stored there is critical to performing its function > > but it enhances the user experience and makes it possible to know > > more about the context in which a package was installed. > > > /var/lib/yum/yumdb/<letter>/$checksum-packagename-$ver-$rel.$arch> > > /keyname > > > Each keyname is a file and the contents of that file are the values. > > According to this and little investigation, you should check each > > /var/lib/yum/yumdb/<letter>/$checksum-packagename-$ver-$rel.$arch>/releasever > > > file and see for what version it was installed. My guess is that string > in releasever file will determine if file was from 12.0, 13.0, etc... > > Ljubomir Ljubojevic This should get you going: installed=$(rpm -qa --qf '%{NAME}\n' | sort) for pckg in $installed; do yumdb get releasever $pckg | grep -v "Loaded plugins" | tr -d '\n' | awk '{print $4 " " $1}' | sort | awk '{print $2 " " $1}' > installed_pckg.txt done Now you will have the list of installed packages sorted by releasever key. You can also use: yumdb search releasever "12.0" to search for specific values/<distro versions>, but be carefull. I my CentOS 6 there are packages with either "6" and "6.0" for releasever, but "6" is not equal to "6.0", they are separate/diferent/unique key values. For short list without version numbers and $arch use this: installed=$(rpm -qa --qf '%{NAME}\n' | sort) for pckg in $installed; do yumdb get releasever $pckg | grep -v "Loaded plugins" | tr -d '\n' | awk '{print $4 " " "'"$pckg"'" }' | sort | awk '{print $2 " " $1}' > installed_pckg_short.txt done Next part would be to delete (presumable) old packages, but I see multiple possible problems since it looks like yumdb is saving only entries that are current, actualy used by sistem. I looked for my package "krusader" which I updated recently, but older version is no where to be seen, just the latest. Procedure to delete would be to find directories in /var/lib/yum/yumdb/ matched with full package name (with version and $arch) using listing of names provided with the first/upper script I wrote, and delete them with rm -fR <folder name>, or better to move it to safe location and delete it manualy. Ljubomir Ljubojevic _______________________________________________ Yum mailing list [email protected] http://lists.baseurl.org/mailman/listinfo/yum