View Issue Details

IDProjectCategoryView StatusLast Update
0014795CentOS-7centos-releasepublic2018-05-18 00:28
Reportercsw 
PrioritynormalSeverityminorReproducibilityalways
Status assignedResolutionopen 
Product Version7.5.1804 
Target VersionFixed in Version 
Summary0014795: /etc/yum/vars/contentdir contains altarch instead of centos after initial installation of centos-release
DescriptionIn order to create an centos 7.5 image we are creating a chroot and install centos there.

mkdir -p ${CHROOT}/var/lib/rpm
rpm --rebuilddb --root="${PWD}/${CHROOT}"
yum --installroot="${PWD}/${CHROOT}" install -y centos-release

Expectation:
/etc/yum/vars/contentdir == "centos"
Result:
/etc/yum/vars/contentdir == "altarch"

yum --installroot="${PWD}/${CHROOT}" reinstall -y centos-release
generates the correct content.
TagsNo tags attached.
abrt_hash
URL

Activities

stippeng

stippeng

2018-05-16 09:03

reporter   ~0031839

This can be reproduced by installing CentOS 7.5 from the ISO as well. Basically, to reproduce:
- Install CentOS 7.5 from Everything ISO on X86_64 (minimal install is fine)

Then in the installed CentOS:
# cat /etc/yum/vars/contentdir
altarch

[root@localhost ~]# cat /var/log/anaconda/packaging.log |grep "No such" -B 2
17:43:11,797 INFO packaging: centos-release-7-5.1804.el7.centos.x86_64 (43/301)
17:43:11,797 INFO packaging: /var/tmp/rpm-tmp.tjkL6c: line 1: /usr/bin/uname: No such file or directory

So the issue seems to appear due to the spec file of the centos-release package's %post trying to run /usr/bin/uname when it does not exist:
%post
/usr/bin/uname -m | grep -q 'x86_64' && echo 'centos' >/etc/yum/vars/contentdir || echo 'altarch' > /etc/yum/vars/contentdir
avij

avij

2018-05-16 11:52

manager   ~0031842

The coreutils and grep dependencies should probably be specified as Requires(post) to get them installed before the %post script gets executed. Those packages are already specified as requirements, but plain Requires: does not guarantee that the packages are available at %post stage.
JohnnyHughes

JohnnyHughes

2018-05-17 16:42

administrator   ~0031864

Requires(post) did not work, centos-release is required to install coreutils (which provides uname). That means coretutils will always install after centos-release.

If we shift the script to run in %posttrans instead of %post, it fixes the issue.

Fixed in version: centos-release-7-5.1804.el7.centos.2.x86_64.rpm
avij

avij

2018-05-17 18:24

manager   ~0031866

Some testing..

# mkdir -p /tmp/chroot/var/lib/rpm
# rpm --rebuilddb --root /tmp/chroot
# yum --installroot=/tmp/chroot --releasever=7 install centos-release-7-5.1804.el7.centos.2.x86_64.rpm
[installs centos-release and its 40 deps]
# cat /tmp/chroot/etc/yum/vars/contentdir
centos

Issue History

Date Modified Username Field Change
2018-05-14 14:20 csw New Issue
2018-05-16 09:03 stippeng Note Added: 0031839
2018-05-16 11:52 avij Note Added: 0031842
2018-05-17 16:42 JohnnyHughes Note Added: 0031864
2018-05-17 18:24 avij Note Added: 0031866
2018-05-18 00:28 toracat Status new => assigned