-
Notifications
You must be signed in to change notification settings - Fork 905
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
Auto Uninstaller can fail if chocolateyUninstall.ps1 uninstalls prior to it running #304
Comments
1605 is being added as a valid uninstall exit code, since it means the product is not installed |
Adding that for #305. |
Why 10 seconds? |
No reason, it was arbitrary and proven to be long enough on 1 system I tested, but might not be enough for others. I really hope there's some better way to detect whether the uninstall is truely finished cleaning up...I noticed chocolatey returning on the msi uninstall but the directory was still there for a few seconds (doing just dir c:\install dir after cuninst)... |
That's fair. |
If the preceeding chocolatelyUninstall.ps1 uninstalls an application, sometimes the system is still cleaning up files and registry keys. Those keys are found by the auto installer and it decides to also move forward with the uninstall. In cases like that, the auto uninstaller should wait a few seconds before moving forward with checks.
This is completed with b82436b |
I'm sorry to say that after re-investigating the reason for the auto-uninstaller to fail is indeed caused by the uninstallers still running which was triggered from chocolateyUninstall.ps1, but this shouldn't normally happen. It happened because I used Invoke-Expression to run the uninstaller which apperently doesn't wait for the proces to exit (at least not for inno setup or msiexec processes). If I modify that (in this case in less pretty Invoke-Expression cmd.exe /c start /w dotheuninstallthing, but could use other Powershell commands to start the proces which includes waits) everything works fine. So the workaround with a sleep timeout wasn't necessary though maybe there's cases where this is convenient to have) but you can reconsider this patch. Great work in #305! |
Posh v3 has issues with wait - we have bits built in to make the process wait - as long as you are using start-chocolateyprocessasadmin it should block. |
When waiting for the system to finish cleaning up, 2 seconds seems more appropriate.
* stable: (chocolateyGH-315) Nuget stops when uninstall fails (chocolateyGH-316) Prevent reboots (chocolateyGH-305) Do not fail by default on auto uninstaller (chocolateyGH-304) Reduce sleep time to 2 seconds (chocolateyGH-305) Include exit code when there is an error (chocolateyGH-305) Log info instead of Debug (chocolateyGH-305) Don't attempt to log on uninstall Conflicts: src/chocolatey/infrastructure.app/builders/ConfigurationBuilder.cs src/chocolatey/infrastructure.app/services/ChocolateyPackageService.cs
When chocolateyUninstall.ps1 does an uninstall / cleanup or whatever it needs to do, the autouninstaller kicks in too soon it seems...
For inno setup installers, de uninst000.exe is deleted eventually by the chocolateyUninstall.ps1 kicking off the uninstall, but when the autouninstall is triggered it's still there, but the unins000.dat has already been removed. It's probably something with the windows installer service still finalizing things.
Doing a Start-Sleep -Seconds 10 at the end in the chocolateyUninstall.ps1 can be done as a workaround as the Windows Installer Service has probably finished cleaning up everything which the autouninstall will then notice.
For MSI's we got something similar...the key is still there but already removed when msiexec kicked off from the uninstaller is going to do its thing (but I'm not sure)
VERBOSE: Exporting alias 'Add-BinFile'.
VERBOSE: Exporting alias 'Remove-BinFile'.
Command ['"MsiExec.exe" /X{BA7FB0F2-4B28-444F-8199-CF8402DA342E} /qn /norestart'
] exited with '1605'
Auto uninstaller failed. Please remove machine installation manually.
centerityagent-plugins uninstall not successful.
Auto uninstaller failed. Please remove machine installation manually.
[NuGet] Removed file 'chocolateyinstall.ps1' to folder 'C:\Chocolatey\lib\Whatever\tools'.
[NuGet] Removed file 'chocolateyuninstall.ps1' to folder 'C:\Chocolatey\lib\Whatever\tools'.
[NuGet] Removed folder 'C:
The text was updated successfully, but these errors were encountered: