Skip to content

Unable to Install AZ CLI on Ubuntu 24.04 #31737

@johnhaczewski

Description

@johnhaczewski

Describe the bug

I had AZ CLI installed on a Linux VM in Azure, when running a apt update && apt upgrade I got errors with AZ CLI

I have attempted a few things (see below) and regardless of what I do I get the following error:

johnh:~$ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
Hit:1 https://packages.microsoft.com/repos/azure-cli noble InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu noble InRelease              
Hit:3 http://azure.archive.ubuntu.com/ubuntu noble-updates InRelease      
Hit:4 http://azure.archive.ubuntu.com/ubuntu noble-backports InRelease    
Hit:5 http://azure.archive.ubuntu.com/ubuntu noble-security InRelease
Hit:6 https://packages.microsoft.com/repos/microsoft-ubuntu-noble-prod noble InRelease
Hit:7 https://download.docker.com/linux/ubuntu noble InRelease
Hit:8 https://packages.microsoft.com/ubuntu/24.04/prod insiders-fast InRelease
Hit:9 https://packages.microsoft.com/ubuntu/24.04/prod noble InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
apt-transport-https is already the newest version (2.8.3).
ca-certificates is already the newest version (20240203).
curl is already the newest version (8.5.0-2ubuntu10.6).
gnupg is already the newest version (2.4.4-2ubuntu17.2).
lsb-release is already the newest version (12.0-2).
The following packages were automatically installed and are no longer required:
  libnetfilter-queue1 libpcre3 linux-azure-6.11-cloud-tools-6.11.0-1014 linux-azure-6.11-headers-6.11.0-1014 linux-azure-6.11-tools-6.11.0-1014
  linux-cloud-tools-6.11.0-1014-azure linux-headers-6.11.0-1014-azure linux-image-6.11.0-1014-azure linux-modules-6.11.0-1014-azure
  linux-tools-6.11.0-1014-azure mde-netfilter
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Types: deb
URIs: https://packages.microsoft.com/repos/azure-cli/
Suites: noble
Components: main
Architectures: amd64
Signed-by: /etc/apt/keyrings/microsoft.gpg
Hit:1 http://azure.archive.ubuntu.com/ubuntu noble InRelease
Hit:2 https://packages.microsoft.com/repos/azure-cli noble InRelease                                      
Hit:3 http://azure.archive.ubuntu.com/ubuntu noble-updates InRelease                                      
Hit:4 https://packages.microsoft.com/repos/microsoft-ubuntu-noble-prod noble InRelease
Hit:5 http://azure.archive.ubuntu.com/ubuntu noble-backports InRelease    
Hit:6 http://azure.archive.ubuntu.com/ubuntu noble-security InRelease     
Hit:7 https://packages.microsoft.com/ubuntu/24.04/prod insiders-fast InRelease
Hit:8 https://packages.microsoft.com/ubuntu/24.04/prod noble InRelease    
Hit:9 https://download.docker.com/linux/ubuntu noble InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  libnetfilter-queue1 libpcre3 linux-azure-6.11-cloud-tools-6.11.0-1014 linux-azure-6.11-headers-6.11.0-1014 linux-azure-6.11-tools-6.11.0-1014
  linux-cloud-tools-6.11.0-1014-azure linux-headers-6.11.0-1014-azure linux-image-6.11.0-1014-azure linux-modules-6.11.0-1014-azure
  linux-tools-6.11.0-1014-azure mde-netfilter
Use 'sudo apt autoremove' to remove them.
The following NEW packages will be installed:
  azure-cli
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/54.0 MB of archives.
After this operation, 634 MB of additional disk space will be used.
(Reading database ... 156842 files and directories currently installed.)
Preparing to unpack .../azure-cli_2.74.0-1~noble_amd64.deb ...
Unpacking azure-cli (2.74.0-1~noble) ...
dpkg: error processing archive /var/cache/apt/archives/azure-cli_2.74.0-1~noble_amd64.deb (--unpack):
 unable to open '/opt/az/lib/python3.12/site-packages/azure_monitor_query-1.2.0.dist-info/WHEEL.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
Errors were encountered while processing:
 /var/cache/apt/archives/azure-cli_2.74.0-1~noble_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Related command

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Errors

Preparing to unpack .../azure-cli_2.74.0-1~noble_amd64.deb ...
Unpacking azure-cli (2.74.0-1~noble) ...
dpkg: error processing archive /var/cache/apt/archives/azure-cli_2.74.0-1~noble_amd64.deb (--unpack):
 unable to open '/opt/az/lib/python3.12/site-packages/azure_monitor_query-1.2.0.dist-info/WHEEL.dpkg-new': No such file or directory
No apport report written because the error message indicates an issue on the local system
Errors were encountered while processing:
 /var/cache/apt/archives/azure-cli_2.74.0-1~noble_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Issue script & Debug output

I have tried the following:

All steps from https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest&pivots=apt for both the latest version, and 2.73.0

Re-install

sudo dpkg --remove azure-cli
sudo apt-get clean
sudo apt-get update

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
sudo dpkg --remove --force-remove-reinstreq azure-cli
sudo apt clean
sudo rm -f /var/cache/apt/archives/azure-cli_2.74.0-1~noble_amd64.deb

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Creating that path manually

sudo mkdir -p /opt/az/lib/python3.12/site-packages/azure_keyvault_certificates-4.7.0.dist-info
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Nuke

sudo apt purge azure-cli
sudo rm -rf /opt/az
sudo apt clean

curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash

Expected behavior

AZ CLI installs properly

Environment Summary

johnh:~$ uname -r
6.11.0-1015-azure
johnh:~$ uname -a
Linux johnh-devdesk-spot-eus 6.11.0-1015-azure #15~24.04.1-Ubuntu SMP Thu May  1 02:52:08 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

johnh:~$ python3.12
Python 3.12.3 (main, Jun 18 2025, 17:59:45) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Additional context

No response

Metadata

Metadata

Assignees

Labels

Azure CLI TeamThe command of the issue is owned by Azure CLI teamcustomer-reportedIssues that are reported by GitHub users external to the Azure organization.questionThe issue doesn't require a change to the product in order to be resolved. Most issues start as that

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions