yum makecache fails in prebuild in Elastic Beanstalk

1

Hello, I think I found a bug with the most recent version of Elastic Beanstalk for Ruby 2.7 running on 64bit Amazon Linux 2/3.4.7

When I attempt to update to 3.4.7 the command yum makecache fails in prebuild because the download checksums don't match. When I revert to 3.4.6 everything works fine. Since my code works on 3.4.6, and because I didn't see any changes in the release notes for 3.4.7 that would make me think my config had broken, I thought this might be a problem with the release. I wasn't sure where to file a bug report, so I thought I'd post this here in case anybody else runs into this problem.

cfn-init.log

2022-06-10 00:55:50,430 [INFO] Running config prebuild_0_company_app_staging
2022-06-10 00:55:52,335 [ERROR] Yum makecache failed. Output: Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Not using downloaded amzn2-core/repomd.xml because it is older than what we have:
  Current   : Mon May 23 17:22:40 2022
  Downloaded: Thu May  5 02:54:28 2022
https://amazonlinux-2-repos-us-west-2.s3.dualstack.us-west-2.amazonaws.com/2/core/2.0/x86_64/6b0225ccc542f3834c95733dcf321ab9f1e77e6ca6817469771a8af7c49efe6c/repodata/other.sqlite.gz?instance_id=i-00ca3876aeb3b0e00&region=us-west-2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
https://amazonlinux-2-repos-us-west-2.s3.dualstack.us-west-2.amazonaws.com/2/core/2.0/x86_64/6b0225ccc542f3834c95733dcf321ab9f1e77e6ca6817469771a8af7c49efe6c/repodata/filelists.sqlite.gz?instance_id=i-00ca3876aeb3b0e00&region=us-west-2: [Errno -1] Metadata file does not match checksum
Trying other mirror.
https://amazonlinux-2-repos-us-west-2.s3.dualstack.us-west-2.amazonaws.com/2/core/2.0/x86_64/6b0225ccc542f3834c95733dcf321ab9f1e77e6ca6817469771a8af7c49efe6c/repodata/filelists.sqlite.gz?instance_id=i-00ca3876aeb3b0e00&region=us-west-2: [Errno -1] Metadata file does not match checksum
Trying other mirror.


 One of the configured repositories failed (Amazon Linux 2 core repository),
 and yum doesn't have enough cached data to continue. At this point the only
 safe thing yum can do is fail. There are a few ways to work "fix" this:

     1. Contact the upstream for the repository and get them to fix the problem.

     2. Reconfigure the baseurl/etc. for the repository, to point to a working
        upstream. This is most often useful if you are using a newer
        distribution release than is supported by the repository (and the
        packages for the previous distribution release still work).

     3. Run the command with the repository temporarily disabled
            yum --disablerepo=amzn2-core ...

     4. Disable the repository permanently, so yum won't use it by default. Yum
        will then just ignore the repository until you permanently enable it
        again or use --enablerepo for temporary usage:

            yum-config-manager --disable amzn2-core
        or
            subscription-manager repos --disable=amzn2-core

     5. Configure the failing repository to be skipped, if it is unavailable.
        Note that yum will try to contact the repo. when it runs most commands,
        so will have to try and fail each time (and thus. yum will be be much
        slower). If it is a very temporary problem though, this is often a nice
        compromise:

            yum-config-manager --save --setopt=amzn2-core.skip_if_unavailable=true

failure: repodata/filelists.sqlite.gz from amzn2-core: [Errno 256] No more mirrors to try.
https://amazonlinux-2-repos-us-west-2.s3.dualstack.us-west-2.amazonaws.com/2/core/2.0/x86_64/6b0225ccc542f3834c95733dcf321ab9f1e77e6ca6817469771a8af7c49efe6c/repodata/filelists.sqlite.gz?instance_id=i-00ca3876aeb3b0e00&region=us-west-2: [Errno -1] Metadata file does not match checksum

2022-06-10 00:55:52,336 [ERROR] Error encountered during build of prebuild_0_company_app_staging: Could not create yum cache (return code 1)
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 241, in build
    self._auth_config)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/rpm_tools.py", line 53, in apply
    raise ToolError("Could not create yum cache", cache_result.returncode)
cfnbootstrap.construction_errors.ToolError: Could not create yum cache (return code 1)
2022-06-10 00:55:52,336 [ERROR] -----------------------BUILD FAILED!------------------------
2022-06-10 00:55:52,336 [ERROR] Unhandled exception during build: Could not create yum cache (return code 1)
Traceback (most recent call last):
  File "/opt/aws/bin/cfn-init", line 176, in <module>
    worklog.build(metadata, configSets)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 137, in build
    Contractor(metadata).build(configSets, self)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 564, in build
    self.run_config(config, worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 241, in build
    self._auth_config)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/rpm_tools.py", line 53, in apply
    raise ToolError("Could not create yum cache", cache_result.returncode)
cfnbootstrap.construction_errors.ToolError: Could not create yum cache (return code 1)
  • I've experienced the same problem. I can deploy and run successfully on Ruby 2.7 running on 64bit Amazon Linux 2/3.3.4, but when I try to update or deploy on 3.4.7 it fails with this same error.

asked 2 years ago1011 views
2 Answers
0

I solved that by:

  1. Inspecting repos before the error fires in this folder: /etc/yum.repos.d/

  2. For me, there was a custom yum repo added which caused the problem. I performed following to remove the repo after operations with it are done:

05_node_repo_remove:
        cwd: /etc/yum.repos.d/
        command: 'sudo rm -f nodesource-el7.repo && yum makecache'
answered 9 months ago
-2

Hi

I understand you attempting an update to 3.4.7 but the command yum makecache fails. Based on the output you have provided I see there are resolution steps provided when this issue is encountered. I advised you follow the resolution steps to try fix the issue [1]. In addition Elastic Beanstalk locks package repositories to a specific version for each of our platform versions, so yum metadata may be more likely to become stale as Amazon Linux releases package updates after the platform version has been created. Try Running yum clean metadata first, or possibly some other commands to clean yum caches such as yum clean all and rm -rf /var/cache/yum/* [2].

[1] 1. Contact the upstream for the repository and get them to fix the problem.

 2. Reconfigure the baseurl/etc. for the repository, to point to a working
    upstream. This is most often useful if you are using a newer
    distribution release than is supported by the repository (and the
    packages for the previous distribution release still work).

 3. Run the command with the repository temporarily disabled
        yum --disablerepo=amzn2-core ...

 4. Disable the repository permanently, so yum won't use it by default. Yum
    will then just ignore the repository until you permanently enable it
    again or use --enablerepo for temporary usage:

        yum-config-manager --disable amzn2-core
    or
        subscription-manager repos --disable=amzn2-core

 5. Configure the failing repository to be skipped, if it is unavailable.
    Note that yum will try to contact the repo. when it runs most commands,
    so will have to try and fail each time (and thus. yum will be be much
    slower). If it is a very temporary problem though, this is often a nice
    compromise:

        yum-config-manager --save --setopt=amzn2-core.skip_if_unavailable=true

[2]Third Party https://www.thegeekdiary.com/metadata-file-does-not-match-checksum-issue-when-yum-installs-or-updates-package/

Lwazi
answered 2 years ago
  • The command yum makecache is something that Elastic beanstalk is running on it's own. I do deployments with Terraform, so the issue isn't whether or not this can be fixed on an individual basis, but if the fix can replicated in an automated way over and over again. My servers are working fine for right now. I was just trying to alert someone that the automated process for provisioning EC2 instances and deploying ruby might have an issue.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions