Skip to content

Fix WinGet getting corrupted on devices with non-admin accounts #3255

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

Merged
merged 3 commits into from
Feb 4, 2025

Conversation

marticliment
Copy link
Owner

  • Redirect WinGet temp folder when running elevated, so it does not change ACLs on %temp%\WinGet, and then it stops working due to incorrect permissions. This would only happen when UniGetUI was running from a local account, and different credentials of a different account were provided to Elevator/GSudo.

  • Wait for an internet connection before loading package lists. This condition also triggered the WinGet corruption banner.

@llvs
Copy link

llvs commented Feb 5, 2025

Sounds great. Looking forward to testing it!

@Jolly1304
Copy link

Thanks for fixing this issue. It happened to me also running UniGetUI in a domain environment.

@DrStrange
Copy link

Thank you for fixing this long standing and annoying bug.

@marticliment
Copy link
Owner Author

The fix should be live now on 3.1.6. I would appreciate if you could confirm that it is no longer happening on your machines. (Please note that if WinGet was already corrupted you will need to fix this before)

@llvs
Copy link

llvs commented Feb 7, 2025

To me, it mainly works. That means, that the WinGet store gets no longer corrupted, which is great!
However, it failed to update Git. I wanted a batch update with the option activated to ask only once for admin rights per batch.
In contrast when I ran winget update Git.Git in the powershell command line, it succeeded. So UniGetUI does still not accomplish everything that is possible on the WinGet CLI. Or maybe UniGetUI then wants to install everything with admin rights, even if it only a user-installed app? Here is the log of the failed UniGetUI attempt:

Package update operation for Package=Git.Git with Manager=Winget
Installation options: <InstallationOptions: SkipHashCheck=False;InteractiveInstallation=False;RunAsAdministrator=False;Version=;Architecture=;InstallationScope=;InstallationScope=;CustomParameters=;RemoveDataOnUninstall=False>
Executing process with StartInfo:
 - FileName: "C:\Program Files\WingetUI\Assets\Utilities\gsudo.exe"
 - Arguments: ""C:\Users\username\AppData\Local\Microsoft\WindowsApps\winget.exe"  update --id "Git.Git" --exact --source winget --accept-source-agreements --disable-interactivity --silent --include-unknown --accept-package-agreements --force"
Start Time: "07.02.2025 07:57:28"
Es wurde kein installiertes Paket gefunden, das den Eingabekriterien entspricht.
End Time: "07.02.2025 07:57:33"
Process return value: "-1978335212" (0x8A150014)

And this is the successful CLI update. Funnily it said that it would ask for admin rights and that a prompt would be coming up, but I was not asked for admin credentials.

Download läuft https://github.com/git-for-windows/git/releases/download/v2.47.1.windows.2/Git-2.47.1.2-64-bit.exe
  ██████████████████████████████  65.8 MB / 65.8 MB
Der Installer-Hash wurde erfolgreich überprüft
Paketinstallation wird gestartet...
Das Installationsprogramm fordert die Ausführung als Administrator an. Es wird eine Eingabeaufforderung erwartet.
Erfolgreich installiert

@marticliment
Copy link
Owner Author

Whenever WinGet reports that the installer may require administrator rights, or that the installer will install system-wide, UniGetUI will elevate the operation, as chances are you would be still prompted for UAC. If git is the only affected package, perhaps there is an issue with how git is reporting to winget, not allowing it to properly upgrade.

@llvs
Copy link

llvs commented Feb 7, 2025

Yes, it may totally be wrong reporting of the installer. My impression was that about 40% of the installs failed, but that may have other reasons as well like not being updateable if the original install was not by WinGet. Let's wait for more reports of other users. It could as well be fixed now from the UniGetUI side.

@Jolly1304
Copy link

Jolly1304 commented Feb 11, 2025

The fix should be live now on 3.1.6. I would appreciate if you could confirm that it is no longer happening on your machines. (Please note that if WinGet was already corrupted you will need to fix this before)

it is producing the same issue. i did clic the fix it button banner. but the banner kept showing up.

tried installing it in local account mode but still complains there is a winget malfunction detected
next the UAC prompt shows up. I enter admin creentials, restart unigetui. same message

@marticliment
Copy link
Owner Author

@Coach8806, please delete a folder named WinGet under your temp folder.

@Jolly1304
Copy link

@Coach8806, please delete a folder named WinGet under your temp folder.

that fixed it

@estroger34
Copy link

I am unable to update any packages with winget on 3.1.6. Always get the below error message.

I deletet the winget folder under temp, but no success. I uninstalled unigetui, then re-installed via microsoft store. Somehow I got version 3.1.5 and in this one everything worked well. After closing it, however, version 3.1.6 was automatically installed and now I am back to the error...

Error message:
Package update operation for Package=Adobe.Acrobat.Reader.64-bit with Manager=Winget
Installation options: <InstallationOptions: SkipHashCheck=False;InteractiveInstallation=False;RunAsAdministrator=False;Version=;Architecture=;InstallationScope=;InstallationScope=;CustomParameters=;RemoveDataOnUninstall=False>
Executing process with StartInfo:

  • FileName: "C:\Program Files\UniGetUI\Assets\Utilities\UniGetUI Elevator.exe"
  • Arguments: ""C:\Users...AppData\Local\Microsoft\WindowsApps\winget.exe" update --id "Adobe.Acrobat.Reader.64-bit" --exact --source winget --accept-source-agreements --disable-interactivity --silent --include-unknown --accept-package-agreements --force --architecture x64"
    Start Time: "14/02/2025 18:35:34"
    Fehler beim Öffnen der Quelle(n): Probieren Sie den Befehl "source reset" aus, wenn das Problem weiterhin besteht.
    Unerwarteter Fehler beim Ausführen des Befehls:
    0x8a15000f : Von der Quelle benötigte Daten fehlen
    End Time: "14/02/2025 18:35:57"
    Process return value: "-1978335217" (0x8A15000F)
    Adobe Acrobat Reader (64-bit) konnte nicht aktualisiert werden

@marticliment
Copy link
Owner Author

@estroger34,

Please delete the folder on %temp%\UniGetUI, and never run UniGetUI as admin and see if this works

@estroger34
Copy link

Thanks, but it still does not work.

I've deleted both winget and unigetui temp folder, started UniGetUI by a simple double-click and still get the same error message.

I'm on Win 11 Pro Version 10.0.26100 Build 26100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment