[CentOS] RPM: any better way to reinstall only certain files? [(UN?)SOLVED]

Dag Wieers dag at wieers.com
Thu Jul 13 01:28:38 UTC 2006


On Wed, 12 Jul 2006, William L. Maltby wrote:

> On Tue, 2006-07-11 at 16:15 -0400, William L. Maltby wrote:
> > <snip>
> 
> Since Jim went out of his way helping to hunt for a good solution, I
> thought I would summarize here for folks that might have a similar need
> down the road. Experienced rpmers/bashers/perlers/pythoners/.... should
> probably skip this.
> 
> Thanks Jim Perrin!
> 
> Situation was that rpm --verify showed lots of missing files. Most due
> to a bad spot that developed on my former boot drive. After a little
> thought, I suspect some had been removed by me because they were
> internationalization files (*/locale/* and */i18n/*) and it is the sort
> of thing I would do... sometimes and forget to log! :-(
> 
> Anyway, none of the rpm params we tried seemed to "recover" missing
> files, whether we tried --install ("... package already installed ...")
> --update or --freshen (both just did nothing since I was up-to-date).
> The --replacefiles also did not help.
> 
> While this was going on, I was scripting (Q & D for sure) to utilize the
> rpm2cpio utility. We could easily expand the rudimentary Q&D crap I
> started here into a fairly automated assistant, if so desired. I suspect
> that it might be better done in something other than bash though.
> 
> I had a basic file which was an annotated list of missing files (and
> other errors) from my "rpm --verify ..." run. It looked similar to this.
> 
>    missing   d /usr/share/doc/redhat-logos-1.1.26/COPYING
> 
>    #############################################################
>    # Owned by Apache Runtime Development                       #
>    missing     /usr/share/doc/apr-devel-0.9.4
>    missing   d /usr/share/doc/apr-devel-0.9.4/APRDesign.html
> 
> Ownership was determined manually by running an rpm query using selected
> files, thusly.
> 
>    # rpm --query --file /var/spool/mqueue
>    sendmail-8.13.1-3.RHEL4.5.i386
>    #
> 
> The results were (eventually) saved in a list of all the needed rpm
> files.
> 
> To help determine that I didn't miss any rpm packages, I would also run
> something similar to this.
> 
>    # rpm --query sendmail --filesbypkg
>    sendmail                  /etc/aliases.db
>    sendmail                  /etc/mail
>    sendmail                  /etc/mail/Makefile
>    sendmail                  /etc/mail/access
> 
> So that I could visually make sure I knew where the next package missing
> file was in my original list of missing files.
> 
> Once I had the complete list of needed rpm files, a simple script did a
> wget of the files from a CentOS (and Extras) mirror. The rpms were
> converted to cpio files using the utility "rpm2cpio".
> 
> I wrote another slightly less simple script that operated over that
> list, running cpio extract, and prompted me for glob patterns to select
> files to be re-installed for each package. I could manually enter up to
> 25 match patterns (TG only glibc-common used them all) so that I could
> re-install a set of files almost no larger than needed. Since I did not
> provide the "u" flag to cpio, it would not replace files that had a
> later/equal time stamp, thereby freeing me from worry about locally
> modified configuration files. This allowed a more liberal glob pattern,
> in many cases, saving some typing.
> 
> A short note about the pattern matching: most of the converted cpio
> files had relative paths that began "./", while a *few* had just the
> relative path name (e.g. "usr/share", no leading "./"). This caused some
> delay as multiple extract runs had to be made after investigating
> failures. Fortunately, I was logging to files so even vary large
> extracts did not scroll off-screen and vanish into the ether.
> 
> I'd be glad to annotate and provide my shells if anyone wants them. Keep
> in mind they are Q&D status only and no shame or pride is associated
> with them.
> 
> A recent rpm --verify shows just the normal stuff now, so success was
> had (hmm... as long as it took, *I* was had ;-)
> 
> HTH someone down the road.

If you have a list of packages that were installed, you can provide that 
to apt-get with the --reinstall option.

	apt-get install --reinstall <list of packages>

Kind regards,
--   dag wieers,  dag at wieers.com,  http://dag.wieers.com/   --
[all I want is a warm bed and a kind word and unlimited power]



More information about the CentOS mailing list