From 59955cf6cf96b9b71b0f1f1dc439ddbf28b7f3ab Mon Sep 17 00:00:00 2001 From: Julien Thomas Date: Sun, 18 Jun 2023 00:35:10 +0200 Subject: [PATCH] BUILD: Fix yum taking for ages on el6 and el7 Force ulimit nofile 1024 when building the base rpmbuild el6/el7 images and when running the container to build the RPM. Yum might take for ages to complete because it CLOEXEC on all available file descriptors and recent dockers sets a very high default limit. References: https://stackoverflow.com/questions/74345206/centos-7-docker-yum-installation-gets-stuck https://bugzilla.redhat.com/show_bug.cgi?id=1537564 https://github.com/rpm-software-management/rpm/pull/444 --- rpmbuild-docker | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/rpmbuild-docker b/rpmbuild-docker index 1c02e3e..11cb65d 100755 --- a/rpmbuild-docker +++ b/rpmbuild-docker @@ -155,10 +155,16 @@ echo "OUTPUTDIR: $OUTPUTDIR" echo "PREBUILDSCRIPT: ${PREBUILDSCRIPT:-none}" echo "REPO: ${REPO:-none}" +# Yum might take for ages to complete because it CLOEXEC on all available +# file descriptors and recent dockers sets a very high default limit. +# https://bugzilla.redhat.com/show_bug.cgi?id=1537564 +# https://github.com/rpm-software-management/rpm/pull/444 +DOCKER_OPTS_DIST_el6=( --ulimit 'nofile=1024' ) function dockerfile_for_dist_el6() { cat <<'EOF' FROM centos:6 RUN set -x && \ + ulimit -n 1024 && \ sed -i -re 's,mirror\.centos\.org,vault.centos.org,; s,^(mirrorlist),#\1,; s,^#(baseurl),\1,' /etc/yum.repos.d/CentOS-*.repo && \ yum update -y && \ yum install -y createrepo gcc make rpm-build && \ @@ -182,10 +188,16 @@ RUN set -x && \ EOF } +# Yum might take for ages to complete because it CLOEXEC on all available +# file descriptors and recent dockers sets a very high default limit. +# https://bugzilla.redhat.com/show_bug.cgi?id=1537564 +# https://github.com/rpm-software-management/rpm/pull/444 +DOCKER_OPTS_DIST_el7=( --ulimit 'nofile=1024' ) function dockerfile_for_dist_el7() { cat <<'EOF' FROM centos:7 RUN set -x && \ + ulimit -n 1024 && \ yum update -y && \ yum install -y createrepo gcc make rpm-build && \ echo '* - nproc 2048' >> /etc/security/limits.d/90-nproc.conf && \