Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

winget export failing with Element not found error #4545

Closed
lukargit opened this issue Jun 6, 2024 · 7 comments
Closed

winget export failing with Element not found error #4545

lukargit opened this issue Jun 6, 2024 · 7 comments
Labels
Command-Export Issue related to WinGet Export Context-System Related to system context (nt authority/session 0) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention Issue needs attention from Microsoft
Milestone

Comments

@lukargit
Copy link

lukargit commented Jun 6, 2024

Brief description of your issue

We are using WinGet to install applications machine wide with Powershell DSC, and one of the test scripts is failing during the execution of winget export with this error:

2024-06-06 20:21:27.789 [REPO] Opened SQLite Index with version [1.7], last write [2024-06-06 18:32:17.000]
2024-06-06 20:21:27.901 [REPO] Creating new SQLite Index with version [Latest] at ':memory:'
2024-06-06 20:21:27.905 [REPO] Reading MSI UpgradeCodes
2024-06-06 20:21:27.981 [REPO] Reading MSI UpgradeCodes
2024-06-06 20:21:28.016 [FAIL] WindowsPackageManager.dll!00007FF886D49503: LogHr(1) tid(3c18) 80070490 Element not found.

2024-06-06 20:21:28.201 [CLI ] Caught winrt::hresult_error: 0x80070490 : Element not found.

This is not a widespread issue and has only happened on one machine at this point, but it does reproduce 100% of the time on this machine. Note that winget is running under SYSTEM context.

Steps to reproduce

DSC runs (under SYSTEM context) winget.exe export --include-versions --no-vt --accept-source-agreements --disable-interactivity --output exportedApps.json during the test portion of a script resource, and that always fails with an Element not found error.

Expected behavior

The current list of installed applications is written to exportedApps.json

Actual behavior

The export fails and no file is written.

Environment

Windows Package Manager v1.7.11261
Copyright (c) Microsoft Corporation. All rights reserved.
 
Windows: Windows.Desktop v10.0.22621.3593
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.22.11261.0
Copy link

github-actions bot commented Jun 6, 2024

Hi I'm an AI powered bot that finds similar issues based off the issue title.

Please view the issues below to see if they solve your problem, and if the issue describes your problem please consider closing this one and thumbs upping the other issue to help us prioritize it. Thank you!

Closed similar issues:

Note: You can give me feedback by thumbs upping or thumbs downing this comment.

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Jun 6, 2024
@Trenly
Copy link
Contributor

Trenly commented Jun 7, 2024

Can you try running the export command outside of DSC? I'm almost certain this is an issue caused by WinGet being run in system context, so knowing if it works outside of a DSC script will help determine the root cause

@microsoft-github-policy-service microsoft-github-policy-service bot removed the Needs-Triage Issue need to be triaged label Jun 7, 2024
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. Command-Export Issue related to WinGet Export Context-System Related to system context (nt authority/session 0) labels Jun 7, 2024
@lukargit
Copy link
Author

lukargit commented Jun 7, 2024

@Trenly it runs fine outside of DSC on the same machine. This same DSC config is working well on 350+ other machines, so running winget in system context is working well elsewhere. I can re-image the machine and likely resolve the issue for us, but I wanted to keep it around in case there is additional data that could be useful in getting to a root cause.

@lukargit
Copy link
Author

Any updates on action we can take here to continue the investigation? This has started occurring on more machines after they are working fine for some time (weeks). Our only mitigation at this point is to reimage them, after which winget export works fine again.

@denelon
Copy link
Contributor

denelon commented Jul 29, 2024

Is this still happening with WinGet 1.8?

@denelon denelon added the Needs-Author-Feedback Issue needs attention from issue or PR author label Jul 29, 2024
@lukargit
Copy link
Author

lukargit commented Aug 1, 2024

@denelon we have not run into this since upgrading to 1.8.1911. At the rate it was occurring, if the bug still existed I would expect at least one machine to have run into it, so i'm good with closing this. I can create a new issue if we run into it again.

@lukargit lukargit closed this as completed Aug 1, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention Issue needs attention from Microsoft and removed Needs-Author-Feedback Issue needs attention from issue or PR author labels Aug 1, 2024
@RobMSP
Copy link

RobMSP commented Aug 23, 2024

I have two systems, deployed with the same OS and tools. One is failing unless I run as the user, if I run as 'system' i get an error. The other works fine.

I checked the local security policy, couldn't find any differences. Same AV etc...

The only potential difference, is one has HyperV instaleld right now.

`PS C:\temp> winget --info
Windows Package Manager v1.8.1911
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.4037
System Architecture: X64

Winget Directories
------------------------------------------------------------------------------------------------------
Logs                               %TEMP%\WinGet\defaultState
User Settings                      %LOCALAPPDATA%\Microsoft\WinGet\Settings\defaultState\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                C:\Users\Default\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
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled
PS C:\temp> whoami
nt authority\system
PS C:\temp> winget update
Name                            Id                            Version        Available     Source
-------------------------------------------------------------------------------------------------
Mozilla Firefox (x64 en-US)     Mozilla.Firefox               129.0.1        129.0.2       winget
Google Chrome                   Google.Chrome                 127.0.6533.120 128.0.6613.85 winget
Microsoft Edge WebView2 Runtime Microsoft.EdgeWebView2Runtime 127.0.2651.105 128.0.2739.42 winget
Microsoft Edge                  Microsoft.Edge                127.0.2651.105 128.0.2739.42 winget
4 upgrades available.`

System 2 -


`PS C:\Windows\system32> winget --info
Windows Package Manager v1.8.1911
Copyright (c) Microsoft Corporation. All rights reserved.

Windows: Windows.Desktop v10.0.22631.4037
System Architecture: X64

Winget Directories
------------------------------------------------------------------------------------------------------
Logs                               %TEMP%\WinGet\defaultState
User Settings                      %LOCALAPPDATA%\Microsoft\WinGet\Settings\defaultState\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                C:\Users\Default\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
ProxyCommandLineOptions                   Disabled
DefaultProxy                              Disabled
PS C:\Windows\system32> whoami
nt authority\system
PS C:\Windows\system32> winget update
Failed to open the predefined source; please report to winget maintainers.
An unexpected error occurred while executing the command:
0x80070490 : Element not found.
PS C:\Windows\system32> `

@denelon denelon added this to the 1.9 Client milestone Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Command-Export Issue related to WinGet Export Context-System Related to system context (nt authority/session 0) Issue-Bug It either shouldn't be doing this or needs an investigation. Needs-Attention Issue needs attention from Microsoft
Projects
None yet
Development

No branches or pull requests

4 participants