Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon 2022 images fail to build due to conflict between curl packages #396

Open
olhado opened this issue Aug 22, 2022 · 6 comments
Open

Comments

@olhado
Copy link

olhado commented Aug 22, 2022

🗣️ Foreword

Thank for taking the time to fill this bug report fully. Without it we may not be able to fix the bug, and the issue may be closed without resolution.

👻 Brief Description

When running tests against the official amazonlinux:2022 image, the tests fail during the initial construction of the test image due to a conflict between curl being installed when curl-minimal is already baked into the official image.

Version

  • test-kitchen: 3.3.2
  • kitchen-docker: 2.13.0
  • kitchen-ansible: 0.56.0

Environment

ARM Mac, Docker Desktop 4.11.1

Scenario

Trying to run serverspec tests for my ansible role against Amazon Linux images.

Steps to Reproduce

  1. Set up test suite with docker as driver and transport.
  2. Create a basic test
  3. Run DOCKER_BUILDKIT=1 bundle exec kitchen create <test-suite>
  4. See error

Expected Result

Amazon 2022 images should be provisioned.

Actual Result

       #7 [ 3/19] RUN yum install -y sudo openssh-server openssh-clients which curl
       #7 sha256:[REDACTED]
       #7 2.699 Amazon Linux 2022 repository                    4.0 MB/s | 9.7 MB     00:02
       #7 3.891 Last metadata expiration check: 0:00:01 ago on Mon Aug 22 00:25:12 2022.
       #7 4.062 (try to add '--allowerasing' to command line to replace conflicting packages or '--skip-broken' to skip uninstallable packages)
       #7 4.062 Error:
       #7 4.062  Problem: problem with installed package curl-minimal-7.83.1-1.amzn2022.aarch64
       #7 4.062   - package curl-minimal-7.83.1-1.amzn2022.aarch64 conflicts with curl provided by curl-7.83.1-1.amzn2022.aarch64
       #7 4.062   - conflicting requests
       #7 ERROR: executor failed running [/bin/sh -c yum install -y sudo openssh-server openssh-clients which curl]: exit code: 1
@RulerOf
Copy link
Contributor

RulerOf commented Aug 25, 2022

I believe that this is caused by this code. This issue will require a patch to fix.

We ran into this a few months back with Centos Stream, and added it as a new type of platform. It's a bit hacky, but you may be able to override the platform detection with platform: centosstream added to your driver config and get a working result.

@olhado
Copy link
Author

olhado commented Aug 25, 2022

I can probably send in a patch, but I don't want to perpetuate the hack. Is there a way you'd like to see it done?

@olhado
Copy link
Author

olhado commented Aug 25, 2022

So the platform hack worked, but I get an error that a temp .sh file is not in the image (I confirmed this was correct by hoping in the running container). Related to the hack?

I, [2022-08-25T11:25:16.427242 #26582]  INFO -- sandbox-amazonlinux-2022: -----> Cleaning up any prior instances of <sandbox-amazonlinux-2022>
I, [2022-08-25T11:25:16.427314 #26582]  INFO -- sandbox-amazonlinux-2022: -----> Destroying <sandbox-amazonlinux-2022>...
I, [2022-08-25T11:25:16.427882 #26582]  INFO -- sandbox-amazonlinux-2022: Finished destroying <sandbox-amazonlinux-2022> (0m0.00s).
I, [2022-08-25T11:25:16.428100 #26582]  INFO -- sandbox-amazonlinux-2022: -----> Testing <sandbox-amazonlinux-2022>
I, [2022-08-25T11:25:16.428160 #26582]  INFO -- sandbox-amazonlinux-2022: -----> Creating <sandbox-amazonlinux-2022>...
I, [2022-08-25T11:26:30.568709 #26582]  INFO -- sandbox-amazonlinux-2022: Finished creating <sandbox-amazonlinux-2022> (1m14.14s).
I, [2022-08-25T11:26:30.568831 #26582]  INFO -- sandbox-amazonlinux-2022: -----> Converging <sandbox-amazonlinux-2022>...
I, [2022-08-25T11:26:30.623290 #26582]  INFO -- sandbox-amazonlinux-2022: Preparing files for transfer
I, [2022-08-25T11:26:30.623381 #26582]  INFO -- sandbox-amazonlinux-2022: Preparing dna.json
I, [2022-08-25T11:26:30.624081 #26582]  INFO -- sandbox-amazonlinux-2022: Resolving cookbook dependencies with Berkshelf 6.3.4...
I, [2022-08-25T11:26:32.059676 #26582]  INFO -- sandbox-amazonlinux-2022: Removing non-cookbook files before transfer
I, [2022-08-25T11:26:32.096492 #26582]  INFO -- sandbox-amazonlinux-2022: Preparing data_bags
I, [2022-08-25T11:26:32.097471 #26582]  INFO -- sandbox-amazonlinux-2022: Preparing secret
I, [2022-08-25T11:26:32.097686 #26582]  INFO -- sandbox-amazonlinux-2022: Preparing validation.pem
I, [2022-08-25T11:26:32.098189 #26582]  INFO -- sandbox-amazonlinux-2022: Preparing client.rb
E, [2022-08-25T11:26:32.507532 #26582] ERROR -- sandbox-amazonlinux-2022: Converge failed on instance <sandbox-amazonlinux-2022>.
E, [2022-08-25T11:26:32.507629 #26582] ERROR -- sandbox-amazonlinux-2022: ------Exception-------
E, [2022-08-25T11:26:32.507640 #26582] ERROR -- sandbox-amazonlinux-2022: Class: Kitchen::ActionFailed
E, [2022-08-25T11:26:32.507648 #26582] ERROR -- sandbox-amazonlinux-2022: Message: Docker failed to execute command on container. Error Details: Failed to execute command on Linux container. Failed to execute command on Docker container. Expected process to exit with [0], but received '127'
---- Begin output of docker -H unix:///var/run/docker.sock exec -u kitchen [REDACTED] /bin/bash /tmp/docker-[REDACTED].sh ----
STDOUT: 
STDERR: /bin/bash: /tmp/docker-[REDACTED].sh: No such file or directory
---- End output of docker -H unix:///var/run/docker.sock exec -u kitchen [REDACTED] /bin/bash /tmp/

@RulerOf
Copy link
Contributor

RulerOf commented Aug 26, 2022

I can probably send in a patch, but I don't want to perpetuate the hack. Is there a way you'd like to see it done?

I've got a couple ideas, but my gut says that the least amount of code involves embedding a little bit of shell script logic into the rhel_platform block to smooth out the differences here. I don't think it'll resolve your issue though!

So the platform hack worked, but I get an error that a temp .sh file is not in the image

Are you experiencing #387? If so, the best workaround for that is to use SSH as your transport.

@olhado
Copy link
Author

olhado commented Aug 26, 2022

So the platform hack worked, but I get an error that a temp .sh file is not in the image

Are you experiencing #387? If so, the best workaround for that is to use SSH as your transport.

Probably? But it only seems to affect Amazon 2022, weirdly enough. I've tested across a slew of other distributions (Debian, Ubuntu, CentOS, even Amazon Linux 2) and everything runs. Anyway, will switch transports.

EDIT: Running with ssh just leaves kitchen hanging waiting for the SSH service on the container.

@RulerOf
Copy link
Contributor

RulerOf commented Aug 26, 2022

Any chance you're using x86_64 on M1 and experiencing docker/for-mac#6273?

Edit: I suspect it's actually the same cause as #395

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants