From 349e8db2f79f376d2073124b033081973cd3788b Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Thu, 11 Feb 2016 15:42:10 +1100 Subject: [PATCH] yum-minimal: pre-install base packages We were getting some subtle issues in fedora-minimal builds that turned out to be because /var/run was not a symlink to /run. Upon further investigation, it turns out that yum is creating a /var/run directory for it's pid file when it starts working in the empty chroot (which I verified by stracing it) --- 5905 stat("/home/ubuntu/tmp/dib-tmp/image.Ac4VZZsl/mnt/var/run", 0x7ffddffa0330) = -1 ENOENT (No such file or directory) 5905 mkdir("/home/ubuntu/tmp/dib-tmp/image.Ac4VZZsl/mnt/var/run", 0755) = 0 5905 open("/home/ubuntu/tmp/dib-tmp/image.Ac4VZZsl/mnt/var/run/yum.pid", O_WRONLY|O_CREAT|O_EXCL, 0644) = 6 --- Because this happens *before* we install "filesystem" (the package), we mess up it's symlinking. To work-around this, pre-install the trio of base packages (setup, basesystem, filesystem) with rpm from outside the chroot. Change-Id: I411b6ec9d91d95d3a0f98e76853086af3b70abe8 --- elements/yum-minimal/root.d/08-yum-chroot | 36 ++++++++++++++++------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/elements/yum-minimal/root.d/08-yum-chroot b/elements/yum-minimal/root.d/08-yum-chroot index 10f76c318..8ac2d1065 100755 --- a/elements/yum-minimal/root.d/08-yum-chroot +++ b/elements/yum-minimal/root.d/08-yum-chroot @@ -52,21 +52,35 @@ _RPM="rpm --dbpath=/var/lib/rpm" # note this runs outside the chroot, where we're assuming the platform # has yum/yumdownloader function _install_repos { + local packages + + # pre-install the base system packages via rpm. We previously + # just left it up to yum to drag these in when we "yum install + # yum" in the chroot in _install_pkg_manager. This raised a small + # problem that inside the empty chroot yum went ahead and did a + # mkdir for /var/run to put some pid file in, which then messed up + # the "filesystem" package making /var/run a symlink to /run + # ... which leads to odd issues with a running system. + # + # TODO: these packages still have some small %posttrans stuff that + # depends on other packages (see rhbz#1306489) ... maybe the idea + # is that they are only installed in one big transaction with the + # rest of the system? but we don't want to use yum to do this + # (see above) so ... + packages="basesystem filesystem setup " + + packages+="${DISTRO_NAME}-release " + # after fedora21, this is split into into a separate -repos + # package + if [ $DISTRO_NAME = fedora ]; then + packages+="${DISTRO_NAME}-repos " + fi + yumdownloader \ --releasever=$DIB_RELEASE \ --setopt=reposdir=$TMP_HOOKS_PATH/yum.repos.d \ --destdir=$WORKING \ - ${DISTRO_NAME}-release - - # after fedora21, this is split into into a separate -repos - # package - if [ $DISTRO_NAME = fedora ] ; then - yumdownloader \ - --releasever=$DIB_RELEASE \ - --setopt=reposdir=$TMP_HOOKS_PATH/yum.repos.d \ - --destdir=$WORKING \ - ${DISTRO_NAME}-repos - fi + ${packages} # --nodeps works around these wanting /bin/sh in some fedora # releases, see rhbz#1265873