azure-cli icon indicating copy to clipboard operation
azure-cli copied to clipboard

Can't upgrade in WSL2: UNC paths are not supported.

Open magodo opened this issue 3 years ago • 5 comments

Related command

❯ az version
{
  "azure-cli": "2.35.0",
  "azure-cli-core": "2.35.0",
  "azure-cli-telemetry": "1.0.6",
  "extensions": {}
}

❯ az upgrade
This command is in preview and under development. Reference and support levels: https://aka.ms/CLI_refstatus
Your current Azure CLI version is 2.35.0. Latest version available is 2.37.0.
Please check the release notes first: https://docs.microsoft.com/cli/azure/release-notes-azure-cli
Do you want to continue? (Y/n): y
Not able to upgrade automatically. Instructions can be found at https://aka.ms/doc/InstallAzureCli
'\\wsl$\Ubuntu\home\magodo\github\terraform-provider-azurerm'
CMD.EXE was started with the above path as the current directory.
UNC paths are not supported.  Defaulting to Windows directory.
CLI upgrade failed or aborted.

Additional context

I'm running this under WSL2, Ubuntu distribution:

❯ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.4 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.4 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal

magodo avatar May 30 '22 02:05 magodo

@jiasli for awareness

yonzhan avatar May 30 '22 02:05 yonzhan

az upgrade currently doesn't support WSL. Please follow the official doc to update: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

sudo apt-get update && sudo apt-get install --only-upgrade -y azure-cli

jiasli avatar May 30 '22 04:05 jiasli

@yonzhan Why do you just close this issue given it is not resolved?

magodo avatar May 30 '22 06:05 magodo

@magodo I thought Jiashuo provided you solution/workaround. I can reopen it and add it as feature request in our backlog.

yonzhan avatar May 30 '22 08:05 yonzhan

az upgrade currently doesn't support WSL. Please follow the official doc to update: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?pivots=apt

sudo apt-get update && sudo apt-get install --only-upgrade -y azure-cli

This didn't work for me. I didn't have azure-cli installed on WSL2 OS, instead it was using the one from Windows. I didn't recall about this. So first check:

which az

In my case: /mnt/c/Program Files (x86)/Microsoft SDKs/Azure/CLI2/wbin/az.

If the Azure CLI is from Windows, run az upgrade from PowerShell in Windows instead.

RobertoPrevato avatar Jan 20 '23 10:01 RobertoPrevato

Tried the above solution, but az upgrade did not upgrade the cli. So, problem is still not resolved.

Nivi09 avatar Oct 06 '23 10:10 Nivi09