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

Re: please help - i cant get rpm 4.0 to use my old database



On Mon, 25 Sep 2000, you wrote:
> i'd be really grateful if anyone could tell me what i have done wrong.
> 
> i was using rpm version 3.0.4.
> 
> i upgraded to 4.0 with:
> 
> # rpm -U rpm-4.0-6x.i386.rpm
> # cd /var/lib/rpm
> # rpm --updatedb
> 
> but anything i try and do with rpm says:
> 
> 	cannot open Name index using db3 - No such file or directory (2)
> 	
> 	--> The rpm database cannot be opened in db3 format.
> 	    If you have just upgraded the rpm package you need to convert
> 	    your database to db3 format by running "rpm --rebuilddb" as root.
> 
> but i already did that, several times.
> 
> luckily i managed to do:
> 
> # rpm --force --nodeps -i rpm-3.0.4-0.48.i386.rpm
> 
> to get the old rpm working.
> 
> i ugraded again to the 4.0, and updated the database. this time there are
> no error messages, but the only package that rpm knows exists is itself.
> 
> can anyone help?
> 
> thanks,
> 
> ben

Below are Jeff Johnson's instructions for upgrading to 4.0 and for fixing an
improper upgrade. 
 Does anyone have a website they could post these on? This question seems to
come up about once a week. 

--Gary


JJ's  instructions:

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] []