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

VC runtime installer can reboot system prior to installation finishing [CORE3900] #4236

Closed
firebird-automations opened this issue Jul 31, 2012 · 17 comments

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Brenden Walker (braindead)

If the VC runtime installer needs to reboot to finish installation it will cause the FB installer to reboot the system with no warning (due to /qn passed to msiexec) before the FB installer finishes. This page http://desktopengineer.com/windowsinstallererrorcodes notes that msiexec returns exit code 3010 if a reboot is needed perhaps running always with /norestart and setting internal reboot required flag would be preferable.

The only time we've seen this is with freshly imaged Win 7 machines during the first boot process.

Commits: f90f322

@firebird-automations
Copy link
Collaborator Author

Commented by: @reevespaul

I'm not sure what to say about this. Let me add a few thoughts anyway.

Part of the problem is that we are building with and consequently deploying the original MSVC8 runtimes, whereas all new Windows versions come with the later (SP1?) runtimes. Worse still, we can't, afaict, detect if the either of these runtime assemblies have already been installed. This seems to be a deficiency of wix v2.0.

The other part of the problem is that we do not plan to deploy runtime assemblies with Firebird 3.0. It is built with MSVC10 which has abandoned this stupidity. All that is required is to drop the runtime into the same directory as the Firebird binaries.

So, going forward, this problem will disappear naturally. The question is what, if anything, can be done for Fb 2.1 and Fb 2.5.

I'll take a look at your suggestion of trapping the error and setting the reboot required flag.

@firebird-automations
Copy link
Collaborator Author

Modified by: @reevespaul

assignee: Paul Reeves [ paul_reeves ]

@firebird-automations
Copy link
Collaborator Author

Commented by: Brenden Walker (braindead)

Considering that this will be moot in the future, AND that our situation was likely an extreme edge case.. I think this is likely a low priority. Thanks for looking into this.

@firebird-automations
Copy link
Collaborator Author

Commented by: @reevespaul

We don't seem to have had any other reports with this problem and as the OP indicated, it appears to be an edge case. I think we can close this issue.

@firebird-automations
Copy link
Collaborator Author

Modified by: @reevespaul

status: Open [ 1 ] => Resolved [ 5 ]

resolution: Won't Fix [ 2 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pcisar

status: Resolved [ 5 ] => Closed [ 6 ]

@firebird-automations
Copy link
Collaborator Author

Commented by: @reevespaul

I'll take another look.

@firebird-automations
Copy link
Collaborator Author

Modified by: @reevespaul

status: Closed [ 6 ] => Reopened [ 4 ]

resolution: Won't Fix [ 2 ] =>

@firebird-automations
Copy link
Collaborator Author

Commented by: Sean Leyne (seanleyne)

Stefan Heymann today posted to the devel list:

[CORE3900](https://github.com/FirebirdSQL/firebird/issues?q=CORE3900+in%3Atitle) is an issue about the VC runtime installer \(which is included in the Windows Setup\.exe install\) rebooting the machine without any prior warning\.

I have had this on several occasions when installing Firebird 2\.5 on a client's production machine\. When I installed it onto a brand new Windows 10 computer last week, the same thing happened\.

The classification of this issue as an "edge case" \(Paul Reeves, 2014\-11\-04\) is wrong IMO\. This is a serious issue because it can cause production machines to suddenly boot\.

It would be good to reconsider this issue and fix it\.

@firebird-automations
Copy link
Collaborator Author

Commented by: @reevespaul

Here is some background to what is happening:

There is a system level setting which determines when and how to do a system restart. By default the setting is to restart automatically if a restart is required. This can be over-ridden at the application level.

The firebird installer is designed to not require a system restart. The problem here is when it calls msiexec to install the runtimes. No restart option is passed so the system default is used.

msiexec has three restart options:

/norestart
	Do not restart after the installation is complete
/promptrestart
	Prompts the user for restart if necessary
/forcerestart
	Always restart the computer after installation

We can safely ignore the last one. So the choice comes down to /norestart and /promptrestart.

/promptrestart appears to be the most sensible solution on first examination, but I have no idea how that will manifest itself to the user. I presume it will throw up a dialogue as well as setting an error flag. But msiexec is run silently and if the install is scripted this could present a bigger problem than the one we have at the moment.

This means that /norestart would be the safest solution but with the small risk that the install may not work correctly for the few installs that require a reboot. However, in general it seems that active applications that might be using existing versions of the runtime libraries will continue to run and newly started appplications will pick up the new runtimes. At least that is the theory. All that the reboot does is clean things up by deleting the old runtimes.

It would be helpful if we had some more information from a system that did a forced restart. The msiexec application writes a log out to {tmp}\vccrt{#⁠msvc_version}_Win32.log and {tmp}\vccrt{#⁠msvc_version}_x64.log

If we could identify the cause of the restart I might be able to reproduce it and find the right solution. But I must admit that suppressing the restart completely is the best and simplest way to go.

What do others think?

@firebird-automations
Copy link
Collaborator Author

Commented by: Brenden Walker (braindead)

If VC is installed in PrepareToInstall you could run with /norestart and set the passed in var NeedsRestart if msiexec exitcode is 3010. That will allow InnoSetup standard restart handling to deal with it (including not restarting when /NORESTART is passed, which is what we expect).

That should resolve the specific issue we had.

All that said, as noted in my original post. We've only seen this happen on freshly imaged systems during the firstboot process. AFAIK we've worked around the issue on our end. As nobody else has reported this issue, I think it could be closed or at least made very low priority.

@firebird-automations
Copy link
Collaborator Author

Commented by: @reevespaul

The other problem is that, as far as I can tell, innosetup does not pick up the errorcode from msiexec. At least, not when msiexec is executed from the [RUN] section.
It is possible that we could run msiexec in a function but that seems as if it may also have unforeseen side effects and require some more serious testing.
Hence my preference for /norestart and then winging it :-)

It puts us in a better place than where we are now, and side effects would be limited.

@firebird-automations
Copy link
Collaborator Author

Commented by: Brenden Walker (braindead)

Indeed, you would have to run the installer in code. I don't know that it's any more risky that using the run section, but would definitely require more testing.

In case you decide to go down the manual install path. Here's how we install dotnet, we do all of our dependencies in PrepareToInstall so that we can set NeedsRestart.

const
ERROR_SUCCESS_REBOOT_REQUIRED = 3010;

function InstallNETFramework(var NeedsRestart: Boolean): String;
var
xExe: String;
xParams: String;
xRun: Boolean;
xResult: Integer;
xLogFile: String;
begin
xLogFile := LogFileNameNoExt('{app}\LOG', 'NETSETUP'); // No extension - already gets .html
ExtractTemporaryFile('NDP461-KB3102436-x86-x64-AllOS-ENU.exe');
xExe := ExpandConstant('{tmp}\NDP461-KB3102436-x86-x64-AllOS-ENU.exe');
xParams := '/q /norestart /log "' + xLogFile + '"';
xRun := Exec(xExe, xParams, '', SW_HIDE, ewWaitUntilTerminated, xResult);
if (not xRun) or ((xResult <> 0) and (xResult <> ERROR_SUCCESS_REBOOT_REQUIRED))
then Result := 'Unable to install Microsoft .NET 4.6.1 (' + IntToStr(xResult) + ').'
else Result := '';
NeedsRestart := (xResult = ERROR_SUCCESS_REBOOT_REQUIRED);
end;

@firebird-automations
Copy link
Collaborator Author

Commented by: @reevespaul

Thanks for that Brendan. That will be useful.

I will certainly look to include it or something like it for the next release of FB 3 or maybe Fb4 beta 2. But the immediate problem (which caused this report to be re-opened) is to provide a fix for Fb 2.5.

My hope is to just add the norestart switch and then we can repackage and silently upload the new binaries. Fb 2.5 is no longer officially supported by the Firebird project but if this can be fixed with a simple repackaging then I think I can push it through. The last thing I want to do at this stage is try out a new bit of code.

@firebird-automations
Copy link
Collaborator Author

Modified by: @reevespaul

status: Reopened [ 4 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @dyemanov

Fix Version: 3.0.5 [ 10885 ]

@firebird-automations
Copy link
Collaborator Author

Modified by: @pavel-zotov

status: In Progress [ 3 ] => In Progress [ 3 ]

QA Status: Cannot be tested

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

No branches or pull requests

3 participants