microsoft / winget-pkgs

The Microsoft community Windows Package Manager manifest repository
MIT License
8.54k stars 4.43k forks source link

[Package Issue]: Spotify.Spotify installation fails with exit code 23 #83517

Closed lackovic closed 1 year ago

lackovic commented 1 year ago

Please confirm these before moving forward

Category of the issue

Installation issue.

Brief description of your issue

When I run winget install -e --id Spotify.Spotify the installation fails with exit code 23.

Steps to reproduce

Run winget install -e --id Spotify.Spotify in an elevated PowerShell terminal.

Actual behavior

The installation fails with exit code 23.

Expected behavior

The application gets installed.

Environment

Windows Package Manager v1.2.10691
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.674
Package: Microsoft.DesktopAppInstaller v1.17.10691.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale

Screenshots and Logs

> winget install -e --id Spotify.Spotify --force
Found Spotify [Spotify.Spotify] Version 1.1.95.893.g6cf4d40c
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 23
OfficialEsco commented 1 year ago

Spotify does not install elevated. Please update your WinGet Client so it respects the ElevationRequirement field. https://github.com/microsoft/winget-pkgs/blob/ce617205b1d19e24f772e82a1ae010503f95130f/manifests/s/Spotify/Spotify/1.1.95.893.g6cf4d40c/Spotify.Spotify.installer.yaml#L15

lackovic commented 1 year ago

Thanks! I ran the command in a non-admin shell and it worked!

Spotify does not install elevated.

Would it be possible to change the error message to reflect that?

OfficialEsco commented 1 year ago

Spotify does not install elevated.

Would it be possible to change the error message to reflect that?

If you update WinGet to the latest release (1.3) you'll get a error message that reflects that.

lackovic commented 1 year ago

If you update WinGet to the latest release (1.3)

Do you know a way how to do that? I looked in the project README and googled it but didn't find anything.

OfficialEsco commented 1 year ago

Microsoft Store -> Update App Installer. https://www.microsoft.com/p/app-installer/9nblggh4nns1 To manually install or update a version of WinGet you can download the msixbundle from the GitHub Releases. https://github.com/microsoft/winget-cli/releases/tag/v1.3.2691

It is the same as the Installation in the README. https://github.com/microsoft/winget-cli#installing-the-client

lackovic commented 1 year ago

Microsoft Store -> Update App Installer. https://www.microsoft.com/p/app-installer/9nblggh4nns1

Thanks! I had installed the App Installer with:

winget install "App Installer" -s msstore

which I found from this issue, but winget did not get updated until I opened the Store App on the App Installer page which in turn started to update itself automatically. I now have Windows Package Manager v1.3.2691 πŸ‘

Trenly commented 1 year ago

Close with reason: Newer version of winget displays better error message, user issue resolved;

Trollwut commented 1 year ago

Did this change in the recent version? I inly get the error code 23 and not an description that it fails beause elevation issues.

Of course, I can update as intended in an non-elevated shell.

Output:

ξ‚° winget upgrade --include-unknown --all
Name    ID              Version              VerfΓΌgbar            Quelle
------------------------------------------------------------------------
Spotify Spotify.Spotify 1.2.0.1165.gabf054ab 1.2.3.1115.gd61a8f5c winget
1 Aktualisierungen verfΓΌgbar.

(1/1) Gefunden Spotify [Spotify.Spotify] Version 1.2.3.1115.gd61a8f5c
Diese Anwendung wird von ihrem Besitzer an Sie lizenziert.
Microsoft ist nicht verantwortlich und erteilt keine Lizenzen fΓΌr Pakete von Drittanbietern.
Der Installer-Hash wurde erfolgreich ΓΌberprΓΌft
Paketinstallation wird gestartet...
Installieren fehlgeschlagen mit Exitcode: 23

ξ‚ΆAdministrator ξ‚° ~ ξ‚°ξ‚°ξ‚° β™₯ 15:16 ξ‚° winget --version
v1.4.10173
OfficialEsco commented 1 year ago

Weird, i cannot replicate your issue..

PS C:\Users\user> winget install Spotify.Spotify
The installer cannot be run from an administrator context.
PS C:\Users\user> winget --version
v1.4.2161-preview
PS C:\Users\user> winget --version
v1.4.10173
PS C:\Users\user> winget install Spotify.Spotify
The installer cannot be run from an administrator context.
PS C:\Users\user> winget update Spotify.Spotify
The installer cannot be run from an administrator context.
PS C:\Users\user> winget update
Name                            Id                                        Version              Available
-------------------------------------------------------------------------------------------------------------------
Spotify                         Spotify.Spotify                           1.2.2.1115.gd61a8f5c 1.2.3.1115.gd61a8f5c
ImJoakim commented 1 year ago

Weird, i cannot replicate your issue..

I haven't tested it, but could it have something to do with winget upgrade --all? Perhaps the behavior is different compared to winget upgrade Spotify.Spotify

Trollwut commented 1 year ago

That could be it.

I already updated the software non-elevated, so I have to wait for the next upgrade to see if this would be it.

ImJoakim commented 1 year ago

It seems that way. Running winget upgrade Spotify.Spotify in an elevated PowerShell window does not work - it respects the ElevationRequirement field.

PS C:\Users\WDAGUtilityAccount> winget upgrade
Name           Id              Version                                Available
------------------------------------------------------------------------------------------
Spotify        Spotify.Spotify 1.2.0.1165.gabf054ab                   1.2.3.1115.gd61a8f5c
1 upgrades available.
PS C:\Users\WDAGUtilityAccount> winget upgrade Spotify.Spotify
The installer cannot be run from an administrator context.

However, running winget upgrade --all in an elevated PowerShell window does work and does not respect the ElevationRequirement field it seems.

PS C:\Users\WDAGUtilityAccount> winget upgrade --all
Name           Id              Version                                Available
------------------------------------------------------------------------------------------
Spotify        Spotify.Spotify 1.2.0.1165.gabf054ab                   1.2.3.1115.gd61a8f5c
1 upgrades available.

(1/1) Found Spotify [Spotify.Spotify] Version 1.2.3.1115.gd61a8f5c
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://download.scdn.co/SpotifyFullSetup.exe
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  76.8 MB / 76.8 MB
Successfully verified installer hash
Starting package install...
Successfully installed

PS C:\Users\WDAGUtilityAccount> winget -v
v1.4.10173
lackovic commented 1 year ago

Spotify does not install elevated. If you update WinGet to the latest release (1.3) you'll get a error message that reflects that.

I forgot about this and have tried to upgrade Spotify in an elevated shell. However I didn't get the message to reflect that, just a Installer failed with exit code: 23.

> winget upgrade -h --all --verbose-logs
Name                                Id                         Version              Available           Source
--------------------------------------------------------------------------------------------------------------
Spotify                             Spotify.Spotify            1.2.3.1115.gd61a8f5c 1.2.4.912.g949d5fd0 winget
1 upgrade available.

(1/1) Found Spotify [Spotify.Spotify] Version 1.2.4.912.g949d5fd0
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Installer failed with exit code: 23

> winget --info
Windows Package Manager v1.4.10173
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22621.1194
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.19.10173.0

Logs: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

User Settings: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json

Links
---------------------------------------------------------------------------
Privacy Statement   https://aka.ms/winget-privacy
License Agreement   https://aka.ms/winget-license
Third Party Notices https://aka.ms/winget-3rdPartyNotice
Homepage            https://aka.ms/winget
Windows Store Terms https://www.microsoft.com/en-us/storedocs/terms-of-sale
denelon commented 1 year ago

Spotify had the "prohibitsElevation" key which gave the user a message that it didn't work elevated. Unfortunately, we have had to do a bunch of gymnastics in our validation environment to switch to a "user" context for the install. Work is in progress.

Additionally, I've added a feature to add it to the expected return codes enumeration so that error can also be mapped when the key isn't present. The community removed the key to enable it to pass validation.

Add your πŸ‘ to raise priority.

felipog commented 1 year ago

Hello! So I was also having the issues for installing via winget. Then I first removed the pre-installed version that came with Windows 11 , just right click on the app on the Windows menu, and unisntall. Then, winget install spotify.spotify worked. So it needs admin rights for replacing probably.

Cheers

aetonsi commented 1 year ago

Weird, i cannot replicate your issue..

I haven't tested it, but could it have something to do with winget upgrade --all? Perhaps the behavior is different compared to winget upgrade Spotify.Spotify

@ImJoakim Yes that's the exact problem, as you verified later. It seems that winget upgrade --all ignores the ElevationRequirement, tries to install, then reports a generic Installer failed with exit code: 23.

@denelon if it can be of help for the "switch to user context", the gerardog/gsudo tool can do it with the integrity flag:

gsudo --integrity Medium -- any command /and /arguments
# for example
gsudo --integrity Medium -- winget upgrade spotify.spotify

this will "de-elevate" any given command (i haven't actually tried it with spotify because i have already updated spotify at this point). I'll let you guys judge if it can be useful

esters commented 1 year ago

Morning. I had the same issue but the reason was that Spotify was running in the background. After exiting it and running winget upgrade Spotify.Spotify from an non-elevated shell it upgraded without issues.

> winget upgrade Spotify.Spotify
Found Spotify [Spotify.Spotify] Version 1.2.11.914.gd3175972
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed
> winget -v
v1.4.10173
aetonsi commented 1 year ago

Same thing for me, this morning. As i wrote last time, without using a new shell, via gsudo it's possible to de-elevate. I even tried a clean install in an elevated shell:

C:\Windows\System32 (errorlevel -1978335210) # winget install spotify.spotify
The installer cannot be run from an administrator context.

C:\Windows\System32 (errorlevel -1978335146) # gsudo --direct --integrity medium -- winget install spotify.spotify
Found Spotify [Spotify.Spotify] Version 1.2.11.914.gd3175972
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://upgrade.scdn.co/upgrade/client/win32-x86/spotify_installer-1.2.11.914.gd3175972-2210.exe
  β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  84.3 MB / 84.3 MB
Successfully verified installer hash
Starting package install...
Successfully installed
gaia commented 1 year ago

Still happening on Winget v1.5.2201, the current release as of today. Non elevated it works fine.

lackovic commented 1 year ago

Still happening on Winget v1.5.2201, the current release as of today. Non elevated it works fine.

As per @denelon previous comment, this problem (the uninformative error message Installer failed with exit code: 23) will not be solved until the following issue will be resolved:

Rather than commenting this issue I suggest to add your πŸ‘ to the issue above and subscribe to raise its priority. At the moment it has only two πŸ‘.