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

Re: Whoops, trashed my RPM database going to 4.0



On Thu, 31 Aug 2000, you wrote:
> 
> I just upgraded 82 packages to the RawHide version including RPM.  I had been 
> running 3.0.5 and am now running 4.0.  I upgraded a whole slew of packages and 
> afterwards 'rpm -qa' returned nothing.  I ran 'rpm --rebuilddb' and it didn't
> help.  I then finally looked at the email annoucning rpm-4.0 and saw that it 
> said I should install rpm and popt together.  I realized that I hadn't 
> upgraded popt (might have been nice if it had told me there was a dependency), 
> so I installed it (with a -nodeps flag).  Now 'rpm -qa' tells me that the only RPM 
> I have installed is popt.
> 
> Should I just reinstall everything on top of itself or is there an easier way 
> to dig myself out of this hole?

Below are very complete instructions that Jeff Johnson sent to the list to help
dig me out of the very same mess. (The difference is I was running something
less than 3.05.) The key to my problem was not having all of the related rpm
sub-packages installed. Also, Jeff suggested rm'ing packages.rpm before doing
rpm --rebuilddb. This failed for me. I had to have packages.rpm present to do
the rebuild, but rm'ing it after the fact has caused no ill effects. I can no
longer run gnorpm ( it looks for packages.rpm, not Packages) but that's a minor
thing.

Good luck,

Gary


On Sat, Aug 26, 2000 at 06:13:49AM -0500, Gary Shears wrote:
> On Fri, 25 Aug 2000, you wrote:
> > On Fri, 25 Aug 2000, Bryan Stillwell wrote:
> > > I'm going to try to keep this message short.  So, here's the two
> > > problems I'm having and would like to know if any one else has had these
> > > problems with RPM v4:
> > > 
> > > After installing RPM v4 from rpm or from the tar ball whenever I try to
> > > rebuild a package (i.e. When I run rpm --rebuild or rpm -ba) it prints
> > > out the help text.
> > > 
> > > And second when upgrading RPM with the .rpm from 3.0.4 to 4.0 it appears
> > > to work.  However when I do a `rpm -q rpm` it says 3.0.4 is still
> > > installed, but doing a `rpm --version` says I'm using v4.  It doesn't
> > > seem to matter if I throw `rpm --rebuilddb` in the mix at any time
> > > either...
> > > 
> > Hmm... maybe you should step back to 3.0.5 first and then
> > try to upgrade back to rpm v4. I've heard that RPM4 (at
> > least the initial RPM of it) would trash your rpm db, but
> > that upgrading to rpm 3.0.5 would solve that problem as it
> > was forward AND backward compatible.
> > 	John
> 
> Can I do this after I have installed 4.0 and installed several rpm packages
> with it? Will it trash my db? How can I tell? I installed 4.0 through Helix
> Code's updater, and didn't know anything about the db1 vs. db3 thing until
> later.
> 

Um, "trash my db" is just a wee bit unspecfic and, well, harsh. What's
actually happening is that there are two co-existent rpm databases because
rpm-4.0 was not installed correctly.

FWIW, the recommended way of upgrading to rpm-4.0 is
	a) Get the latest packages (there are 5 sub-packages, see below) from
		ftp://ftp.rpm.org/pub/rpm/test
	b) Install all of the rpm-4.0 packages together
		rpm -Uvh {rpm,popt}-*
	c) Immediately do
		rpm --rebuilddb
	   to convert the database format from db1 to db3.

Otherwise, here's what to do:

Look at /var/lib/rpm and look for the file that contains all the
installed headers. Specifically, the file is called
	Packages	for the db3 api used by rpm-4.0
	packages.rpm	for the db1 spi used by rpm-3.0.x and earlier.
The other files can (and will) be regenerated by doing rpm --rebuilddb,
so you can ignore them for now.

If you wish to use rpm-4.0, then packages.rpm should not be there.
If you wish to use rpm-3.0.x, then Packages should not be there.

If you have both packages.rpm and Packages, then you will need to convert
one of the two installed header files and eliminate the other. The
larger of the two files almost certainly contains the headers for
the packages installed on your system.

OK, if you've gotten this far, you have both Packages and packages.rpm
in /var/lib/rpm, and you wish to "fix".

Right now, "just in case", save a copy of all the files in your database
by doing (as root)
	cd /var/lib
	tar czvf rpmdb-save.tar.gz rpm

Presumably, if Packages exists, you have some version of rpm-4.0 installed.
If not, you will need to install rpm-4.0. In any case, get the latest
copy of rpm-4.0 from
	ftp://ftp.rpm.org/pub/rpm/test
Remember that there are 5 sub-packages of rpm
	rpm
	rpm-devel
	rpm-build
	rpm-python
	popt
At least rpm, rpm-build, and popt must be installed as part of the same
transaction set. That means that you should install in one command
	rpm -Uvh rpm-[0-9]* rpm-devel-* rpm-build-* rpm-python-* popt-*
not as a sequence of commands
	rpm -Uvh rpm-[0-9]-*
	rpm -Uvh rpm-devel-*
	...

Depending on what you wish to do, choose one of the following:

1) "I wish to use rpm-4.0 and packages.rpm is much larger than Packages."

	a) Sanity check: You have saved /var/lib/rpm "just in case" and
	   you have rpm-4.0 installed (i.e. check "rpm --version").

	b) Save the names from Packages (to be re-installed later):
		rpm -qa >& /tmp/reinstall-list

	c) Remove /var/lib/rpm/Packages by doing:
		rm /var/lib/rpm/Packages

	d) Rebuild the database (add -vv if you want to watch):
		rpm --rebuilddb
	   If you've modified rpm configuration files you may need
	   to force the issue by doing
		rpm --rebuilddb --dbapi 1 --rebuilddbapi 3

	e) Verify that the database contains what you have installed
	   on your system by doing
		rpm -qa | more
	   and checking
		/var/lib/rpm/Packages	(should be ~5-10 Mb)
	   	/var/lib/rpm/packages.rpm (should not exist)
	   If packages.rpm does exist but you are happy with the output
	   of the "rpm -qa" check, you should delete all of the db1
	   files by doing
		rm /var/lib/rpm/*.rpm

	f) Re-install the packages (if any) listed in /tmp/reinstall-list.

2) "I wish to use rpm-3.0.x and Packages is much larger than packages.rpm."

	a) Sanity check: You have saved /var/lib/rpm "just in case" and
	   you have rpm-4.0 installed (i.e. check "rpm --version").

	b) Save the names from packages.rpm (to be re-installed later):
		rpm -qa --dbapi 1 >& /tmp/reinstall-list

	c) Remove /var/lib/rpm/packages.rpm by doing:
		rm /var/lib/rpm/packages.rpm

	d) Rebuild the database (add -vv if you want to watch):
		rpm --rebuilddb --dbapi 3 --rebuilddbapi 1

	e) Verify that the database contains what you have installed
	   on your system by doing
		rpm -qa --dbapi 1 | more
	   and checking
		/var/lib/rpm/packages.rpm	(should be ~5-10 Mb)
	   	/var/lib/rpm/Packages		(should not exist)
	   If Packages does exist but you are happy with the output
	   of the "rpm -qa --dbapi 1" check, you should delete all of the db3
	   files (i.e. the ones that start with Capital letters and do not
	   have extension .rpm).

	f) Reinstall rpm-3.0.x (using rpm-4.0). I usually install all
	   the rpm-3.0.5 packages from the current directory by doing
		rpm -Uvh --dbapi 1 --oldpackage {rpm,popt}-*

	g) Go back and verify e) (you won't need "--dbapi 1" with rpm-3.0.5)

	h) Re-install the packages (if any) listed in /tmp/reinstall-list.

The other two cases should be relatively rare and are just variants of the
above:

3) "I wish to use rpm-4.0 and Packages is much larger than packages.rpm."
	Query contents of packages.rpm (using "--dbapi 1").
	Remove /var/lib/rpm/*.rpm.
	Reinstall the packages (if any).
4) "I wish to use rpm-3.0.x and packages.rpm is much larger than Packages."
	Query contents of Packages.
	Downgrade to rpm-3.0.x (using "--dbapi 1").
	Remove /var/lib/rpm/[A-Z]*.
	Reinstall the packages found by querying (if any).

73 de Jeff

-- 
Jeff Johnson	ARS N3NPQ
jbj@jbj.org	(jbj@redhat.com)
Chapel Hill, NC





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