3f3850aa0f
On Debian/Ubuntu installs of RPM, /usr/lib/rpm/macros sets %_dbpath %(echo $HOME/.rpmdb) which makes quite a bit of sense, because RPM is not the system packager and thus RPM is setup to install things into a hierarchy in the users homedir. However, this messes things up when building a Fedora chroot on an Ubuntu platform. We use RPM & yum from the base-system to bootstrap the Fedora chroot. While both obey --root flags, they still pick up the %_dbpath macro and so end up creating the RPM database in <chroot>/home/user/.rpmdb After we have bootstrapped yum/dnf, we execute further installation commands from inside the chroot -- where we now have the Fedora version of /usr/lib/rpm/macros and hence have _dbpath set to /var/lib/rpm -- except there is no rpm database there. Should anyone be finding this in the future, the actual issue that appears is $ sudo chroot /opt/dib_tmp/image.b6B5S3f6/mnt dnf makecache Error: Failed to synchronize cache for repo 'fedora' from \ 'https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=x86_64': \ Cannot prepare internal mirrorlist: file "repomd.xml" was not found in metalink Note the issue there is that $releasever is not expanded, because the rpmdb where this info is kept is not populated. The trick is to make sure we override this value when using the host rpm/yum to setup the chroot. The bare rpm calls, which we use to install the repos, have a --dbpath argument where we can override this. yum does not however, so we override this in the global ~/.rpmmacros while we are installing the packaging tools and dependencies into the chroot. Copious comments are included, because this is super-confusing. Change-Id: I20801150ea02d1c64f118eb969fb2aec473476f7 |
||
---|---|---|
.. | ||
install.d | ||
pre-install.d | ||
root.d | ||
element-deps | ||
package-installs.yaml | ||
pkg-map | ||
README.rst |
=========== yum-minimal =========== Base element for creating minimal yum-based images. This element is incomplete by itself, you'll want to use the centos-minimal or fedora-minimal elements to get an actual base image. Use of this element will require 'yum' and 'yum-utils' to be installed on Ubuntu and Debian. Nothing additional is needed on Fedora or CentOS. The `DIB_OFFLINE` or more specific `DIB_YUMCHROOT_USE_CACHE` variables can be set to prefer the use of a pre-cached root filesystem tarball.