ERROR: unable to select packages

Spread the love

ERROR: unable to select packages: aws-cli (no such package):required by: world[aws-cli]

My gitlab pipeline recently failed with the error “aws-cli package not found.” I was installing the aws-cli package into my pipeline using Docker version 26, but I was unable to install it because of the Alpine package. I will walk you through how I fixed this problem in my giltab pipeline in this post, but keep in mind that this is just a short-term workaround.

Installing aws-cli via apk directly may fail in Docker images built on Alpine Linux 3.20, like docker:26, because the package is not present in the default repository. Here is a short fix to deal with this problem. As per offical release not , The aws-cli has been temporarily disabled until upstream resolves incompatibilities with Python 3.12. See the release notes for it here.

Error I got :

$ apk add aws-cli
ERROR: unable to select packages:
  aws-cli (no such package):
    required by: world[aws-cli]

Here is my gitlab-ci.yml file.

aws_auth:
  stage: aws_auth
  image: docker:25
  services:
    - name: docker:25-dind
      command: ["--registry-mirror=https://registry-mirror.gcr.io"]
  script:
    - apk update && apk upgrade
    - apk add aws-cli
    - apk add curl jq
    - authenticate_os_dev_aws
    - aws s3 cp s3://$SOURCE_S3_BUCKET/FILE_PATH/$FILE_NAME $PWD/$FILE_NAME
    - ls -l DC
    - pull_and_run_docker_image
    - authenticate_os_dev_aws
    - aws s3 cp $CI_PROJECT_DIR/my-data/ s3://$DESTINATION_S3_BUCKET/$VERSION_ID --recursive
  when: on_success
  artifacts:
    paths:
      - my-data

This shows that the Alpine V3.20 repository is being accessed by it. that its repository’s aws-cli package was missing.. which was missing aws-cli package from it’s repository.

Solution :

In order to fix this problem, I updated the docker:26 repository with Alpine 3.9. Append the Alpine 3.19 repository URLs to the package repositories list. Once more, let me emphasize that this is a temporary solution that will enable you to solve the problem effectively.

   - echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main' >> /etc/apk/repositories
   - echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/community' >> /etc/apk/repositories

Here is the updated gitlab-ci.yml file.

aws_auth:
  stage: aws_auth
  image: docker:25
  services:
    - name: docker:25-dind
      command: ["--registry-mirror=https://registry-mirror.gcr.io"]
  script:
    - echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/main' >> /etc/apk/repositories
    - echo 'http://dl-cdn.alpinelinux.org/alpine/v3.19/community' >> /etc/apk/repositories  
    - apk update && apk upgrade
    - apk add aws-cli
    - apk add curl jq
    - authenticate_os_dev_aws
    - aws s3 cp s3://$SOURCE_S3_BUCKET/FILE_PATH/$FILE_NAME $PWD/$FILE_NAME
    - ls -l DC
    - pull_and_run_docker_image
    - authenticate_os_dev_aws
    - aws s3 cp $CI_PROJECT_DIR/my-data/ s3://$DESTINATION_S3_BUCKET/$VERSION_ID --recursive
  when: on_success
  artifacts:
    paths:
      - my-data

By temporarily adding Alpine 3.19 repositories and installing aws-cli, along with other necessary packages, You can resolve the ‘Unable to Select Packages: aws-cli’ error in Docker:26 images. This solution ensures seamless integration of AWS CLI functionality into Alpine 3.20-based Docker environments.

See also  How to Resolve the "Unprotected Private Key File" Error in SSH on Windows

8 thoughts on “ERROR: unable to select packages”

  1. I spent the last several hours trying to figure out this problem, but you saved me time. Many thanks!

    Reply
    • Thank you for your feedback! I’m thrilled to hear that the article helped you solve the problem and saved you time. If you have any more questions or need further assistance, don’t hesitate to reach out.

      Reply

Leave a Comment

PHP Code Snippets Powered By : XYZScripts.com