marticliment / UniGetUI

UniGetUI: The Graphical Interface for your package managers. Could be terribly described as a package manager manager to manage your package managers
https://www.marticliment.com/unigetui/
MIT License
12.38k stars 425 forks source link

[BUG] Winget Source reset + refresh broken - show return codes on log #1683

Closed iqbalrazi03 closed 8 months ago

iqbalrazi03 commented 9 months ago

Please confirm these before moving forward

Describe your issue

I'm a newbie on this package manager stuff. I'm trying to find something that can help me update all of my programs. I found WingetUI, and I also have some basic with winget. Updating my apps using the command-line winget works fine, but I can't update it using WingetUI.

Steps to reproduce the issue

No response

WingetUI Log

🟢 Using cached lang file
🟡 Using bundled lang file (forced=True)
🔵 It took 0.0 to load all language files
🟢 checkQueue Thread started!
🔵 Found default chocolatey installation on expected location
---------------------------------------------------------------------------------------------------

   WingetUI version 2.2.0 (version number 2.2) log
   All modules loaded successfully and sys.stdout patched correctly, starting main script
   Translator function language set to "en"

---------------------------------------------------------------------------------------------------

 Log legend:
 🔵: Verbose
 🟢: Information
 🟡: Warning
 🟠: Handled unexpected exception
 🔴: Unhandled unexpected exception

🔵 Language file up-to-date
🔵 Starting main application...
🔵 Looking for alive instances...
🔵 Starting API with random session authentication token 18562be53f3ab9bf2488cc66b015bd041762393fda0eb1e59e5d1f9394d3796d
🟡 Found lock file(s), reactivating...
🔵 Loading WingetUI AUMID...
🔵 Starting update check
🔴  Traceback (most recent call last):

🔴  Traceback (most recent call last):

🔴    File ".\Interface\Application.py", line 222, in getAUMID

🔴    File ".\Interface\Application.py", line 222, in getAUMID

🔴  IndexError: list index out of range

🔴  IndexError: list index out of range

🔴 Note this traceback was caught by reporter and has been added to the log (list index out of range)
🔵 Version URL: https://www.marticliment.com/versions/wingetui.ver
🟢 Updates not found
🟢 Downloaded latest metadata to local file from url https://raw.githubusercontent.com/marticliment/WingetUI/main/WebBasedData/screenshot-database-v2.json
🔵 Loaded metadata from local file
🔵 Reactivation signal ignored: RaiseWindow_[1704367124.6662507]
{'sudoFound': True, 'sudoVersion': '', 'WingetFound': False, 'WingetVersion': 'Winget is disabled', 'ScoopFound': False, 'ScoopVersion': 'Scoop is disabled', 'PipFound': False, 'PipVersion': 'Pip is disabled', 'NpmFound': False, 'NpmVersion': 'Npm is disabled', 'PowerShellFound': True, 'PowerShellVersion': '', '.NET ToolFound': True, '.NET ToolVersion': '', 'ChocolateyFound': True, 'ChocolateyVersion': ''}
🔵 Reached main ui load milestone
🟢 Discover tab loaded successfully
🟢 Total packages: 0
🟢 Update tab loaded successfully
🔵 Reloading sources...
🔵 Reloading Winget sources...
🔵 Reloading sources...
🔵 Reloading Winget sources...
🟢 Searching for string ""
🔵 Reloading sources...
🔵 Reloading Winget sources...
🟢 Uninstall tab loaded successfully
🔵 Starting Chocolatey search for installed packages
🔵 Starting .NET Tool search for installed packages
🔵 Starting PowerShell search for installed packages
🟢 Searching for string ""
🔵 Reloading Scoop sources...
🔵 Reloading Scoop sources...
🔵 Reloading Scoop sources...
🟢 .NET Tool search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting .NET Tool search for installed packages
🟢 Chocolatey search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting Chocolatey search for installed packages
🟢 PowerShell search for installed packages finished with 0 result(s)
🔵 Starting Winget source search...
🔵 Starting Scoop source search...
🔵 Starting Chocolatey source search...
🔵 Starting PowerShell source search...
🟢 Settings tab loaded!
🟢 Chocolatey search for installed packages finished with 0 result(s)
🟢 .NET Tool search for installed packages finished with 0 result(s)
🔵 Starting Chocolatey search for updates
🔵 Starting .NET Tool search for updates
🟡 Installing dotnet-tools-outdated, that was missing...
🟢 Winget source search finished with 0 sources
🟢 About tab loaded!
🟢 Scoop source search finished with 0 sources
🟢 PowerShell source search finished with 0 sources
🟢 Chocolatey source search finished with 0 sources
🟢 Chocolatey search for updates finished with 0 result(s)
🔵 Starting PowerShell source search...
[]
🟢 PowerShell source search finished with 0 sources
🔵 Starting PowerShell search for updates
🟢 .NET Tool search for updates finished with 0 result(s)
🟢 Main application loaded...
🟢 PowerShell search for updates finished with 0 result(s)
🔵 Starting Chocolatey search for installed packages
🔵 Starting .NET Tool search for installed packages
🔵 Starting PowerShell search for installed packages
🟢 Searching for string ""
🟢 Total packages: 0
🟢 Total packages: 0
🟢 Total packages: 0
🟢 Searching for string ""
Traceback (most recent call last):
  File ".\Interface\CustomWidgets\InstallerWidgets.py", line 669, in <lambda>
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
  File ".\Interface\CustomWidgets\InstallerWidgets.py", line 669, in <lambda>
TypeError: 'NoneType' object is not callable
🟢 Searching for string ""
🟢 Searching for string ""
🟢 Searching for string ""
🟢 Searching for string ""
🟡 Can't get custom interval time! (got value was '')
🟢 Total packages: 0
🟢 PowerShell search for installed packages finished with 0 result(s)
🟢 Chocolatey search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting Chocolatey search for installed packages
🟢 .NET Tool search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting .NET Tool search for installed packages
🟢 .NET Tool search for installed packages finished with 0 result(s)
🟢 Searching for string ""
🟢 Searching for string ""
🟡 Can't get custom interval time! (got value was '')
🟢 Total packages: 0
🟢 Searching for string ""
🟢 Searching for string ""
🟡 Can't get custom interval time! (got value was '')
🟢 Total packages: 0
🟢 Searching for string ""
🟢 Searching for string ""
🟢 Chocolatey search for installed packages finished with 0 result(s)
🟢 Searching for string ""
🟢 Searching for string ""
🟢 Total packages: 0
🔵 Starting Winget source search...
🔵 Starting Scoop source search...
🔵 Starting Chocolatey source search...
🔵 Starting PowerShell source search...
Traceback (most recent call last):
  File ".\Interface\CustomWidgets\InstallerWidgets.py", line 669, in <lambda>
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
  File ".\Interface\CustomWidgets\InstallerWidgets.py", line 669, in <lambda>
TypeError: 'NoneType' object is not callable
🟢 Winget source search finished with 0 sources
🟢 Chocolatey source search finished with 0 sources
🟢 Scoop source search finished with 0 sources
🟢 PowerShell source search finished with 0 sources
🔵 Announcement URL: https://www.marticliment.com/resources/wingetui.announcement
🔵 Image URL: https://www.marticliment.com/resources/wingetui.png

🔵 Starting Winget source search...
🟢 Winget source search finished with 0 sources
🔵 Loading WingetUI log...
🔵 Starting Winget source search...
🟢 Winget source search finished with 0 sources
🔵 Announcement URL: https://www.marticliment.com/resources/wingetui.announcement
🔵 Image URL: https://www.marticliment.com/resources/wingetui.png
🟢 Waiting for install permission... title=msstore, id=msstore, installId=1704367587.286553
🔵 Given package: <Package: msstore;msstore;;Winget;<wingetui.PackageEngine.Managers.winget.WingetPackageManager object at 0x0000020124BE3E50>;<wingetui.Interface.CustomWidgets.SpecificWidgets.PackageItem object at 0x0000020140D84D00>>
🔵 Installation options: <InstallationOptions: SkipHashCheck=False;InteractiveInstallation=False;RunAsAdministrator=False;Version=;Architecture=;InstallationScope=;CustomParameters=[];RemoveDataOnUninstall=False>
🔵 Found icon:  
🟡 Icon url empty
🟡 Icon  not found in json (KeyError)
🟡 Icon for msstore does not exist
🔵 Current program set to 1704367587.286553
🟢 Have permission to install, starting installation threads...
🔵 Starting source msstore installation with Command ['C:\\Program Files\\WingetUI\\wingetui\\components\\gsudo.exe', 'C:\\Program Files\\WingetUI\\wingetui\\PackageEngine/Managers\\winget-cli_x64\\winget.exe', 'source', 'add', '--name', 'msstore', '--arg', 'https://storeedgefd.dsx.mp.microsoft.com/v9.0', '--accept-source-agreements', '--disable-interactivity']
['']
🔵 Starting Winget source search...
Exception ignored in: <function BaseWindowsToaster.show_toast.<locals>.<lambda> at 0x000002013E32F4C0>
Traceback (most recent call last):
  File "windows_toasts\toasters.py", line 147, in <lambda>
  File ".\Interface\CustomWidgets\GenericWidgets.py", line 738, in <lambda>
TypeError: ToastNotification.reportException() missing 1 required positional argument: 'id'
🟢 Winget source search finished with 0 sources
🔵 Loading WingetUI log...
🔵 Starting update check
🔵 Version URL: https://www.marticliment.com/versions/wingetui.ver
🟢 Updates not found
🔵 Saving log...
🔵 Loading WingetUI log...
🟢 log saved successfully
🔵 Starting update check
🔵 Version URL: https://www.marticliment.com/versions/wingetui.ver
🟢 Updates not found
🟢 Found reactivation lock file...
🔵 Loading WingetUI log...
🔵 Starting Winget search for installed packages
🔵 Starting Chocolatey search for installed packages
🔵 Starting .NET Tool search for installed packages
🔵 Starting PowerShell search for installed packages
🟢 Searching for string ""
🔵 Loading WingetUI log...
🟢 PowerShell search for installed packages finished with 0 result(s)
🟢 Searching for string ""
🟢 Chocolatey search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting Chocolatey search for installed packages
🟢 Winget search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting Winget search for installed packages
🟢 .NET Tool search for installed packages finished with 0 result(s)
🟠 Chocolatey got too few installed packages, retrying
🔵 Starting .NET Tool search for installed packages
🟢 Chocolatey search for installed packages finished with 0 result(s)
🟢 Searching for string ""
🟢 Winget search for installed packages finished with 0 result(s)
🟢 Searching for string ""
🟢 .NET Tool search for installed packages finished with 0 result(s)
🟢 Searching for string ""
🟢 Searching for string ""
🟢 Total packages: 0
🔵 Copying log to the clipboard...
🔵 Loading WingetUI log...
🟢 Log copied to the clipboard successfully!
🔵 Copying log to the clipboard...
🔵 Loading WingetUI log...

Package Managers Logs

Outputs from package managers on the current session:
 -------dotnet

---------Chocolatey------------------Chocolatey-------dotnet

---------Chocolatey

--------dotnet
---------------------------Chocolatey-------dotnet

-------dotnet

---------Chocolatey------------------Chocolatey---------Winget

-------dotnet

---------Chocolatey
---------Winget

-------dotnet

-------dotnet

---------Chocolatey
---------Winget---------

-------dotnet

---------Chocolatey
---------Winget

Relevant information

No response

Screenshots and videos

No response

marticliment commented 9 months ago

Hello,

How did you install WingetUI? Which Windows version are you using?

iqbalrazi03 commented 9 months ago

Hi, I'm currently using Windows 11 Home version 22621.2715 . I install WingetUI through the installer.

marticliment commented 9 months ago

I will study this

HarryLime1120 commented 9 months ago

Hi, I have the same issue, but probably because of totally different root cause.

Would it help to check for the return code of winget.exe and/or print it into the logfile? Hopefully I am looking at the correct section of the code: def getSources(self) in winget.py ?

I have the situation that C:\Program Files\WingetUI\wingetui\PackageEngine/Managers\winget-cli_x64\winget.exe stopped working for a non-admin user. If I open command window as non-admin I get zero output and the following return code: C:>"C:\Program Files\WingetUI\wingetui\PackageEngine/Managers\winget-cli_x64\winget.exe" C:>echo %errorlevel% -1978335231

According to https://github.com/microsoft/winget-cli/blob/master/doc/windows/package-manager/winget/returnCodes.md it means APPINSTALLER_CLI_ERROR_INTERNAL_ERROR Internal Error

iqbalrazi03 commented 9 months ago

Please do. Thanks!

marticliment commented 9 months ago

Will do

iqbalrazi03 commented 9 months ago

Additional information :-

I installed Chocolatey as a backup option to use in WingetUI, but the results are as same as using winget. On the other side, I tried using the command-line version of it, and it came out fine. The issue is the same as the winget problem that I mentioned above.

llvs commented 9 months ago

Although this somehow is a me-too posting, I observe the exact same behaviour as in the comment of HarryLime1120 above, I have the same $LASTEXITCODE in Powershell. Winget (2.2.0) worked in the beginning and did its updates but somehow lost it along the way. Initially, I didn't have the Windows-winget.exe installed (only the winget that ships with WingetUI) but installed the MS msixbundle when things were broken (hoping that it would fix it, which it didn't). I then even replaced the winget.exe in the WingetUI subfolder with the one that comes from Windows but that didn't change anything (but the files were not bitidentical beforehand). Starting the WingetUI-winget.exe as administrator in the command line works as well as starting WingetUI as administrator.

What is puzzling is, that starting the Windows-winget.exe as non-administrator does work and shows an update list but WingetUI (as non-administrator) does not show that update list I can see in the command line even with the experimental setting "use Windows winget" activated! I also disabled all other sources (Scoop, Choco etc.) but it didn't help.

I downgraded from 2.2.0 to 2.1.1 but that also didn't change anything. Using 2.2.0 seemingly broke something very fundamental.

Reinstalling the official Windows-winget msixbundle did not help either. Several reinstalls of WingetUI didn't change anything and all "reset settings" options within WingetUI didn't change the behaviour.

So the root causes are that the wingetUI-winget.exe as non-admin always returns with error and that wingetUI seems unable to properly connect to the Windows-winget.exe to obtain its update list from there. Neither WingetUI 2.2.0 nor 2.2.1 show an update list as non-administrator (no matter if using Windows-winget or WingetUI-winget).

ppvnf commented 8 months ago

there is a problem with the path used by WingetUI the correct path for Winget executable is "C:\Program Files\WingetUI\PackageManagers\winget-cli_x64\winget.exe", but this is the error I get: Screenshot 2024-01-20 163106 Strangely the path for Winget executable that is shown on the GUI is "C:\Program Files\WingetUI\wingetui\PackageEngine\Managers\winget-cli_x64\winget.exe" So it appears I have two Winget executables from WingetUI somehow

marticliment commented 8 months ago

Winget-cli folders were moved but changes were not reflexted on the reset sources script.

iqbalrazi03 commented 8 months ago

Hi. Sorry to bother. Is there any updates on my issue? Not that I force you investigating my problem though. Thanks.

marticliment commented 8 months ago

Please try this solution: https://github.com/marticliment/WingetUI/issues/1721

iqbalrazi03 commented 8 months ago

done. it's working now. thanks

llvs commented 8 months ago

I found damaged databases also in these additional (similar) folders: C:\Users\<ADMIN-USER>\AppData\Local\Temp\WinGet\defaultState\ C:\Users\<NON-ADMIN-USER>\AppData\Local\Temp\WinGet\defaultState\

Deleting the second one from the non-admin user seems to have fixed it now for me. I will keep investigating, but the first look is very promising. Maybe HarryLime1120 can also check if it works for him?

marticliment commented 8 months ago

Perfect!

llvs commented 8 months ago

The same fix works also on the Win11 machine! So watch out for the TEMP folder.

iqbalrazi03 commented 8 months ago

Perfect!

thanks a lot man! now I can rest easy

marticliment commented 8 months ago

I can rest now too, I genuinely did not understand what was happening.

llvs commented 8 months ago

I probably had killed WingetUI via the task manager at some point and the remaining temp files created the problems.

iqbalrazi03 commented 8 months ago

forgot to mention before, my command prompt at that time are kinda broken, so maybe it was one of the factors.

llvs commented 8 months ago

@iqbalrazi03 It was not entirely clear to me, but is your problem now also fixed by the deletion of the temp folder?

iqbalrazi03 commented 8 months ago

@iqbalrazi03 It was not entirely clear to me, but is your problem now also fixed by the deletion of the temp folder?

yeah. don't know what happened, it just works.

llvs commented 8 months ago

I think then you can close this issue also @marticliment 💪 😄 👍

HarryLime1120 commented 8 months ago

I found damaged databases also in these additional (similar) folders: C:\Users\<ADMIN-USER>\AppData\Local\Temp\WinGet\defaultState\ C:\Users\<NON-ADMIN-USER>\AppData\Local\Temp\WinGet\defaultState\

Deleting the second one from the non-admin user seems to have fixed it now for me. I will keep investigating, but the first look is very promising. Maybe HarryLime1120 can also check if it works for him?

Hi @llvs, thanks for considering my situation! It did not work for me. In the end I deleted defaultState Directory both non-admin and admin, then \AppData\Local\Temp\WinGet\ both non-admin and admin.

But not a problem. I am currently running WingetUI from python source with a mod for german OS and WingetUI in experimental mode "system-winget".

marticliment commented 8 months ago

@HarryLime1120, out of curiosity, is the mod you are using published online?

llvs commented 8 months ago

Interesting. But as the behavior is so similar with the same error code, you may want to check if there is even a third location where (temporary) WinGet\defaultState files are located.

HarryLime1120 commented 8 months ago

@marticliment > @HarryLime1120, out of curiosity, is the mod you are using published online? Yes: in https://github.com/HarryLime1120/WingetUI/tree/system_winget_all_lang As discussed in https://github.com/marticliment/WingetUI/issues/1705 "[ENHANCEMENT] system winget - support all languages"

For this ticket: I created a version with logging. Code can be found here: https://github.com/HarryLime1120/WingetUI/tree/log_winget_return_code It creates this log entry: image I have included a lookup from number to text. I used the defines from winget AppInstallerErrors.h

Out of the scope of this ticket (logging only), i did a quick experiment adding a dummy package in case of error: packages.append(UpgradablePackage(exitText,"ERROR", "?", "0", "winget", Winget)) image This gives the user an instant indication that something is wrong instead of "Hooray! No updates were found!" For sure the experiment has side-effects, like the message box...

llvs commented 2 months ago

Maybe the folder ownership change to an admin user is relevant here: Related issue