-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Sunday 22 September 2002 06:40 pm, Ian Firla wrote:
> In a moment of foolishness, I managed to wipe out rpm from one of my
> machines... I mean, remove it and its libraries and its database
> completely.
>
> I've since compiled rpm from source and, theoretically, it works.
> However, given that the database is gone, I can't install anything with
> it since it doesn't know which software I've got on the system.
>
> I see from the list that someone asked this same question in November
> of 2001 but I have seen a response. How do I rebuild the database?
>
> rpm --initdb and rpm --rebuilddb are not the answer. They'll help if
> the db is corrupted. What about when the db is complete erased though?

If you still have the rpm log file(s), I have a script that may help.

Every rpm on the system is logged to /var/log/rpmpkgs by a daily cronjob. 
You should be able to use one of the several files kept around by 
logrotate, since the most recent file is liable to be empty or damaged if 
the cronjob has run since the database was removed. 

You'll also need access to the rpms listed in the file you want to restore 
from. They can be on the hard drive, a cdrom, nfs mount, etc. For every 
package listed in the rpmpkgs file, the script looks in the given search 
directories, and if the package.rpm is found, runs rpm -ivh --justdb 
- --force --nodeps on that package. Provided you have access to the 
majority of the installed package.rpm files, it should get the database 
in reasonably good shape. The script is intended for disaster recovery 
only. This case seems to fit the bill, as you have no existing database 
to damage. ;)

The script is available here:
http://www.tuxfan.homeip.net:8080/hacks/recover_rpm_db.sh

Usage: recover_rpm_db.sh -f [file_name] -p [path[s] to rpm files].
Where 'file_name' is a file containing a list of rpm packages
that should be included in the rpm database, and -p is the
path or paths that contain the rpm packages.

Good luck, hope you find it useful,
- -- 
- -Michael

pgp key:  http://www.tuxfan.homeip.net:8080/gpgkey.txt
Red Hat Linux 7.{2,3} in 8M of RAM: http://www.rule-project.org/
- --
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iEYEARECAAYFAj2OYYUACgkQn/07WoAb/SvF+QCfW0FLD1DY0jddOV2YbZXXCmqZ
Qw8AoJpgxlMqwb/FNWKzP3v+G9Y0+30j
=hs8c
-----END PGP SIGNATURE-----



_______________________________________________
Seawolf-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/seawolf-list

Reply via email to