From 6ffde2e5964acb9183616a7c2ab67a10d4712c3e Mon Sep 17 00:00:00 2001 From: Ian Wienand Date: Tue, 18 Jul 2017 14:51:18 +1000 Subject: [PATCH] yum-minimal: pre-install coreutils As described in the referenced bug, the dependency solver in yum doesn't handle weak dependencies well and in some cases, such as Fedora 26, can end up choosing coreutils-single (the busybox-esque single binary) instead of actual coreutils, which then causes problems with conflicting packages later. Change-Id: I2907bf3b74c146986b483d52cc6ac437036330b4 --- .../elements/yum-minimal/root.d/08-yum-chroot | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot index 5289eae39..0e5291e56 100755 --- a/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot +++ b/diskimage_builder/elements/yum-minimal/root.d/08-yum-chroot @@ -157,7 +157,8 @@ function _install_pkg_manager { flock -w 1200 9 || die "Can not lock .rpmmacros" echo "%_dbpath /var/lib/rpm" >> $HOME/.rpmmacros - _lang_pack="" + local _lang_pack="" + local _extra_pkgs="" if [ $DISTRO_NAME = "fedora" -a $DIB_RELEASE -le 23 ]; then # _install_langs is a rpm macro that limits the translation @@ -184,13 +185,21 @@ function _install_pkg_manager { _lang_pack="glibc-minimal-langpack glibc-langpack-en" fi + # Yum has some issues choosing weak dependencies. It can end + # up choosing "coreutils-single" instead of "coreutils" which + # causes problems later when a package actually requires + # coreutils. For more info see + # https://bugzilla.redhat.com/show_bug.cgi?id=1286445 + # Really all we can do is pre-install the right thing + _extra_pkgs+="coreutils " + sudo -E yum -y \ --disableexcludes=all \ --setopt=cachedir=$YUM_CACHE/$ARCH/$DIB_RELEASE \ --setopt=reposdir=$TARGET_ROOT/etc/yum.repos.d \ --releasever=$DIB_RELEASE \ --installroot $TARGET_ROOT \ - install $@ ${_lang_pack} && rc=$? || rc=$? + install $@ ${_lang_pack} ${_extra_pkgs} && rc=$? || rc=$? # We modified the base system - make sure we clean up always! rm $HOME/.rpmmacros.dib.lock