On 5/27/21 11:10, Michael Ivanov wrote:


I have some strange problem with buildah when trying to execute a command in the container being built. I have approximately following procedure:

container=`buildah from scratch`
fs=$(buildah unshare buildah mount $container)
dnf="dnf --release 8 --installroot=$fs"

buildah unshare mkdir -p $fs/etc/yum.repos.d $fs/etc/pki/rpm-gpg
buildah unshare cp centos8-repos/*.repo $fs/etc/yum.repos.d
buildah unshare cp centos8-repos/RPM-GPG-KEY* $fs/etc/pki/rpm-gpg

buildah unshare $dnf install -y -q $instopts \
  redhat-release glibc-langpack-en glibc-langpack-de glibc-langpack-ru bash shadow-utils

buildah unshare ls -l $fs
buildah unshare rpm -qa --root $fs | sort

buildah run $container id
buildah run $container groupadd -g 1000 mygroup
buildah run $container useradd -u 1001 -g mygroup -s /bin/bash -m myuser
.  .  .  .  .
buildah unshare $dnf clean all -y
buildah unshare rm -rf $fs/var/cache/dnf

buildah unshare buildah umount $container

buildah config --label maintainer='. . . . . .' \
               --label description='. . . . . .' \
               --workingdir=/home/myuser \
               --cmd /bin/bash \
               --user myuser:mygroup $container

buildah commit $container base-cs8:$version

When I run this script in debian unstable (buildah 1.19.6), it completes successfully. But when I run same script on centos 8 with stock buildah (1.16.7), then all commands (id, groupadd and useradd) are reported as not found, even when I specify them using full names. Corresponding packages are reported to be present by rpm -qa above. Same behavior occurs when I install buildah from devel:kibic:libcontainers:stable.repo.

What do I do wrong on centos8?

Best regards,

 \   / |			           |
 (OvO) |  Михаил Иванов                    |
 (^^^) |                                   |
  \^/  |      E-mail:  ivans@isle.spb.ru   |
  ^ ^  |                                   |

Buildah mailing list -- buildah@lists.buildah.io
To unsubscribe send an email to buildah-leave@lists.buildah.io

Is this on a native system or running buildah within a container? This could definitely be an issue with fuse-overlay in rootless mode.

Could you update to Centos 8.4 and see if the problem goes away.