Closed MajorGlory86 closed 1 year ago
How Did You Get This To Happen?
choco upgrade chocolatey --verbose
Can you provide the full set of steps to allow us to reproduce this? I upgraded to 2.1.0 from 2.0.0 yesterday and it worked, using that command.
I just ran "choco upgrade chocolatey --verbose". I guess it's some kind of bug that occurs when you have chromium installed.
So the steps would be:
@MajorGlory86 thanks for the tip but it didn't work for me. I tried uninstalling chromium but that didn't help either.
What did work was running:
choco upgrade chocolatey --verbose
whereas running the simpler command:
choco upgrade chocolatey
appeared to do nothing no matter how long I waited.
Thanks to everyone else for helping get this sorted. It's been more than a tad frustrating for a while now to hit the brick wall.
I had this issue upgrading from 2.0.0 to the 2.1.0 alpha and from the alpha to the 2.1.0 release.
I reproduced it by:
git clean -fdx
.\build.bat
to create required files.\choco.exe install chocolatey --version=2.1.0-alpha-20230614 --skip-powershell
using the debug visual studio build of choco.exe
.\choco.exe install chromium --skip-powershell
.\choco.exe upgrade chocolatey --pre --verbose --skip-powershell
The --skip-powershell
arguments are required for this reproduction, as they allow chocolatey
to act as an arbitrary package, and keep the debug choco.exe
in the folder. As the git directory was cleaned, the configuration and sources are default.
This does appear to hang, but it does complete eventually, after maybe a half hour (and a gigantic number of requests).
@TheCakeIsNaOH thanks for that detail. I dare say your point about waiting long enough is the key.
I managed to reproduce it in a virtual machine with these steps:
And yes, after waiting long enough it will continue but it shows the following warning.
2023-07-03 08:45:44,451 5344 [WARN ] - [NuGet] One or more unresolved package dependency constraints detected in the Chocolatey lib folder. All dependency constraints must be resolved to add or update packages. If these packages are being updated this message may be ignored, if not the following error(s) may be blocking the current package operation: 'chromium 114.0.5735.199 constraint: chocolatey (>= 0.10.5)' 2023-07-03 08:45:44,518 5344 [INFO ] - [NuGet] Resolving dependency information took 0 ms 2023-07-03 08:45:44,518 5344 [DEBUG] - Running beforeModify step for 'chocolatey' 2023-07-03 08:45:44,531 5344 [DEBUG] - Backing up package files for 'chocolatey' 2023-07-03 08:45:44,595 5344 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\lib-bkp\chocolatey". 2023-07-03 08:45:44,612 5344 [DEBUG] - Moving C:\ProgramData\chocolatey\lib\chocolatey to C:\ProgramData\chocolatey\lib-bkp\chocolatey\2.0.0 2023-07-03 08:45:44,612 5344 [DEBUG] - Moving 'C:\ProgramData\chocolatey\lib\chocolatey' to 'C:\ProgramData\chocolatey\lib-bkp\chocolatey\2.0.0' 2023-07-03 08:45:46,618 5344 [DEBUG] - Attempting to create directory "C:\ProgramData\chocolatey\lib\chocolatey". 2023-07-03 08:45:46,618 5344 [DEBUG] - Attempting to copy "C:\ProgramData\chocolatey\lib-bkp\chocolatey\2.0.0\chocolatey.nupkg" to "C:\ProgramData\chocolatey\lib\chocolatey\chocolatey.nupkg". 2023-07-03 08:45:48,143 5344 [DEBUG] - Ensuring removal of installation files. etc...
@MajorGlory86 thank you for the reproduction steps. I can confirm that I am also seeing an issue on a fresh machine when attempting these steps.
The command does eventually finish, but for me, there were over 1300 outgoing requests before the upgrade of the package is completed. This is certainly not what is intended, and we will need to investigate, and correct this problem.
Thank you all for highlighting this problem!
So, I'm pretty sure the problem is here: https://github.com/chocolatey/choco/blob/d836138142e6b1e7a9b2e931faeb0c4d4fb4b6c2/src/chocolatey/infrastructure.app/services/NugetService.cs#L1212-L1218
It just blindly gets all package versions of all "parent" packages (aka packages that take a dependency on the package being upgraded). When there are a large number of package versions of one of these parent packages (aka chromium taking a dependency on chocolatey) then getting this information takes a long time.
It probably would make sense to optimize this by initially only getting say the latest version of each parent package, then trying to resolve dependencies, and if that fails, then get all package versions and retry dependency resolution.
This can be solved long term by implementing Package Indices
@TheCakeIsNaOH said... It probably would make sense to optimize this by initially only getting say the latest version of each parent package, then trying to resolve dependencies, and if that fails, then get all package versions and retry dependency resolution.
Yes, I believe that you are correct that this is the problem area. I hadn't linked to it earlier, but I had looked this code before you posted. Need to have some discussions about the correct approach going forward on this one, to ensure that we don't break something elsewhere in the codebase.
:tada: This issue has been resolved in version 2.2.0 :tada:
The release is available on:
Your GitReleaseManager bot :package::rocket:
So, eh, how do I update from 2.1.0 to 2.2.0? Am I missing the solution path? I'm stuck because of the Chromium thing, too..
So, eh, how do I update from 2.1.0 to 2.2.0? Am I missing the solution path? I'm stuck because of the Chromium thing, too..
You can upgrade. It just takes a while to finish. Like 5 minutes or so.
Like 5 minutes or so.
The last time I had a look at my 2 devices without anything that happened was at around 30 minutes. But it worked after all.^^
Hopefully people have managed to upgrade at this point, but I know of three solutions:
choco uninstall chromium -n
then choco upgrade chocolatey
then choco install chromium
, note that this will break the automatic uninstaller until the next time chromium updates).nupkg
and run choco upgrade chocolatey --source="'\path\to\directory\nupkg\is\in'"
, note that this will only work for people on v2.0.0 or v2.1.0, since v2.2.x is affected by https://github.com/chocolatey/choco/issues/3292
Checklist
What You Are Seeing?
When upgrading to v2.1.0 from v2.0.0 the update process hangs and seems to be searching for a wrong package on the API (in this case it was chromium).
What is Expected?
Upgrading to v2.1.0 should be the result of this action.
How Did You Get This To Happen?
choco upgrade chocolatey --verbose
System Details
Installed Packages
Output Log
Additional Context
As a workaround I temporarily moved the chromium folder from the lib directory to another location. After the update to v2.1.0 I moved it back.