1

I have a custom bootstrapper (C# WPF) and it works well enough. If the installer gets run from the command line after it was installed, it brings up a window allowing the user to select if they want to modify, repair or uninstall. So far so good. Modify mode starts the UI which ends up calling Bootstrapper.Plan(LaunchAction.Modify). The problem is that if I call it from the launcher UI it immediately complains that a prior install requires a reboot.

I have not found any good examples on what this should do. Even the WiX mailing list came up blank.

Any ideas?

Tyrel Van Niekerk
  • 1,652
  • 4
  • 23
  • 38

2 Answers2

0

It would be helpful with the screenshot for that reboot message - just to get a feel for where it might be coming from and to get a literal string to search for. Did you have a look in the WiX source code yourself btw? (WiX 3.111 branch)

I started writing a lot of stuff about reboots. Not good. Maybe just some questions instead:

  1. Does this happen every time you invoke modify and is it reproducible on more than one computer? Or maybe it is just Windows Update acting up on a problem computer?

  2. I assume you have rebooted the computer where you see the problem and you see the problem again when you re-launch the bundle?

  3. Do you schedule any reboots inside your MSI files during the initial installation?

  4. Could you try to run the test VBScript found in this answer: WiX behaving badly on XP machine with windows update issues in order to check if the script reports a reboot being necessary?


Other than that I guess you could try to run Burn yourself in debug mode (not sure how much plumbing that would be to get running) or perhaps first try a ProcMon.exe session to see if you can see something obvious. The latter should be quick to do?


There are some registry locations you can hunt down to see if you can figure out what triggered the reboot warning. Get-PendingReboot-Query. And a similar PowerShell script.

Stein Åsmul
  • 39,960
  • 25
  • 91
  • 164
  • First of all, to get modify to work I had to manually change the requested state to RequestedState.Repair in OnPlanPackageBegin, that might be an issue. I could not get it to work any other way. If you say Present, it does not recognize it to be a modify run and just does nothing. – Tyrel Van Niekerk Apr 05 '18 at 14:06
  • After running modify, I get the message, "No action was taken as a system reboot is required." I can install/uninstall with no message. Running this "repair" mode seems to force it to want a reboot. – Tyrel Van Niekerk Apr 05 '18 at 14:08
  • I don't schedule any reboots and other then it setting the RequestesState to Repair instead of Present, the install is identical between modify and install. – Tyrel Van Niekerk Apr 05 '18 at 14:09
  • O, and yes, the computer has been rebooted. – Tyrel Van Niekerk Apr 05 '18 at 14:10
  • Seems to end up in the OnError method in wix3-wix3111\src\ext\BalExtension\wixstdba\WixStandardBootstrapperApplication.cpp. I wonder if there is a way to tweak the registry after modify to remove the reboot required setting. – Tyrel Van Niekerk Apr 05 '18 at 14:15
  • I seem to be getting closer. After modify it adds a whole bunch of files to the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\PendingFileRenameOperations registry key. I will have to investigate why this is. – Tyrel Van Niekerk Apr 05 '18 at 15:25
  • Do you have running processes such as services that are not stopped properly before you run the modify operation? Windows Installer will then schedule a reboot on its own (without any reboot constructs added by you) and then register the files to be replaced during the next reboot. The `PendingFileRenameOperations` key is a mechanism to that end. **Do not directly delete entries from this key** (your install will never complete after reboot, and you are deep in the OS messing with things). You can use the `ServiceControl element` to shut down a service during install and uninstall. – Stein Åsmul Apr 06 '18 at 02:52
  • You are not setting [REINSTALLMODE](https://msdn.microsoft.com/en-us/library/windows/desktop/aa371182(v=vs.85).aspx) in your property table are you? Setting a force overwrite REINSTALLMODE will trigger a lot more reboot prompts than using standard REINSTALLMODE values. – Stein Åsmul Apr 06 '18 at 02:54
  • To answer Stein, yes, that's what it was. I added code to uninstall/stop the services and that fixed it. And no, I did not modify the property table like that. Thanks for all the tips and suggestions though. – Tyrel Van Niekerk Apr 09 '18 at 17:52
0

So in the end it was user error. :-( O well. I did learn a lot about how to figure out how Windows checks for the need to reboot etc.

The issue was simple in the end. During the modify run it was uninstalling, then reinstalling a number of services. The problem is that when it runs (seeing as you have to set it to repair to get it to work) it copies all the files again and the services were still running at the start of the install. The fix was to uninstall anything that might lock a file before the actual file copy starts and that solved the issue for me.

Thanks for your help guys, all the info helped me look in different directions until I found the issue. Awesome community as always!

Tyrel Van Niekerk
  • 1,652
  • 4
  • 23
  • 38