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

Uninstalling portable package fails with code 0x80070490 (Possibly due to not handling file path encoding correctly) #4853

Open
Natr1x opened this issue Oct 4, 2024 · 2 comments
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Portable Issue related to portable package

Comments

@Natr1x
Copy link

Natr1x commented Oct 4, 2024

Brief description of your issue

When installing Ninja-build.Ninja on a new computer I accidentally did so without symlinks. So I was going to uninstall it in order to reinstall it with symlinks enabled. Which go me the following error message:

Found ninja [Ninja-build.Ninja]
Starting package uninstall...
An unexpected error occurred while executing the command:
0x80070490 : Element not found.
Uninstall failed with exit code: 0x80070490 : Element not found.

After checking the logs I suspect that the issue may be due to an encoding issue with the path to the installed executable.
The last part of it looks like this (I have removed parts of my username but not all of it since I suspect it to be the main culprit):

2024-10-04 18:41:45.519 [REPO] Opening database for ReadWrite at 'C:\Users\Söder\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2024-10-04 18:41:45.519 [REPO] Opened SQLite Index with version [1.7], last write [2024-10-04 15:51:26.000]
2024-10-04 18:41:45.530 [REPO] Performing search: Query:[none] Include:PackageFamilyName='Ninja-build.Ninja'[Exact] Include:ProductCode='Ninja-build.Ninja'[Exact] Include:Id='Ninja-build.Ninja'[CaseInsensitive] Include:Name='Ninja-build.Ninja'[CaseInsensitive] Include:Moniker='Ninja-build.Ninja'[CaseInsensitive]
2024-10-04 18:41:45.532 [CORE] Reading cached file [C:\Users\OSKARS~1\AppData\Local\Temp\WinGet\cache\V2_PVD\Microsoft.Winget.Source_8wekyb3d8bbwe\packages\Ninja-build.Ninja\1c36c67c\versionData.mszyml]
2024-10-04 18:41:45.532 [CORE] PackageVersionDataManifest deserializing:
sV: 1.0
vD:
- v: 1.12.1
  rP: manifests/n/Ninja-build/Ninja/1.12.1/018c
  s256H: cdf3028adff6588fb1391fb6d3eea3967109fc734cb9017fa091884dfb4c1007
- v: 1.12.0
  rP: manifests/n/Ninja-build/Ninja/1.12.0/3c33
  s256H: b5c92fc8b10a71f528366de17145b547b796ae5e145dc329d3b3a6e5c0bb2b12
- v: 1.11.1
  rP: manifests/n/Ninja-build/Ninja/1.11.1/3c33
  s256H: a334433198e6f73c07cd53e0ef5b2b430ddbf85f372f5bceb497e5fa955c17fa

2024-10-04 18:41:45.532 [YAML] Detected UTF-8
2024-10-04 18:41:45.538 [REPO] Performing search: Query:[none] Filter:Id='Ninja-build.Ninja'[CaseInsensitive]
2024-10-04 18:41:45.539 [REPO] Finding installed package from available package using system reference search: Query:[none] Include:NormalizedNameAndPublisher='ninja'+'ninjabuild'[Exact]
2024-10-04 18:41:45.539 [REPO] Performing search: Query:[none] Include:NormalizedNameAndPublisher='ninja'+'ninjabuild'[Exact]
2024-10-04 18:41:45.540 [REPO] Performing search: Query:[none] Include:ProductCode='ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe'[Exact] Include:NormalizedNameAndPublisher='ninja'+'ninjabuild'[Exact]
2024-10-04 18:41:45.540 [CLI ] Search result size: 1
2024-10-04 18:41:45.540 [CLI ] Found one app. App id: Ninja-build.Ninja App name: ninja
2024-10-04 18:41:45.546 [REPO] Opening database for ReadWrite at 'C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe.db'
2024-10-04 18:41:45.547 [REPO] Opened Portable Index with version [1.0], last write [2024-10-04 15:51:26.000]
2024-10-04 18:41:45.659 [REPO] Opening database for ReadWrite at 'C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe.db'
2024-10-04 18:41:45.659 [REPO] Opened Portable Index with version [1.0], last write [2024-10-04 15:51:26.000]
2024-10-04 18:41:45.659 [REPO] Removing portable file [C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe]
2024-10-04 18:41:45.660 [REPO] Did not find a portable file with the path  { C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe }
2024-10-04 18:41:45.660 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\Schema\Portable_1_0\PortableIndexInterface_1_0.cpp(54)\WindowsPackageManager.dll!00007FFDC1EF5036: (caller: 00007FFDC1EC7738) Exception(1) tid(4878) 80070490 Element not found.

2024-10-04 18:41:45.660 [CLI ] Caught wil::ResultException: C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\Schema\Portable_1_0\PortableIndexInterface_1_0.cpp(54)\WindowsPackageManager.dll!00007FFDC1EF5036: (caller: 00007FFDC1EC7738) Exception(1) tid(4878) 80070490 Element not found.

2024-10-04 18:41:45.662 [CLI ] PortableUninstall uninstaller failed: 2147943568
2024-10-04 18:41:45.663 [CLI ] Terminating context: 0x8a150057 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UninstallFlow.cpp:1bd

So as you can see it complains about not being able to find C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe. The file does however exist (if you correct the encoding issue).

The entry in the sqlite database also does not seem to be faulty (or at least sqlite3.exe handles the encoding correctly):

 ❯ .\sqlite3.exe 'C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe.db'
SQLite version 3.46.1 2024-08-13 09:16:08 (UTF-16 console I/O)
Enter ".help" for usage hints.
sqlite> select * from portable;
C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe|1|68865c3276d449d746cea5065fdec2baf755d7813e161ab04205b0907b2629b8|
C:\Users\Söder\AppData\Local\Microsoft\WinGet\Links\ninja.exe|3||C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe

Steps to reproduce

(I do not have the ability to test this with any user account except for my own)

  1. Create a windows user with a name that contains nonascii characters
  2. Log in to the user and run winget install Ninja-build.Ninja
  3. Try to uninstall winget uninstall Ninja-build.Ninja

Expected behavior

Ninja-build.Ninja to be uninstalled.

Actual behavior

Found ninja [Ninja-build.Ninja]
Starting package uninstall...
An unexpected error occurred while executing the command:
0x80070490 : Element not found.
Uninstall failed with exit code: 0x80070490 : Element not found.

Environment

Windows Package Manager v1.8.1911
Windows: Windows.Desktop v10.0.22631.4169
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1911.0
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage Issue need to be triaged label Oct 4, 2024
@denelon denelon added Issue-Bug It either shouldn't be doing this or needs an investigation. Portable Issue related to portable package and removed Needs-Triage Issue need to be triaged labels Oct 4, 2024
@ahmad99wadi
Copy link

Brief description of your issue

When installing Ninja-build.Ninja on a new computer I accidentally did so without symlinks. So I was going to uninstall it in order to reinstall it with symlinks enabled. Which go me the following error message:

Found ninja [Ninja-build.Ninja]
Starting package uninstall...
An unexpected error occurred while executing the command:
0x80070490 : Element not found.
Uninstall failed with exit code: 0x80070490 : Element not found.

After checking the logs I suspect that the issue may be due to an encoding issue with the path to the installed executable. The last part of it looks like this (I have removed parts of my username but not all of it since I suspect it to be the main culprit):

2024-10-04 18:41:45.519 [REPO] Opening database for ReadWrite at 'C:\Users\Söder\AppData\Local\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\Microsoft.Winget.Source_8wekyb3d8bbwe\installed.db'
2024-10-04 18:41:45.519 [REPO] Opened SQLite Index with version [1.7], last write [2024-10-04 15:51:26.000]
2024-10-04 18:41:45.530 [REPO] Performing search: Query:[none] Include:PackageFamilyName='Ninja-build.Ninja'[Exact] Include:ProductCode='Ninja-build.Ninja'[Exact] Include:Id='Ninja-build.Ninja'[CaseInsensitive] Include:Name='Ninja-build.Ninja'[CaseInsensitive] Include:Moniker='Ninja-build.Ninja'[CaseInsensitive]
2024-10-04 18:41:45.532 [CORE] Reading cached file [C:\Users\OSKARS~1\AppData\Local\Temp\WinGet\cache\V2_PVD\Microsoft.Winget.Source_8wekyb3d8bbwe\packages\Ninja-build.Ninja\1c36c67c\versionData.mszyml]
2024-10-04 18:41:45.532 [CORE] PackageVersionDataManifest deserializing:
sV: 1.0
vD:
- v: 1.12.1
  rP: manifests/n/Ninja-build/Ninja/1.12.1/018c
  s256H: cdf3028adff6588fb1391fb6d3eea3967109fc734cb9017fa091884dfb4c1007
- v: 1.12.0
  rP: manifests/n/Ninja-build/Ninja/1.12.0/3c33
  s256H: b5c92fc8b10a71f528366de17145b547b796ae5e145dc329d3b3a6e5c0bb2b12
- v: 1.11.1
  rP: manifests/n/Ninja-build/Ninja/1.11.1/3c33
  s256H: a334433198e6f73c07cd53e0ef5b2b430ddbf85f372f5bceb497e5fa955c17fa

2024-10-04 18:41:45.532 [YAML] Detected UTF-8
2024-10-04 18:41:45.538 [REPO] Performing search: Query:[none] Filter:Id='Ninja-build.Ninja'[CaseInsensitive]
2024-10-04 18:41:45.539 [REPO] Finding installed package from available package using system reference search: Query:[none] Include:NormalizedNameAndPublisher='ninja'+'ninjabuild'[Exact]
2024-10-04 18:41:45.539 [REPO] Performing search: Query:[none] Include:NormalizedNameAndPublisher='ninja'+'ninjabuild'[Exact]
2024-10-04 18:41:45.540 [REPO] Performing search: Query:[none] Include:ProductCode='ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe'[Exact] Include:NormalizedNameAndPublisher='ninja'+'ninjabuild'[Exact]
2024-10-04 18:41:45.540 [CLI ] Search result size: 1
2024-10-04 18:41:45.540 [CLI ] Found one app. App id: Ninja-build.Ninja App name: ninja
2024-10-04 18:41:45.546 [REPO] Opening database for ReadWrite at 'C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe.db'
2024-10-04 18:41:45.547 [REPO] Opened Portable Index with version [1.0], last write [2024-10-04 15:51:26.000]
2024-10-04 18:41:45.659 [REPO] Opening database for ReadWrite at 'C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe.db'
2024-10-04 18:41:45.659 [REPO] Opened Portable Index with version [1.0], last write [2024-10-04 15:51:26.000]
2024-10-04 18:41:45.659 [REPO] Removing portable file [C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe]
2024-10-04 18:41:45.660 [REPO] Did not find a portable file with the path  { C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe }
2024-10-04 18:41:45.660 [FAIL] C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\Schema\Portable_1_0\PortableIndexInterface_1_0.cpp(54)\WindowsPackageManager.dll!00007FFDC1EF5036: (caller: 00007FFDC1EC7738) Exception(1) tid(4878) 80070490 Element not found.

2024-10-04 18:41:45.660 [CLI ] Caught wil::ResultException: C:\__w\1\s\external\pkg\src\AppInstallerRepositoryCore\Microsoft\Schema\Portable_1_0\PortableIndexInterface_1_0.cpp(54)\WindowsPackageManager.dll!00007FFDC1EF5036: (caller: 00007FFDC1EC7738) Exception(1) tid(4878) 80070490 Element not found.

2024-10-04 18:41:45.662 [CLI ] PortableUninstall uninstaller failed: 2147943568
2024-10-04 18:41:45.663 [CLI ] Terminating context: 0x8a150057 at C:\__w\1\s\external\pkg\src\AppInstallerCLICore\Workflows\UninstallFlow.cpp:1bd

So as you can see it complains about not being able to find C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe. The file does however exist (if you correct the encoding issue).

The entry in the sqlite database also does not seem to be faulty (or at least sqlite3.exe handles the encoding correctly):

 ❯ .\sqlite3.exe 'C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja-build.ninja_microsoft.winget.source_8wekyb3d8bbwe.db'
SQLite version 3.46.1 2024-08-13 09:16:08 (UTF-16 console I/O)
Enter ".help" for usage hints.
sqlite> select * from portable;
C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe|1|68865c3276d449d746cea5065fdec2baf755d7813e161ab04205b0907b2629b8|
C:\Users\Söder\AppData\Local\Microsoft\WinGet\Links\ninja.exe|3||C:\Users\Söder\AppData\Local\Microsoft\WinGet\Packages\Ninja-build.Ninja_Microsoft.Winget.Source_8wekyb3d8bbwe\ninja.exe

Steps to reproduce

(I do not have the ability to test this with any user account except for my own)

  1. Create a windows user with a name that contains nonascii characters
  2. Log in to the user and run winget install Ninja-build.Ninja
  3. Try to uninstall winget uninstall Ninja-build.Ninja

Expected behavior

Ninja-build.Ninja to be uninstalled.

Actual behavior

Found ninja [Ninja-build.Ninja]
Starting package uninstall...
An unexpected error occurred while executing the command:
0x80070490 : Element not found.
Uninstall failed with exit code: 0x80070490 : Element not found.

Environment

Windows Package Manager v1.8.1911
Windows: Windows.Desktop v10.0.22631.4169
System Architecture: X64
Package: Microsoft.DesktopAppInstaller v1.23.1911.0

@denelon
Copy link
Contributor

denelon commented Oct 8, 2024

@Natr1x we're about to cut our first WinGet 1.9 Release Candidate build. When that is available, I'll try to remember to check in to see if this issue is resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Portable Issue related to portable package
Projects
None yet
Development

No branches or pull requests

3 participants