Skip to content
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

Rerunning Install Script after reboot should not be necessary #3327

Closed
2 tasks done
JPRuskin opened this issue Sep 20, 2023 · 10 comments · Fixed by #3329
Closed
2 tasks done

Rerunning Install Script after reboot should not be necessary #3327

JPRuskin opened this issue Sep 20, 2023 · 10 comments · Fixed by #3329
Assignees
Milestone

Comments

@JPRuskin
Copy link
Member

JPRuskin commented Sep 20, 2023

Checklist

  • I have verified this is the correct repository for opening this issue.
  • I have verified no other issues exist related to my request.

Is Your Feature Request Related To A Problem? Please describe.

The user-experience when installing Chocolatey on a system that lacks dotnet 4.8 could be improved, and our most used flow requires:

  • Running the install script
  • Dotnet 4.8 being installed
  • Being prompted to reboot
  • Rebooting
  • Running the install script again

This is less than ideal, introduces complexity, and could be improved.

Describe The Solution. Why is it needed?

I would suggest, given that the rest of the install seems to work fine without the reboot, that we proceed with the rest of the installation after the dotnet installation.

This would result in a system that, though needing a reboot, will come up from the reboot with a fully functional Chocolatey install - and no further required steps.

Given that Chocolatey itself prevents users from running any command beyond -v/--version when 4.8 is not installed correctly (and has an appropriately explicit error message), this should not introduce a particularly awful level of confusion.

It shouldn't break any automation, either, as the install is fairly idempotent so anyone who already is running the script, rebooting, and running it again should just work.

This is also, to me, far closer to other software installations - and my expectations of running an install script.

Additional Context

Example of a modified install proceeding after dotnet is installed (but no reboot):
image

Example of the current error message produced when there has not been a reboot:
image

Related Issues

No response

JPRuskin added a commit to JPRuskin/choco that referenced this issue Sep 20, 2023
This commit introduces the idea that the dotnet installation needing a reboot should not immediately halt the Chocolatey installation, but instead proceed as far as possible - then prompt for a reboot.
@JPRuskin
Copy link
Member Author

JPRuskin commented Sep 20, 2023

I believe when I originally spoke to people about this I suggested that we could make it non-default behaviour, behind a switch or environment variable (similar to using Windows compression instead of 7zip), but as I have encountered this issue more I have decided that this is not a breaking change and is fine to be the default behaviour.

We could throw at the end of the install script, though, if we really wanted to indicate that something went wrong. I would suggest we follow msiexec, for instance, though, and exit without throwing.

JPRuskin added a commit to JPRuskin/choco that referenced this issue Sep 20, 2023
This commit introduces the idea that the dotnet installation needing a reboot should not immediately halt the Chocolatey installation, but instead proceed as far as possible - then prompt for a reboot.
@leonmelein
Copy link

leonmelein commented Dec 21, 2023

I'm encountering this problem with a client at the moment. They use VMs based on Windows Server 2019 Datacenter edition. Chocolatey is deployed via PowerShell DSC but installation fails since Chocolatey 2.x for this exact reason. Rebooting and trying again hasn't proven a reliable solution. Merging the related PR should solve our issues.

@pauby
Copy link
Member

pauby commented Dec 21, 2023

@leonmelein have you tried installing .NET 4.8, rebooting and then installing Chocolatey CLI?

Rebooting and trying again hasn't proven a reliable solution.

Can you elaborate on this?

@leonmelein
Copy link

@pauby The Chocolatey installation is performed by means of a custom script extension in Azure, performed after deployment of the VM. The extension pull the latest version of Chocolatey from an internal repository and runs the install script.

Custom script extensions cannot handle reboots in Azure, as per Microsoft:

Don't put restarts inside the script. This action causes problems with other extensions that are being installed, and the extension doesn't continue after the restart.

Given the circumstances at this client, I cannot change the way the machines are provisioned, e.g. providing a custom image or using a more recent Windows Server image.

Hope that gives a little more clarity. When I perform the installation manually, everything works as advertised.

@pauby
Copy link
Member

pauby commented Dec 21, 2023

@leonmelein that helps.

If you install. NET 4.8 you need to reboot before you can install Chocolatey CLI (or anything as .NET 4.8 requires a reboot too be installed). If you install Chocolatey CLI then it will install .NET 4.8 and require you to reboot before you can use it.

In both situations you need to reboot, which you can't do.

Can you explain how this PR will fix your situation? On the surface it sounds like the requirement for .NET 4.8, however it's done, is going to have the same result?

@leonmelein
Copy link

Yes, eventually a reboot will be necessary. If the Chocolatey installation itself isn't held up by the pending reboot, I could make sure the reboot happens at the very end of the VM deployment. That would be by using the AzureCLI@2 task and the az vm restart command.

At the moment, this isn't an option since there are several custom script extensions being executed sequentially directly after the deployment of the VM. This is managed completely by Azure and I cannot mix in an Azure CLI command while these extensions are running.

@pauby
Copy link
Member

pauby commented Dec 21, 2023

This maybe a dumb question.

Could you not install .NET 4.8 as part of the VM deployment, then reboot? Then as part of the provisioning (which I assume happens afterwards) install Chocolatey CLI, software, etc.?

@leonmelein
Copy link

That's not a dumb question. The issue with these custom script extensions is that they're executed as part of the deployment, not as separate actions. In theory we might be able to refactor this process and use a different approach, but given we're using scripts provided by another internal team that would require significant effort and coordination.

@pauby
Copy link
Member

pauby commented Dec 21, 2023

Thanks for that.

Just to set expectations, any change to the Chocolatey CLI installation script goes through extensive testing with all products that use it. So this isn't something that is likely to be implemented soon.

JPRuskin added a commit to JPRuskin/choco that referenced this issue Feb 22, 2024
This commit introduces the idea that the dotnet installation needing a reboot should not immediately halt the Chocolatey installation, but instead proceed as far as possible - then prompt for a reboot.
@gep13 gep13 added this to the 2.3.0 milestone Apr 18, 2024
JPRuskin added a commit to JPRuskin/choco that referenced this issue Apr 23, 2024
This commit introduces the idea that the dotnet installation needing a reboot should not immediately halt the Chocolatey installation, but instead proceed as far as possible - then prompt for a reboot.
JPRuskin added a commit to JPRuskin/choco that referenced this issue Apr 23, 2024
Won't run in environments where DotNet 4.8 has been installed where running in PS<=3, due to the issues found when testing in those environments.

Also improves the handling of errors, as previously we were never "reaching" an error due to the way Choco CLI's streams and exit codes work out.
JPRuskin added a commit to JPRuskin/choco that referenced this issue Apr 24, 2024
This commit introduces the idea that the dotnet installation needing a reboot should not immediately halt the Chocolatey installation, but instead proceed as far as possible - then prompt for a reboot.
JPRuskin added a commit to JPRuskin/choco that referenced this issue Apr 24, 2024
Won't run in environments where DotNet 4.8 has been installed where running in PS<=3, due to the issues found when testing in those environments.

Also improves the handling of errors, as previously we were never "reaching" an error due to the way Choco CLI's streams and exit codes work out.
gep13 pushed a commit to JPRuskin/choco that referenced this issue Apr 24, 2024
This commit introduces the idea that the dotnet installation needing a
reboot should not immediately halt the Chocolatey installation, but
instead proceed as far as possible - then prompt for a reboot.
gep13 pushed a commit to JPRuskin/choco that referenced this issue Apr 24, 2024
Won't run in environments where DotNet 4.8 has been installed where
running in PS<=3, due to the issues found when testing in those
environments.

Also improves the handling of errors, as previously we were never
"reaching" an error due to the way Choco CLI's streams and exit codes
work out.
gep13 added a commit that referenced this issue Apr 24, 2024
(#3327) Improves UX of Chocolatey Install without 4.8
@gep13 gep13 removed the 4 - Done label Jun 5, 2024
@choco-bot
Copy link

🎉 This issue has been resolved in version 2.3.0 🎉

The release is available on:

Your GitReleaseManager bot 📦 🚀

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

Successfully merging a pull request may close this issue.

5 participants