When does the installer decides that it needs to restart Windows?

82 views
Skip to first unread message

Ranganath Gunawardane

unread,
May 23, 2024, 2:05:11 AMMay 23
to innosetup
Hi all,

I am installing a program using Inno Setup silently (using /VERYSILENT /SUPPRESSMSGBOXES). 
After installing, the installer sometimes (around 15% of the time) decides that a restart is required and restarts the whole machine. Which is not desirable.

Do you know what makes the installer decide that a restart is required?

I use the [Files] section to copy the DLL like this.
Source: x32\*.dll; DestDir: {sys}; Flags: 32bit restartreplace uninsneveruninstall

Here are two log excerpts from each case highlighting the main differences.

1. When a restart happens.
 2024-05-07 13:21:53.018   -- File entry --
2024-05-07 13:21:53.018   Dest filename: C:\Windows\system32\<somefile>.dll
2024-05-07 13:21:53.018   Time stamp of our file: 2023-10-24 11:26:24.000
2024-05-07 13:21:53.018   Dest file exists.
2024-05-07 13:21:53.018   Time stamp of existing file: 2023-10-24 11:26:24.000
2024-05-07 13:21:53.018   Version of our file: 111.0.1.7575
2024-05-07 13:21:53.019   Version of existing file: 111.0.1.7575
2024-05-07 13:21:53.019   Same version. Skipping.
      :
2024-05-07 13:21:57.577   Need to restart Windows? Yes

2. When a restart does not happen.
2024-04-29 12:13:35.131   -- File entry --
2024-04-29 12:13:35.131   Dest filename: C:\Windows\system32\<somefile>.dll
2024-04-29 12:13:35.132   Time stamp of our file: 2023-10-24 11:26:24.000
2024-04-29 12:13:35.132   Installing the file.
2024-04-29 12:13:35.133   Successfully installed the file.
      :
2024-04-29 12:13:44.107   Need to restart Windows? No

Thanks.
Ranga

Eivind Bakkestuen

unread,
May 23, 2024, 2:11:09 AMMay 23
to inno...@googlegroups.com
Typically, a restart is required if files are in use

--
You received this message because you are subscribed to the Google Groups "innosetup" group.
To unsubscribe from this group and stop receiving emails from it, send an email to innosetup+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/innosetup/3e7feedb-5f52-4f0a-a085-c277a4d8b5adn%40googlegroups.com.

Ranganath Gunawardane

unread,
May 23, 2024, 3:07:46 AMMay 23
to innosetup
Thanks, Eivind.
In this case, though, the only difference is that in the instance that it restarted, the files were skipped.

Eivind Bakkestuen

unread,
May 23, 2024, 4:45:49 AMMay 23
to inno...@googlegroups.com
Well, nobody here knows what code might be inside the installer, so you need to check with whomever created it if there are special conditions triggering it.

Ranganath Gunawardane

unread,
May 23, 2024, 4:56:13 AMMay 23
to innosetup
It is my installer, and it does nothing special concerning that DLL copy other than what I posted earlier. 
Source: x32\*.dll; DestDir: {sys}; Flags: 32bit restartreplace uninsneveruninstall


Gavin Lambert

unread,
May 23, 2024, 9:15:09 PMMay 23
to innosetup
On Thursday, May 23, 2024 at 6:05:11 PM UTC+12 Ranganath Gunawardane wrote:
I am installing a program using Inno Setup silently (using /VERYSILENT /SUPPRESSMSGBOXES). 
After installing, the installer sometimes (around 15% of the time) decides that a restart is required and restarts the whole machine. Which is not desirable.

If you want to suppress the automatic restart, then pass /NORESTART as well, optionally with a /RESTARTEXITCODE=n to specify what exit code to return when a restart is required.  Note that the app may not run correctly until the restart actually occurs, but this allows you to defer the restart until the end of a larger installation operation.

If you run non-silently then the user will be asked if they want to restart.

Gavin Lambert

unread,
May 23, 2024, 9:18:52 PMMay 23
to innosetup
On Thursday, May 23, 2024 at 8:56:13 PM UTC+12 Ranganath Gunawardane wrote:
It is my installer, and it does nothing special concerning that DLL copy other than what I posted earlier. 
Source: x32\*.dll; DestDir: {sys}; Flags: 32bit restartreplace uninsneveruninstall

 Note that these days it is considered poor practice to install things to {sys}; there are usually better places to put most things.  You may also want to consider using sharedfile rather than uninsneveruninstall, which is also generally a poor practice. 

Ranganath Gunawardane

unread,
May 23, 2024, 10:57:36 PMMay 23
to innosetup
Thank you, Gavin, for the information about alternative approaches. I'll read more about sharedfile and a better system folder.  
Until then, as a workaround, I'll let the users pass /NORESTART.

I tried to figure out why a restart was required by comparing the log and the Inno Setup source, but I couldn't find anything conclusive (mostly due to my lack of Pascal knowledge, I'm sure). I'll keep looking out of curiosity. I'd like to understand why it required a restart.

Ranga
Reply all
Reply to author
Forward
0 new messages