Skip to content

Allow plugin to continue search for updates with reboots#162

Merged
rgl merged 7 commits intorgl:masterfrom
kvprasoon:feat/restart_until_no_updates
Mar 3, 2026
Merged

Allow plugin to continue search for updates with reboots#162
rgl merged 7 commits intorgl:masterfrom
kvprasoon:feat/restart_until_no_updates

Conversation

@kvprasoon
Copy link
Copy Markdown
Contributor

@kvprasoon kvprasoon commented Feb 16, 2026

@rgl Windows do show updates after previous updates are installed as well as post reboot after updates are installed.
Code change in this PR allows the plugin to do both. By default it will search for updates after all updates are installed and if reboot_until_no_updates key is set to true, it will continue checking for updates after a reboot.

@rgl
Copy link
Copy Markdown
Owner

rgl commented Feb 16, 2026

if I understood correctly, the idea is to always reboot after one or more updates are installed? if so, that sounds like a good default to have (and be always turned on, so no need for a new property). also, this PR can be simplified to just return 101 from the powershell script (the go code will reboot the machine and run the powershell script again ad eternum).

@kvprasoon
Copy link
Copy Markdown
Contributor Author

kvprasoon commented Feb 17, 2026

@rgl Thanks for the tip about exit code 101. I didn't initially understand this part. Updated the code changes according to the suggestions.

@rgl
Copy link
Copy Markdown
Owner

rgl commented Feb 18, 2026

the PR can be further simplified. you just need to change the line at:

https://github.com/rgl/packer-plugin-windows-update/blob/v0.17.2/update/windows-update.ps1#L304

to something like:

$installRebootRequired = $installResult.RebootRequired -or $true

maybe add a comment about why this is always rebooting after installing the updates.

@kvprasoon
Copy link
Copy Markdown
Contributor Author

There are two scenarios where we have to repeat checking for updates.

  1. After installing first set of updates, as some updates will only show up after installing previous updates without needing reboot.
  2. Some updates will show only after reboot post installing previous updates

I have added looping to handle scenario 1 as otherwise there will be unnecessary reboot to check for updates again. Remaining code changes are to handle scenario 2 when there is a loop.

@kvprasoon
Copy link
Copy Markdown
Contributor Author

kvprasoon commented Feb 20, 2026

@rgl I have kept it simple for now as you suggested, Later I will see how it can be efficiently handled by avoiding reboots between updates when it is not really required.

@kvprasoon kvprasoon changed the title Allow plugin to continue search for updates after reboots Allow plugin to continue search for updates with reboots Feb 21, 2026
@kvprasoon
Copy link
Copy Markdown
Contributor Author

kvprasoon commented Feb 24, 2026

@rgl - Waiting for your review to proceed. It will be great if this enhancement goes in for our team to use it in the image builder pipeline.

@kvprasoon
Copy link
Copy Markdown
Contributor Author

@rgl ICYMI.

@rgl rgl merged commit 561d24b into rgl:master Mar 3, 2026
@rgl
Copy link
Copy Markdown
Owner

rgl commented Mar 3, 2026

I've released a pre-release version at https://github.com/rgl/packer-plugin-windows-update/releases/tag/v0.18.0, but, coincidentally, now, due to KB5007651, this sits in a reboot loop, because there is a bug somewhere (seems related to what is described at https://www.reddit.com/r/sysadmin/comments/1l3c90z/kb5007651_installs_successfully_only_when_user_is/), so it seems, we need to have some kind of reboot loop detector (or add yet another configuration variable like max number of reboots) or just let the user ignore that KB.

@kvprasoon
Copy link
Copy Markdown
Contributor Author

IMHO, ignoring KB would be ideal option, because the reboot loop is not caused by the plugin but the specific update which needs interactive user login. User can either opt out of the update or do autologin in the automation (I didn't face this since I had autologin).

@steveturnbull
Copy link
Copy Markdown

I've released a pre-release version at https://github.com/rgl/packer-plugin-windows-update/releases/tag/v0.18.0, but, coincidentally, now, due to KB5007651, this sits in a reboot loop, because there is a bug somewhere (seems related to what is described at https://www.reddit.com/r/sysadmin/comments/1l3c90z/kb5007651_installs_successfully_only_when_user_is/), so it seems, we need to have some kind of reboot loop detector (or add yet another configuration variable like max number of reboots) or just let the user ignore that KB.

I’m experiencing this reboot loop with 0.18.0 on the same KB. What would be the best workaround for now or is it best to wait for the next updated version of the plugin? Thanks

@rgl
Copy link
Copy Markdown
Owner

rgl commented Mar 8, 2026

@steveturnbull have a look at the updated warning message in https://github.com/rgl/packer-plugin-windows-update/releases/tag/v0.18.0

@kvprasoon kvprasoon deleted the feat/restart_until_no_updates branch March 11, 2026 16:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants