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

configureSelfElevate fails in hyperv vm

Open harrhp opened this issue 1 year ago • 7 comments

Brief description of your issue

resources with securityContext: elevated fail to apply in hyperv vm

# yaml-language-server: $schema=https://aka.ms/configuration-dsc-schema/0.2
properties:
  resources:
    - resource: DSCR_FileContent/TextFile
      directives:
        description: scratchpad
        allowPrerelease: true
        securityContext: elevated
      settings:
        Ensure: Present
        Path: "c:/test.txt"
        Contents: "hello"
  configurationVersion: 0.2.0

Steps to reproduce

  1. create windows 11 (23h2/24h2 doesn't matter, both don't work) vm in hyperv
  2. install winget 1.9.25180
  3. enable configureSelfElevate setting
  4. apply winget configuration file with resource that has securityContext: elevated directive

Expected behavior

configuration applied successfully

Actual behavior

verbose log log.txt

The configuration unit failed due to an internal error: -532462766 The text associated with this error code could not be found. Some of the configuration was not applied successfully.

Environment

Windows Package Manager v1.9.25180 Windows: Windows.Desktop v10.0.22631.4317 System Architecture: X64 Package: Microsoft.DesktopAppInstaller v1.24.25180.0

clean windows installation. no other software

harrhp avatar Oct 30 '24 18:10 harrhp

Was the configuration run in a "user" context?

There should have been a UAC (User Account Control) trigger after accepting the configuration agreement.

denelon avatar Oct 30 '24 21:10 denelon

Can you share the output from winget features?

denelon avatar Oct 30 '24 21:10 denelon

Was the configuration run in a "user" context?

There should have been a UAC (User Account Control) trigger after accepting the configuration agreement.

Yes. There was a UAC propmt and i confirmed it

Can you share the output from winget features?

The following experimental features are in progress.
They can be configured through the settings file 'winget settings'.

Feature                  Status   Property             Link
-------------------------------------------------------------------------------------
Direct MSI Installation  Disabled directMSI            https://aka.ms/winget-settings
Resume                   Disabled resume               https://aka.ms/winget-settings
Configuration Schema 0.3 Disabled configuration03      https://aka.ms/winget-settings
Configure Self Elevation Enabled  configureSelfElevate https://aka.ms/winget-settings
Configure Export         Disabled configureExport      https://aka.ms/winget-settings

harrhp avatar Oct 31 '24 12:10 harrhp

I ran the configuration on my local machine and it did succeed. I'm spinning up a VM to see if I can repro in Hyper-V.

denelon avatar Oct 31 '24 18:10 denelon

OK, I was able to repro this.

@SteveL-MSFT is this something you've seen before? Given WinGet is leveraging the DSCR_FileContent/TextFile resource in this configuration, I'm wondering if it's an issue with Hyper-V.

denelon avatar Oct 31 '24 18:10 denelon

I just ran into a problem where winget configure -f <winget config> would fail due to an internal error with no further explanation, but the problem wound up being the lack of Visual C++ Redistributable in the freshly-installed environment. Once I installed that (winget install --id Microsoft.VCRedist.2015+.x64 -e), it worked. I wonder if this issue is related?

FlippingBinary avatar May 16 '25 22:05 FlippingBinary

I just ran into a problem where winget configure -f <winget config> would fail due to an internal error with no further explanation, but the problem wound up being the lack of Visual C++ Redistributable in the freshly-installed environment. Once I installed that (winget install --id Microsoft.VCRedist.2015+.x64 -e), it worked. I wonder if this issue is related?

Yes, installing Microsoft.VCRedist.2015+.x64 fixed the problem. Thank you

harrhp avatar May 17 '25 06:05 harrhp