Skip to content

winget configure can not install ubuntu for multiple users #4036

Description

@jtnord

Brief description of your issue

trying to use winget configure to install apps for users.

the ubuntu store app is installed per user so users get their own linux env.

the install works for the first (admin) user but then performing the same operation when run as a user it can not proceed because it is both installed (by another user) and not installed at the same time),

Steps to reproduce

2 users (one admin and one regular)
ensure wsl is already correctly installed

as an admin run winget configure with a file containing

  - resource: Microsoft.WinGet.DSC/WinGetPackage
    id: ubuntu
    directives:
      description: Install Ubuntu WSL
      allowPrerelease: true
    settings:
      id: Canonical.Ubuntu.2204
      source: winget

check the install has worked by running bash

restart the machine and login as a regular user

verify ubuntu is not available with wsl --list

the output will e like

C:\workarea\source\github\jtnord\os-config-as-code>wsl --list
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore

run winget configure with a configuration containing:

  - resource: Microsoft.WinGet.DSC/WinGetPackage
    id: ubuntu
    directives:
      description: Install Ubuntu WSL
      allowPrerelease: true
    settings:
      id: Canonical.Ubuntu.2204
      source: winget

Expected behaviour

ubuntu is installed

Actual behaviour

unbuntu fails to install

  The configuration unit failed while attempting to apply the desired state.
WinGetPackage Failed installing Canonical.Ubuntu.2204. InstallStatus 'InstallError' InstallerErrorCode '2147942402' ExtendedError '-2147024894'
<See the log file for additional details>
Some of the configuration was not applied successfully.

logs contain

2024-01-06 13:38:36.739 [CORE] Starting StagePackageAsync operation #0: https://wslstorestorage.blob.core.windows.net/wslblob/Ubuntu2204-221101.AppxBundle
2024-01-06 13:38:36.740 [CORE] Begin waiting for operation #0
2024-01-06 13:38:36.740 [CORE] Begin blocking for operation #0
2024-01-06 13:38:46.662 [CORE] Successfully completed #0
2024-01-06 13:38:46.662 [CORE] Starting RegisterPackageByFullNameAsync operation #1: CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc
2024-01-06 13:38:46.666 [CORE] Begin waiting for operation #1
2024-01-06 13:38:46.666 [CORE] Begin blocking for operation #1
2024-01-06 13:38:46.667 [CORE] Deployment operation #1: Windows cannot perform the RegisterByPackageFullName operation because it could not find CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc in the repository. Make sure CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc has been staged or was installed by another user.
2024-01-06 13:38:46.667 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerCommonCore\Deployment.cpp(191)\WindowsPackageManager.dll!00007FF954FF1E81: (caller: 00007FF954F4989D) Exception(12) tid(2c54) 80070002 The system cannot find the file specified.

2024-01-06 13:38:46.667 [CORE] Starting RemovePackage operation #2: CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc
2024-01-06 13:38:46.674 [CORE] Begin waiting for operation #2
2024-01-06 13:38:46.674 [CORE] Begin blocking for operation #2
2024-01-06 13:38:46.695 [CORE] Deployment operation #2: Windows cannot remove CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc because the current user does not have that package installed. Use Get-AppxPackage to see the list of packages installed.
2024-01-06 13:38:46.696 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerCommonCore\Deployment.cpp(54)\WindowsPackageManager.dll!00007FF954FF0C60: (caller: 00007FF954FF226C) Exception(13) tid(2c54) 80073CF1 Package was not found.
    Msg:[Operation failed: Windows cannot remove CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc because the current user does not have that package installed. Use Get-AppxPackage to see the list of packages installed.] 

2024-01-06 13:38:46.696 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerCommonCore\Deployment.cpp(126)\WindowsPackageManager.dll!00007FF95516C0D1: (caller: 00007FF954FF3783) LogHr(1) tid(2c54) 80073CF1 Package was not found.
    Msg:[C:\__w\1\s\external\pkg\src\AppInstallerCommonCore\Deployment.cpp(54)\WindowsPackageManager.dll!00007FF954FF0C60: (caller: 00007FF954FF226C) Exception(13) tid(2c54) 80073CF1 Package was not found.
    Msg:[Operation failed: Windows cannot remove CanonicalGroupLimited.Ubuntu_2204.1.7.0_neutral_~_79rhkp1fndgsc because the current user does not have that package installed. Use Get-AppxPackage to see the list of packages installed.] 
] 

which says it is both installed and not installed... we have a schrodinger's install

Environment

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

Windows: Windows.Desktop v10.0.22631.2861
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.21.3482.0

Winget Directories
-------------------------------------------------------------------------------------------------------------------------------
Logs                               %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir
User Settings                      %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\settings.json
Portable Links Directory (User)    %LOCALAPPDATA%\Microsoft\WinGet\Links
Portable Links Directory (Machine) C:\Program Files\WinGet\Links
Portable Package Root (User)       %LOCALAPPDATA%\Microsoft\WinGet\Packages
Portable Package Root              C:\Program Files\WinGet\Packages
Portable Package Root (x86)        C:\Program Files (x86)\WinGet\Packages
Installer Downloads                %USERPROFILE%\Downloads

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

Admin Setting                             State
--------------------------------------------------
LocalManifestFiles                        Disabled
BypassCertificatePinningForMicrosoftStore Disabled
InstallerHashOverride                     Disabled
LocalArchiveMalwareScanOverride           Disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ExternalIssue outside of winget-cli sourceCommand-ConfigureIssue related to WinGet ConfigurationDSC-ResourceIssue related to DSC ResourcesIssue-FeatureThis is a feature request for the Windows Package Manager client.
    No fields configured for Feature.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions