Your message dated Fri, 28 Aug 2015 08:29:26 +0200
with message-id <[email protected]>
and subject line Re: Bug#797060: yum: Yum does not update RPM database in 
installroot
has caused the Debian Bug report #797060,
regarding yum: Yum does not update RPM database in installroot
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
797060: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=797060
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: yum
Version: 3.4.3-3
Severity: normal

Dear Maintainer,

After a Yum-based bootstrap, the RPM database remains empty, and thus
causes problems for rpm and Yum itself:

* RPM thinks that zero packages are installed. It will happily
  install packages that are already installed by Yum.

* Yum fails to expand the $releasever variable in /etc/yum.repos.d/;
  it tries to determine the value by querying the RPM database for the
  version of the "centos-release" package. RPM thinks the database is
  empty, and thus Yum fails to expand the variable.

I'm trying to bootstrap Centos in a directory, for later use in
squashfs. Steps to reproduce:

rootdir="/var/tmp/centos7"
apt-get install rpm yum
mkdir "$rootdir"
rpm --nodeps --root "$rootdir" -i 
http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-1.1503.el7.centos.2.8.x86_64.rpm
sed -i "s,gpgkey=file:///etc/,gpgkey=file://${rootdir}/etc/,g" 
"$rootdir"/etc/yum.repos.d/*.repo
yum --assumeyes --installroot "$rootdir" groupinstall core
mount -t proc proc "$rootdir"/proc
chroot "$rootdir" rpm -qa

The final "rpm -qa" command returns no output.

Initializing the RPM database using "rpmdb --root=$rootdir --initdb"
has no effect on the outcome. I have tried, before the first RPM
command to install centos-release, to initialize the database in
$rootdir/var/lib/rpm and $rootdir/root/.rpmdb, but to no avail.

How is Yum supposed to synchronize with the RPM database during an
installroot bootstrap?

--- End Message ---
--- Begin Message ---
On 08/28/2015 02:43 AM, Mike Miller wrote:
Please compare

   rpm --root "$rootdir" rpm -qa

The output is a single line showing the installed rpm package, which
threw me off at first, but removing the (potentially accidental?)
"rpm" filter will list all packages installed by the Yum bootstrap:

  rpm --root "$rootdir" -qa

Therefore your chroot's RPM database is in $rootdir/root/.rpmdb
instead of the CentOS native default of /var/lib/rpm.

This is spot on.

The best way is to ensure you use a consistent RPM database path
between host and chroot. The Debian default is fine for casual users
of RPM, but for your use case you may want to (re)set %_dbpath to
/var/lib/rpm. E.g.

   mkdir -p /etc/rpm
   echo %_dbpath /var/lib/rpm > /etc/rpm/macros.dbpath
   rpm --initdb

I also experimented with defining the %_dbpath macro within the rpm
command (using the -D argument), but it only had an effect on the
initial install of the centos-release package; no effect on how Yum
interfaced with the RPM database afterwards.

Augmenting the original steps with your %_dbpath suggestion, leads to
the following list of commands that successfully bootstrap a Centos
system and makes Yum and RPM agree on the database path and contents:

rootdir="/var/tmp/centos7"
mkdir "$rootdir"
mkdir -p /etc/rpm
echo "%_dbpath /var/lib/rpm" > /etc/rpm/macros.dbpath
rpm --nodeps --root "$rootdir" -i http://mirror.centos.org/centos/7/os/x86_64/Packages/centos-release-7-1.1503.el7.centos.2.8.x86_64.rpm sed -i "s,gpgkey=file:///etc/,gpgkey=file://${rootdir}/etc/,g" "$rootdir"/etc/yum.repos.d/*.repo
yum --assumeyes --installroot "$rootdir" groupinstall core

Thanks a lot for your suggestion!

Sven

--- End Message ---

Reply via email to