azure-cli: Cannot install AzureCLI

Describe the bug Azure CLI installation is failing during Docker image build. To Reproduce Add RUN bash -c “$(curl -sL https://aka.ms/InstallAzureCLIDeb)” to a Dockerfile and build the image.

Expected behavior Install AzureCLI inside Docker image.

Additional context

Step 11/24 : RUN bash -c "$(curl -sL https://aka.ms/InstallAzureCLIDeb)"

 ---> Running in 7ac12f66d324

export DEBIAN_FRONTEND=noninteractive
apt-get update
Hit:1 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:5 http://packages.cloud.google.com/apt cloud-sdk-xenial InRelease
Hit:6 http://security.ubuntu.com/ubuntu xenial-security InRelease

Reading package lists...

apt-get install -y apt-transport-https lsb-release gnupg curl

Reading package lists...
Building dependency tree...
Reading state information...
curl is already the newest version (7.47.0-1ubuntu2.16).
gnupg is already the newest version (1.4.20-1ubuntu3.3).
lsb-release is already the newest version (9.20160110ubuntu0.2).
The following NEW packages will be installed:
  apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 8 not upgraded.
Need to get 26.7 kB of archives.
After this operation, 216 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu xenial-updates/main amd64 apt-transport-https amd64 1.2.32ubuntu0.1 [26.7 kB]

debconf: delaying package configuration, since apt-utils is not installed
Fetched 26.7 kB in 0s (550 kB/s)
Selecting previously unselected package apt-transport-https.
(Reading database ... 
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 42957 files and directories currently installed.)
Preparing to unpack .../apt-transport-https_1.2.32ubuntu0.1_amd64.deb ...
Unpacking apt-transport-https (1.2.32ubuntu0.1) ...
Setting up apt-transport-https (1.2.32ubuntu0.1) ...
set +v
curl -sL https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/microsoft.asc.gpg

set +v
CLI_REPO=$(lsb_release -cs)
lsb_release -cs
echo "deb [arch=amd64] https://packages.microsoft.com/repos/azure-cli/ ${CLI_REPO} main" \
    > /etc/apt/sources.list.d/azure-cli.list
apt-get update
Hit:1 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu xenial InRelease
Hit:3 http://archive.ubuntu.com/ubuntu xenial-updates InRelease
Hit:4 http://archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:5 http://ppa.launchpad.net/deadsnakes/ppa/ubuntu xenial InRelease
Hit:6 http://packages.cloud.google.com/apt cloud-sdk-xenial InRelease
Get:7 https://packages.microsoft.com/repos/azure-cli xenial InRelease [3965 B]

Get:8 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages [12.5 kB]
Ign:8 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages

Get:8 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages [12.1 kB]
Ign:8 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages
Get:8 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages [57.2 kB]
Err:8 https://packages.microsoft.com/repos/azure-cli xenial/main amd64 Packages
  Writing more data than expected (58043 > 57222)
Fetched 3965 B in 3s (1028 B/s)

Reading package lists...
E: Failed to fetch https://packages.microsoft.com/repos/azure-cli/dists/xenial/main/binary-amd64/Packages  Writing more data than expected (58043 > 57222)
E: Some index files failed to download. They have been ignored, or old ones used instead.

The command '/bin/sh -c bash -c "$(curl -sL https://aka.ms/InstallAzureCLIDeb)"' returned a non-zero code: 100

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 3
  • Comments: 20 (4 by maintainers)

Most upvoted comments

have simular issue also with msft ubuntu repos: https://packages.microsoft.com/ubuntu/18.04/prod/dists/bionic/main/binary-amd64/ Err:4 https://packages.microsoft.com/ubuntu/18.04/prod bionic/main amd64 Packages File has unexpected size (72463 != 72485). Mirror sync in progress? [IP: 13.91.48.226 443]

was fine yesterday?

regards

@GavBurke , yes, thanks.

@GavBurke yes very true workaround is just for non msft packages or if repos have already been synced