Sample Header Ad - 728x90

Errors during downloading metadata for repository 'epel'

5 votes
1 answer
12239 views
>**What specific syntax must be changed in the cloud-init startup script excerpt below in order to handle the error message shown below by retrying something else until it correctly works without throwing an error?** #### Command That triggers Error: The command in our startup script that seems to be triggering the error is: dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm #### Error Message: The error message seems to be: azure-arm: Errors during downloading metadata for repository 'epel': azure-arm: - Status code: 503 for https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir (IP: 123.45.678.901) azure-arm: - Status code: 503 for https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir (IP: 123.45.678.908) azure-arm: - Status code: 503 for https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir (IP: 98.765.43.21) azure-arm: Error: Failed to download metadata for repo 'epel': Cannot prepare internal mirrorlist: Status code: 503 for https://mirrors.fedoraproject.org/metalink?repo=epel-8&arch=x86_64&infra=$infra&content=$contentdir (IP: 86.753.09.11) #### The Context A RHEL 7 image is being built in azure by packer using a cloud-init startup script. Normally, the build works correctly. However, right now, the build is failing when the line given below throws the error given below due to some dependency problem. How would we need to re-write the lines around the line that is breaking in order for the install to complete without error? Our requirement is to do the dnf install directly from a specific rpm file as below, but what do we change to keep the process from failing in the rare occasions when the url given for the rpm is not responding correctly? The automation that includes the build takes a long time to run before it gets to the point where this error is thrown. Handling this error would thus eliminate a lot of wasted time by preventing the scenario of needing to re-run long automation processes. #### Results of @Haxiel's suggested code: We tried the code suggested by @Haxiel in an answer posted below, but we got the following error as a result. >**What specific syntax must be changed to resove this error to solve the original problem posted in this OP?** azure-arm: + for repourl in "https://fedora.cu.be/epel " "https://lon.mirror.rackspace.com/epel " "https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel " azure-arm: + curl --silent --fail --max-time 5 https://fedora.cu.be/epel azure-arm: + echo 'Repository reachable.' azure-arm: Repository reachable. azure-arm: + for repourl in "https://fedora.cu.be/epel " "https://lon.mirror.rackspace.com/epel " "https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel " azure-arm: + curl --silent --fail --max-time 5 https://lon.mirror.rackspace.com/epel azure-arm: + echo 'Repository reachable.' azure-arm: Repository reachable. azure-arm: + for repourl in "https://fedora.cu.be/epel " "https://lon.mirror.rackspace.com/epel " "https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel " azure-arm: + curl --silent --fail --max-time 5 https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel azure-arm: + echo 'Repository reachable.' azure-arm: Repository reachable. azure-arm: + sudo dnf --cacheonly -y install https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/epel-release-latest-8.noarch.rpm azure-arm: Last metadata expiration check: 0:11:50 ago on Mon 07 Feb 2022 05:36:46 PM UTC. azure-arm: epel-release-latest-8.noarch.rpm 37 kB/s | 23 kB 00:00 azure-arm: Dependencies resolved. azure-arm: ================================================================================ azure-arm: Package Architecture Version Repository Size azure-arm: ================================================================================ azure-arm: Installing: azure-arm: epel-release (B noarch 8-13.el8 @commandline 23 k azure-arm: azure-arm: Transaction Summary azure-arm: ================================================================================ azure-arm: Install 1 Package azure-arm: azure-arm: Total size: 23 k azure-arm: Installed size: 35 k azure-arm: Downloading Packages: azure-arm: Running transaction check azure-arm: Transaction check succeeded. azure-arm: Running transaction test azure-arm: Transaction test succeeded. azure-arm: Running transaction azure-arm: Preparing : 1/1 azure-arm: Installing : epel-release-8-13.el8.noarch 1/1 azure-arm: Running scriptlet: epel-release-8-13.el8.noarch 1/1 azure-arm: Verifying : epel-release-8-13.el8.noarch 1/1 azure-arm: Installed products updated. azure-arm: azure-arm: Installed: azure-arm: epel-release-8-13.el8.noarch azure-arm: azure-arm: Complete! azure-arm: + sed -i '/^metalink.*/d' /etc/yum.repos.d/epel-modular.repo /etc/yum.repos.d/epel-playground.repo /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing-modular.repo /etc/yum.repos.d/epel-testing.repo azure-arm: + sed -i 's|^#baseurl.*|baseurl=https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel|g ' /etc/yum.repos.d/epel-modular.repo /etc/yum.repos.d/epel-playground.repo /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel-testing-modular.repo /etc/yum.repos.d/epel-testing.repo azure-arm: + dnf install -y telnet azure-arm: Extra Packages for Enterprise Linux 8 - x86_64 205 B/s | 196 B 00:00 azure-arm: Errors during downloading metadata for repository 'epel': azure-arm: - Status code: 404 for https://ftp.yz.yamagata-u.ac.jp/pub/linux/fedora-projects/epel/repodata/repomd.xml (IP: 123.45.678.90) azure-arm: Error: Failed to download metadata for repo 'epel': Cannot download repomd.xml: Cannot download repodata/repomd.xml: All mirrors were tried
Asked by CodeMed (5357 rep)
Feb 5, 2022, 02:52 AM
Last activity: Feb 8, 2022, 04:24 AM