Romanitho/Winget-AutoUpdate

[Bug]: some packages that were installed with --scope=machine are removed and installed in user context during update

mmehnert opened this issue · 7 comments

The problem

I noticed this so far with the Anaconda.Anaconda3 package.

I installed it with --scope=machine and it got installed correctly into %ProgramData%\anaconda3.

When the automatic update happens, the packages gets uninstalled and reinstalled into the Administrator account.

Alternatively, the installation fails and the package is missing from the machine.

So far, I had to manually reinstall it whenever an update became available.

The log attached is for a failed automatic re-installation.

What version of WAU has the issue?

latest

What version of Windows are you using (ex. Windows 11 22H2)?

Windows 10 22H2

What version of winget are you using?

v1.6.3133

Log information

10:25:23 - Updating Anaconda3 2023.09-0 (Python 3.11.5 64-bit) from 2023.09-0 to 2023.09...
10:25:27 - ##########   WINGET UPGRADE PROCESS STARTS FOR APPLICATION ID 'Anaconda.Anaconda3'   ##########
10:25:27 - -> Running: Winget upgrade --id Anaconda.Anaconda3 --accept-package-agreements --accept-source-agreements -h


  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1024 KB / 8.26 MB
  ███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 8.26 MB
  ██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  3.00 MB / 8.26 MB
  ██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  4.00 MB / 8.26 MB
  ██████████████████▒▒▒▒▒▒▒▒▒▒▒▒  5.00 MB / 8.26 MB
  █████████████████████▒▒▒▒▒▒▒▒▒  6.00 MB / 8.26 MB
  █████████████████████████▒▒▒▒▒  7.00 MB / 8.26 MB
  █████████████████████████████▒  8.00 MB / 8.26 MB
  ██████████████████████████████  8.26 MB / 8.26 MB

Found Anaconda3 [Anaconda.Anaconda3] Version 2023.09
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Downloading https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Windows-x86_64.exe



  ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  0.00 B / 1.02 GB
  █▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  56.0 MB / 1.02 GB
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   132 MB / 1.02 GB
  ██████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   214 MB / 1.02 GB
  ████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   303 MB / 1.02 GB
  ███████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   391 MB / 1.02 GB
  ████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   443 MB / 1.02 GB
  █████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   479 MB / 1.02 GB
  ██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒   512 MB / 1.02 GB
  ████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒   570 MB / 1.02 GB
  ██████████████████▒▒▒▒▒▒▒▒▒▒▒▒   636 MB / 1.02 GB
  ████████████████████▒▒▒▒▒▒▒▒▒▒   698 MB / 1.02 GB
  █████████████████████▒▒▒▒▒▒▒▒▒   763 MB / 1.02 GB
  ███████████████████████▒▒▒▒▒▒▒   829 MB / 1.02 GB
  █████████████████████████▒▒▒▒▒   892 MB / 1.02 GB
  ███████████████████████████▒▒▒   958 MB / 1.02 GB
  █████████████████████████████▒  1.00 GB / 1.02 GB
  ██████████████████████████████  1.02 GB / 1.02 GB
Successfully verified installer hash
Starting package uninstall...

Successfully uninstalled
Starting package install...

Installer failed with exit code: 2
10:26:18 - ##########   WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID 'Anaconda.Anaconda3'   ##########

Additional information

No response

I followed the ID to manifest repo on winget-pkgs manifest repo and checked the command line switches.
install switches
It seems that installer waits for user interaction with that weird popup.
image
After I closed it the usual wizard showed up.

Anaconda3 is a nullsoft installation (takes /S as a silent switch)

Install via Winget-Install as System:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "[PATH_TO_FILE]\winget-install.ps1" -AppIDs "Anaconda.Anaconda3 --override \"/InstallationType=AllUsers /AddToPath=1 /RegisterPython=1 /S\""

Update via WAU as System:
Put a Anaconda.Anaconda3-override.txt under the mods directory containing:
/InstallationType=AllUsers /AddToPath=1 /RegisterPython=1 /S

That's the best I can do trying to fix this application problem...
It still fails when WAU runs winget with upgrade, but then when trying with install it gets installed:

Found Anaconda3 [Anaconda.Anaconda3] Version 2023.09
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package uninstall...
Successfully uninstalled
Starting package install...
Installer failed with exit code: 2
01:25:05 - -> An upgrade for Anaconda3 2023.07-0 (Python 3.11.3 64-bit) failed, now trying an install instead...
01:25:05 - -> Running (overriding default): Winget install --id Anaconda.Anaconda3 -e --accept-package-agreements --accept-source-agreements -s winget --force --override /InstallationType=AllUsers /AddToPath=1 /RegisterPython=1 /S
  ███▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  1024 KB / 8.40 MB
  ███████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  2.00 MB / 8.40 MB
  ██████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  3.00 MB / 8.40 MB
  ██████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒  4.00 MB / 8.40 MB
  █████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒  5.00 MB / 8.40 MB
  █████████████████████▒▒▒▒▒▒▒▒▒  6.00 MB / 8.40 MB
  ████████████████████████▒▒▒▒▒▒  7.00 MB / 8.40 MB
  ████████████████████████████▒▒  8.00 MB / 8.40 MB
  ██████████████████████████████  8.40 MB / 8.40 MB
Found Anaconda3 [Anaconda.Anaconda3] Version 2023.09
This application is licensed to you by its owner.
Microsoft is not responsible for, nor does it grant any licenses to, third-party packages.
Successfully verified installer hash
Starting package install...
Successfully installed
01:33:23 - ##########   WINGET UPGRADE PROCESS FINISHED FOR APPLICATION ID 'Anaconda.Anaconda3'   ##########
01:33:23 - Anaconda3 2023.07-0 (Python 3.11.3 64-bit) updated to 2023.09 !
01:33:26 - Microsoft Edge : Skipped upgrade because it is in the excluded app list
01:33:26 - 1 apps updated ! No more update.

wow, thanks @KnifMelti for detailed troubleshoot.

Thanks a lot!

This issue is stale because it has been open for 30 days with no activity.

This issue was closed because it has been inactive for 14 days since being marked as stale.