Winget install always fails (maybe to do with https://winget.azureedge.net/cache?)
Describe the bug Winutil 23.09.23 winget install always fails on Windows 11 22H2 (on a VirtualBox 7.0.10r158379 VM). This might have to do with https://winget.azureedge.net/cache.
To Reproduce Steps to reproduce the behavior:
- Download and install https://download.virtualbox.org/virtualbox/7.0.10/VirtualBox-7.0.10-158379-Win.exe
- Download ‘Windows 11 (multi-edition ISO for x64 devices)’ from https://www.microsoft.com/software-download/windows11 (when I did this, I got ‘Win11_22H2_English_x64v2.iso’)
- Run VirtualBox, create a new VM with 8192 MB Ram, 4 processors, 150 GB Disk non-preallocated.
- Attach Win11_22H2_English_x64v2.iso to the VM.
- Start VM and follow vanilla Windows 11 install: English (World), Win 11 Pro, Work or School, Domain join instead, no password on local account.
- After Windows install is complete, open PowerShell in administrative mode.
- Type ‘Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process’ to allow scripts.
- Answer ‘y’ when asked if you want to change execution policy.
- Type ‘irm christitus.com/win | iex’ to run winutil (the winutil I got was version 23.09.23).
- Answer ‘n’ when asked if you want to install Chocolatey.
- On winutil Install tab, tick ‘Brave’ then click ‘Install Selection’.
- Wait for “Installs are Finished” (‘Done’) dialog box to appear (it takes several seconds).
- Observe the absence of Brave.
- Try installing any other combinations of packages, as you like (for me, nothing ever installed).
Expected behavior Selecting ‘Brave’ (or anything else) and then clicking ‘Install Selection’ should actually install whatever was selected. Actual behavior: winutil sits a while, then reports that “Installs are Finished”. But nothing seems to have been installed.
Screenshots
Particulars of VirtualBox host machine:
Particulars of VirtualBox:
Particulars of guest VM:
Ready to install Brave:
Installs are Finished...but not really:
Is this simply because Microsoft gave me an ISO with newer install files than Chris demonstrated on YouTube?
Additional context
At the VM's administrative PowerShell command prompt, typing ‘winget -v’ reports v1.2.10691. Typing ‘winget list’ spins for about 20 seconds and reports nothing. Typing ‘winget source list’ reports:
Name Argument
-----------------------------------------------------
msstore https://storeedgefd.dsx.mp.microsoft.com/v9.0
winget https://winget.azureedge.net/cache
I noticed that browsing the azureedge.net address fails with ERR_CONNECTION_TIMED_OUT. Based on the 'winget source list' I saw on my host machine (which was installed way back on 10/29/2022), I tried the following experiment on the VM:
- winget source remove -n winget
- winget source add -n winget -a https://cdn.winget.microsoft.com/cache
When I then attempted to install Brave as before, it finally worked. I have no idea whether it is wise or appropriate to run the VM with the reference to cdn.winget.microsoft.com. However, that worked well enough to install Brave. I have not tested more.
@jslagle Thats not the issue It is with the winget.ps1 file and where it downloads winget from
look at code https://github.com/ChrisTitusTech/winutil/blob/main/winget.ps1 This is whats broken even on main repo https://github.com/asheroto/winget-install
the workaround and tested is just open powershell as admin and just simply run winget install wingetcreate
Tested and working then Rerun winutil and u should be able to install ur app just fine
@KALIXHOSTING Thanks. I tried it. The workaround did not help in my case. When I run winget install wingetcreate it merely displays a spinner for a while, and then quietly dies. That is the same behavior I observed with winutil.
Looking with Wireshark, I see winget is apparently trying to connect to winget.azureedge.net, but to no avail.
Here is a 30-second screen capture of Winshark vs winget install wingetcreate. https://github.com/ChrisTitusTech/winutil/assets/13228979/b8fa6b2e-74b8-44a6-a3bd-94052a9e2c49
Looking at the following frame from that screen capture, I see timeouts at 143.244.220.150. That is the IP address my DNS reports for https://winget.azureedge.net/, so I still suspect that URL may be part of the problem.
New Information
I believe the definitive answer is to be found at https://github.com/MicrosoftDocs/windows-dev-docs/issues/4646, where Brandon McMillan says recent Windows 11 22H2 AVD SKU’s use https://winget.azureedge.net/cache but should use https://cdn.winget.microsoft.com/cache.
While the specific 22H2 builds Brandon mentioned might not be in the ISO I downloaded from https://www.microsoft.com/software-download/windows11, a follow-up comment by denelon (Demitrius Nelon, Product Manager for WinGet) does confirm that https://cdn.winget.microsoft.com/cache is the correct URL.
Denelon suggests winget install "App Installer" -s msstore --force as a workaround. I think that is similar in principle to the workaround @KALIXHOSTING proposed, except that denelon uses “-s msstore” and thereby avoids attempting to fetch winget from the deprecated azureedge.net URL.
In my case, winget install "App Installer" -s msstore --force failed, possibly because my region was set to English (World). When I changed the region to English (United States) and downloaded App Installer from the Windows Store, winget went from v1.2.10691 to v1.6.2721, the new cdn.winget.microsoft.com URL magically showed up in winget source list, and winutil installed Brave as expected.
So it seems the azureedge.net URL was in the process of being phased out, and I just happened to get caught in the crossfire.
Resolution
There is no problem with winutil, just a (hopefully fleeting) migration problem with redirecting winget to the new URL. Therefore, I am closing the issue.
@jslagle this still occurs (Feb 2024). I have a new install of Win11 Pro, v23H2 os build 22631.3155. I did a fresh install using internet sources.
winget shows a v1.2.10691
winget source list shows msstore and that azureedge.net/cache as the sources.
If I try to run winget install "App Installer" -s msstore --force it only finds "LG Monitor App Installer". The one I seem to want has id Microsoft.AppInstaller but is not on msstore so can't install it.
trying to remove the bad source works, but running winget source add -n winget -a https://cdn.winget.microsoft.com/cache fails (no error, just no source added).
EDIT, SOLUTION: I found the proper "App Installer", on msstore (here https://apps.microsoft.com/detail/9NBLGGH4NNS1) . it's a hidden package so you have to have a link to find it. I used the ID of it found in the URL to install it, and now winget works and I can install stuff properly. Here's the command you can use to install it (the solution):
winget install -s msstore --id 9NBLGGH4NNS1
Both of these solutions work for me. Using the 2nd one in my script since it just installs the latest version of WinGet, but the first one (mentioned above in this github issue) adds the new source