Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Services sometimes create "disabled" state

Mon Aug 09, 2010 10:09 am

Using AI 7.7:
I can't say exactly what causes this: but sometimes during upgrade a Service that is created by AdvancedInstaller becomes "disabled" and then the installer fails.
You can either create a Service with the "sc.exe create..." command line, or use the built-in AdvancedInstaller Services options. I use AdvancedInstaller, and sometimes Services are marked as "disabled". This is a known Microsoft bug http://support.microsoft.com/kb/287516 and is caused when trying to delete a Service when it's still running.

I have no idea of the internals of AdvancedInstaller: but for most of the times this works just great, but sometimes (really a few - but still not acceptable): AdvancedInstaller creates a situation that a Service is "disabled" and the installation gives an error with options: "Retry" "ignore" "cancel", and at that stage if you go to the services.msc, you'll see that the real problem is that the Service is "disabled", and not that you have wrong privileges - like the message suggests.

Are you aware of this problem? Have you experianced it? As I said: you'll have to "play" a lot to get it: but it happens.

GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact:  Website

Re: Services sometimes create "disabled" state

Mon Aug 09, 2010 12:28 pm

Hello,

Service creation and control is done by Windows Installer itself, we do not handle this behavior. If the issue is indeed caused by the service being deleted while still running, you should make sure the "stop" checkbox is checked for the service's control operation on the Services page. This ensures the service is stopped then deleted.

Let me know if that helped.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Services sometimes create "disabled" state

Mon Aug 09, 2010 2:48 pm

This is how I have configured it, and even so: sometimes this happens.
I've tried to create the service on my own, and now when I upgrade, the Installer pops up a warning saying that my service is running and holding files ("file in use" dialog).
I tried stopping the service at various places/customAction locations, and the best place I could find that wouldn't cause this dialog window to open was in custom action "CostFinalize" and maybe it could be a bit after, but for sure it didn't work for me if I tried to stop the service from "InstallValidate" and downwards: because at validate install, it would tell me that the file is in use.
Please take a look at the log (my service name is: "Observer Indexer"):

Code: Select all

MSI (s) (84:74) [05:30:26:674]: RESTART MANAGER: Detected that application with id 2284, friendly name 'Observer Indexer', service short name 'Observer Indexer', of type RmService and status 1 holds file[s] in use.
MSI (s) (84:74) [05:30:26:674]: Note: 1: 2205 2:  3: ServiceControl 
MSI (s) (84:74) [05:30:26:674]: Note: 1: 2228 2:  3: ServiceControl 4: SELECT `Name`,`Wait`,`Arguments`,`Event`, `Action` FROM `ServiceControl`, `Component` WHERE `Component_` = `Component` AND (`Action` = 0 OR `Action` = 1 OR `Action` = 2) 
MSI (c) (C8:C4) [05:30:26:721]: RESTART MANAGER: Session opened.
MSI (c) (C8:C4) [05:30:26:721]: RESTART MANAGER: Detected that application with id 2284, friendly name 'Observer Indexer', service short name 'Observer Indexer', of type RmService and status 1 holds file[s] in use.
MSI (c) (C8:C4) [05:30:26:721]: Note: 1: 2262 2: ListBox 3: -2147287038 
Info 2826. Control Description on dialog MsiRMFilesInUse extends beyond the boundaries of the dialog to the right by 13 pixels.
Info 2826. Control BottomLine on dialog MsiRMFilesInUse extends beyond the boundaries of the dialog to the right by 3 pixels.
Info 2826. Control BannerLine on dialog MsiRMFilesInUse extends beyond the boundaries of the dialog to the right by 3 pixels.
Putting the custom action to stop the service before "InstallInitialze" forces me to use "Immediate" and not "deferred with no impersonation" (which I'm not sure will always work).
However, if the installer is configured to install the service: it does NOT popup a window that tells me that files are in use, but then I have this problem that it sometimes disables the service which later causes the installation to fail...
Also, putting the custom action of stopping the Service at "StopServices" custom action location - which would seem like the right place: will cause the installer to popup the "files in use" window (because like I mentioned: it must be done much before that - for some reason...).
This popup of "files in use" happens only during upgrades: it does not happen when first time installing the product.

So my question is: how come if I use the built-in AdvancedInstaller services: "files in use" window doesn't popup - although - the service is STILL running! (and will stop later of course) but when I try to manually stop the Service: I have to do it BEFORE InstallValidate...

Dashut.

GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact:  Website

Re: Services sometimes create "disabled" state

Tue Aug 10, 2010 8:11 am

Hi Dashut,

I'm not sure why this behavior occurs.
Please send two sample projects that replicate this behavior to support at advancedinstaller dot com so we can further investigate.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Dashut
Posts: 142
Joined: Tue May 04, 2010 4:41 pm

Re: Services sometimes create "disabled" state

Tue Aug 10, 2010 10:25 am

You mean: why the installer claims the files are in use? (when I manually start/stop and why it doesn't when I use AdvancedInstaller built-in?)
Or you mean: why "disable" happens sometimes?
Dashut.

shahviral6438
Posts: 9
Joined: Mon Mar 23, 2020 8:13 am

Re: Services sometimes create "disabled" state

Mon May 04, 2020 2:01 pm

Hi team,

I am also facing this issue (services are staying in Disabled state during upgrade) and I am using AI 16.5

Do we have any update on below thread or any workaround?

Thanks,
Viral Shah

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: Services sometimes create "disabled" state

Wed May 06, 2020 11:34 am

Hi Viral,

This may happen if the service is not configured to be stopped on uninstall.

Could you please go to "Services" page of your new version of setup project, select your service control operation entry and make sure "On Install" setting has all three options checked: Start, Stop and Delete.

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”