Re: _rpm.error: rpmdb open failed

"Fajar A. Nugraha" <[email protected]> Sat, 6 Jul 2013 04:50:35 +0700
Newsgroups gmane.linux.rpm.yum
Message-ID <CAG1y0scSbU3_NEYWkg0x2o-BgJyrpjGzx5Hg17Woci-2FTc50A@mail.gmail.com>
On Sat, Jul 6, 2013 at 2:27 AM, Russell Jones <[email protected]> wrote:

> This is installing into a separate install root (via --installroot), not
> the base system itself. This is then later used to create diskless PXE boot
> images for booting client systems.
>
> This works fine on CentOS 6.3, but as you can see generates that error on
> CentOS 6.4. Trying to get the node used to create these images up to CentOS
> 6.4 if I can.
>
>
Short version: Don't.

Long version:
There are enough differences in Berkeley db versions used in RHEL/Centos
5.x and 6.x in that even if your comand succeeded, you will NOT be able to
correctly run rpm/yum from INSIDE the newly-created 5.x images.

There's a workaround though:
- run your command once, or create a simple 5.x image which only contains
yum
- chroot inside that image (even if you have the error you mentioned), and
re-run the command to create a second 5.x image. This time it's run using
5.x's version of yum and bdb, so you should not get the error.
- move the second image outside of the first one
- delete the first one

An example of how that's done is on
https://github.com/fajarnugraha/lxc/blob/centos-template/templates/lxc-centos.in
(search
"download_centos"). It does "yum --installroot install", then check two
things:
- is rpmdb located under $HOME (as is the case when run under
debian/ubuntu). If yes, then move it to /var/lib/rpm (the correct place for
RHEL/Centos)
- does rpm command works inside the new image (checked with rpm -q yum). If
not, then re-run the "yum install" command from inside the image

The template was tested to create Centos 5 and 6 images on latest Ubuntu
(which should have similar rpm/yum/bdb version as centos 6.x), and can
create good centos 5.x and 6.x images.

-- 
Fajar

_______________________________________________
Yum mailing list
[email protected]
http://lists.baseurl.org/mailman/listinfo/yum