Hi all,

So I've added custom actions and conditions to run my service with /install and 
/uninstall options before the service is started and before it is deleted 
respectively.  Here's the XML:

    <CustomAction Id="RunMySvcInstall"
                  FileKey="MySvcExe"
                  ExeCommand="/install"
                  Execute="deferred" />
    <CustomAction Id="RunMySvcUninstall"
                  FileKey="MySvcExe"
                  ExeCommand="/uninstall"
                  Execute="deferred" />
    <InstallExecuteSequence>
      <Custom Action="RunMySvcInstall"
              After="InstallServices">
        NOT Installed
      </Custom>
      <Custom Action="RunMySvcUninstall"
              Before="DeleteServices">
        Installed AND REMOVE~="ALL"
      </Custom>
    </InstallExecuteSequence>

The log shows this:

...
MSI (s) (EC:9C) [11:24:35:347]: Executing op: 
ActionStart(Name=RunMySvcInstall,,)
MSI (s) (EC:9C) [11:24:35:347]: Executing op: 
CustomActionSchedule(Action=RunMySvcInstall,ActionType=1042,Source=C:\Program 
Files\My Svc\My-Svc.exe,Target=/install,)
MSI (s) (EC:9C) [11:24:35:831]: Note: 1: 1721 2: RunMySvcInstall 3: C:\Program 
Files\My Svc\My-Svc.exe 4: /install
MSI (s) (EC:9C) [11:24:35:831]: Note: 1: 2205 2:  3: Error
MSI (s) (EC:9C) [11:24:35:831]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` 
FROM `Error` WHERE `Error` = 1721
MSI (c) (04:EC) [11:24:35:847]: Font created.  Charset: Req=0, Ret=0, Font: 
Req=MS Shell Dlg, Ret=MS Shell Dlg

Error 1721. There is a problem with this Windows Installer package. A program 
required for this install to complete could not be run. Contact your support 
personnel or package vendor. Action: RunMySvcInstall, location: C:\Program 
Files\My Svc\My-Svc.exe, command: /install
MSI (s) (EC:9C) [11:24:45:409]: Note: 1: 2205 2:  3: Error
MSI (s) (EC:9C) [11:24:45:409]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` 
FROM `Error` WHERE `Error` = 1709
MSI (s) (EC:9C) [11:24:45:409]: Product: My Svc (64-bit) -- Error 1721. There 
is a problem with this Windows Installer package. A program required for this 
install to complete could not be run. Contact your support personnel or package 
vendor. Action: RunMySvcInstall, location: C:\Program Files\My Svc\My-Svc.exe, 
command: /install

Action ended 11:24:45: InstallFinalize. Return value 3.
...

Not much help there.  How does one go about determining why the action/command 
failed?

Thanks,
Eric.


-----Original Message-----
From: Brad Lemings [mailto:b...@rebit.com]
Sent: Thursday, May 19, 2011 10:24 PM
To: General discussion for Windows Installer XML toolset.
Subject: Re: [WiX-users] Debugging/Troubleshooting Service Installs


I dunno.  I'm inclined to stick with the abstraction principle and trust that 
the /uninstall option will undo everything done by the /install option.

So I only have two custom actions but several applicable scenarios:

* Install - RunInstallCmd
* Rollback Install - RunUninstallCmd
* Repair - RunInstallCmd
* Rollback Repair - no action (RunUninstallCmd would partially uninstall 
service)
* Uninstall - RunUninstallCmd
* Rollback Uninstall - RunInstallCmd
* Upgrade - no action (unless this scenario is actually composed of 
install/uninstall scenarios)
* Rollback Upgrade - no action (ditto)

But theory and practice do no always coincide.  I'll have to put my theories to 
the test.

Eric.

On May 19, 2011, at 5:56 PM, Castro, Edwin G. (Hillsboro) wrote:

> My recommendation would be to perform any other activities that the service 
> performs itself during /install in a Windows Installer friendly fashion. The 
> reason is that Windows Installer (and WiX standard custom actions) behave 
> more robustly in the face of failures and associated rollback scenarios.
>
> If you do decide to use a custom action to execute "service.exe /install" and 
> "service.exe /uninstall" then remember to handle the following scenarios:
> * Install
> * Rollback Install
> * Repair (Reinstall/Reconfigure)
> * Rollback Repair (Reinstall/Reconfigure)
> * Uninstall
> * Rollback Uninstall
> * Upgrade
> * Rollback Upgrade
>
> That's a lot of custom actions and it's going to be very difficult to know 
> what to do in each scenario if you don't know what "service.exe /install" 
> does.
>
> Edwin G. Castro
> Software Developer - Staff
> Digital Channels
> Fiserv
> Office: 503-746-0643
> Fax: 503-617-0291
> www.fiserv.com
> P Please consider the environment before printing this e-mail
>
>> -----Original Message-----
>> From: Brad Lemings [mailto:b...@rebit.com]
>> Sent: Thursday, May 19, 2011 4:21 PM
>> To: General discussion for Windows Installer XML toolset.
>> Subject: Re: [WiX-users] Debugging/Troubleshooting Service Installs
>>
>> Hi Edwin,
>>
>> I suspected this would be the case -- writing a custom action.  The
>> service however must be executed with the /install option before it
>> can be started so unless there's an alternative to writing a custom
>> action, this is the only possible solution.
>>
>> Thanks for the help.
>>
>> Eric.
>>
>> -----Original Message-----
>> From: Castro, Edwin G. (Hillsboro) [mailto:edwin.cas...@fiserv.com]
>> Sent: Thursday, May 19, 2011 4:24 PM
>> To: General discussion for Windows Installer XML toolset.
>> Subject: Re: [WiX-users] Debugging/Troubleshooting Service Installs
>>
>> ...
>> If you really want to execute your service with /install and
>> /uninstall to install and uninstall then you'll need to schedule a
>> custom action to execute your service appropriately. I would *highly* 
>> discourage this course of action.
>>
>> Edwin G. Castro
>> Software Developer - Staff
>> Digital Channels
>> Fiserv
>> Office: 503-746-0643
>> Fax: 503-617-0291
>> www.fiserv.com
>> P Please consider the environment before printing this e-mail
>>
>>
>>> -----Original Message-----
>>> From: Brad Lemings [mailto:b...@rebit.com]
>>> Sent: Thursday, May 19, 2011 1:43 PM
>>> To: General discussion for Windows Installer XML toolset.
>>> Subject: Re: [WiX-users] Debugging/Troubleshooting Service Installs
>>>
>>> Followup.  I have a better idea what the problem is.  Either msiexec
>>> is not "installing" the service by executing it with the proper
>>> /install argument or it is not executing the install command with
>> Administrator privileges.
>>>
>>>> From the log, it appears that the /install option is specified so
>>>> I'm guessing
>>> the latter case is the real problem although its somewhat
>>> inconceivable that the ServiceControl element does not imply
>> Administrator privileges.
>>>
>>> I'm guessing the Account and Password attributes are the real culprit.
>>> Now to prove it...
>>>
>>> -----Original Message-----
>>> From: Brad Lemings [mailto:b...@rebit.com]
>>> Sent: Thursday, May 19, 2011 1:33 PM
>>> To: General discussion for Windows Installer XML toolset. (wix-
>>> us...@lists.sourceforge.net)
>>> Subject: [WiX-users] Debugging/Troubleshooting Service Installs
>>>
>>> Greetings,
>>>
>>> The following excerpt of a Wix file is supposed to install, stop,
>>> start, and uninstall a service (exact names have been tweaked):
>>>
>>>      <Component Id='MySvc'
>>>                 Guid="5E7A07C7-9299-4992-A601-EBB79D441A83"
>>>                 Win64='$(var.Win64)'>
>>>
>>>        <File Id='MySvcExe'
>>>              Source='$(var.TARGET_DIR)\$(var.MY_SERVICE_OUTPUT_NAME)'
>>>              KeyPath='yes' Checksum='yes'/>
>>>
>>>        <ServiceInstall Id="InstallMySvc"
>>>                        Name="$(var.MY_SERVICE_SVC_NAME)"
>>>                        DisplayName="$(var.MY_SERVICE_DISPLAY_NAME)"
>>>                        Type="ownProcess"
>>>                        Start="auto"
>>>                        Arguments="/install"
>>>                        ErrorControl="normal"
>>>                        Description="$(var.MY_SERVICE_DESCRIPTION)"
>>>                        Account="[SERVICEACCOUNT]"
>>>                        Password="[SERVICEPASSWORD]" />
>>>        <ServiceControl Id="StartMySvc"
>>>                        Name="$(var.MY_SERVICE_SVC_NAME)"
>>>                        Start="install"
>>>                        Wait="yes" />
>>>        <ServiceControl Id="StopMySvcSvc"
>>>                        Name="$(var.MY_SERVICE_SVC_NAME)"
>>>                        Stop="both"
>>>                        Wait="yes" />
>>>        <ServiceControl Id="UninstallMySvcSvc"
>>>                        Name="$(var.MY_SERVICE_SVC_NAME)"
>>>                        Remove="uninstall" >
>>>          <ServiceArgument>/uninstall</ServiceArgument>
>>>        </ServiceControl>
>>>      </Component>
>>>
>>> I'm trying to install the resulting .MSI with the following command:
>>>
>>> msiexec /norestart /lvx*+ mysvc.log /i mysvc.msi
>>>
>>> The install fails and msiexec reports via GUI that the service failed to 
>>> start.
>>> Part of the log shows this:
>>>
>>> MSI (s) (2C:D8) [13:17:05:419]: Executing op: RegCreateKey() MSI (s)
>>> (2C:D8)
>>> [13:17:05:419]: Executing op:
>>> ActionStart(Name=InstallServices,Description=Installing new
>>> services,Template=Service: [2]) MSI (s) (2C:D8) [13:17:05:419]:
>>> Executing
>> op:
>>> ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
>>> MSI (s) (2C:D8) [13:17:05:419]: Executing op:
>>> ServiceInstall(Name=My- Svc,DisplayName=My Svc,ImagePath="C:\Program 
>>> Files\My\My-Svc.exe"
>>> /install,ServiceType=16,StartType=2,ErrorControl=1,,Dependencies=[~]
>>> ,, ,Pas sword=**********,Description=My Backup Service,,) MSI (s)
>>> (2C:D8)
>>> [13:17:06:060]: Executing op:
>>> ActionStart(Name=RollbackServiceConfig,,)
>>> MSI (s) (2C:D8) [13:17:06:060]: Executing op:
>>>
>> CustomActionSchedule(Action=RollbackServiceConfig,ActionType=3329,Sou
>> r
>>>
>> ce=BinaryData,Target=RollbackServiceConfig,CustomActionData=SchedServ
>> i
>>> ceConfig)
>>> MSI (s) (2C:D8) [13:17:06:060]: Executing op:
>>> ActionStart(Name=ExecServiceConfig,,)
>>> MSI (s) (2C:D8) [13:17:06:060]: Executing op:
>>>
>> CustomActionSchedule(Action=ExecServiceConfig,ActionType=3073,Source=
>>>
>> BinaryData,Target=ExecServiceConfig,CustomActionData=SchedServiceConf
>> i
>>> gEURMy-SvcEUR0EURrestartEURrestartEURnoneEUR1EUR60EUREUR)
>>> MSI (s) (2C:D8) [13:17:06:060]: Creating MSIHANDLE (8) of type
>>> 790536 for thread 1496 MSI (s) (2C:34) [13:17:06:060]: Invoking
>>> remote custom
>> action.
>>> DLL: C:\Windows\Installer\MSIC5E2.tmp, Entrypoint: ExecServiceConfig
>>> MSI
>>> (s) (2C:20) [13:17:06:060]: Generating random cookie.
>>> MSI (s) (2C:20) [13:17:06:075]: Created Custom Action Server with
>>> PID
>>> 784 (0x310).
>>> MSI (s) (2C:78) [13:17:06:091]: Running as a service.
>>> MSI (s) (2C:78) [13:17:06:091]: Hello, I'm your 32bit Elevated
>>> custom action server.
>>> MSI (s) (2C!B8) [13:17:06:263]: Creating MSIHANDLE (9) of type
>>> 790531 for thread 3000 MSI (s) (2C!B8) [13:17:06:263]: Closing
>>> MSIHANDLE (9) of type
>>> 790531 for thread 3000 MSI (s) (2C:34) [13:17:06:263]: Closing
>>> MSIHANDLE (8) of type 790536 for thread 1496 MSI (s) (2C:D8)
>> [13:17:06:263]: Executing op:
>>> ActionStart(Name=StartServices,Description=Starting
>>> services,Template=Service: [1]) MSI (s) (2C:D8) [13:17:06:263]:
>>> Executing
>> op:
>>> ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
>>> MSI (s) (2C:D8) [13:17:06:263]: Executing op:
>>> ServiceControl(,Name=My-
>>> Svc,Action=1,Wait=1,)
>>> MSI (s) (2C:D8) [13:17:36:310]: Note: 1: 2205 2:  3: Error MSI (s)
>>> (2C:D8)
>>> [13:17:36:310]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM
>>> `Error` WHERE `Error` = 1920 MSI (c) (FC:38) [13:17:36:310]: Font created.
>> Charset:
>>> Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
>>>
>>> Error 1920. Service 'My Svc' (My-Svc) failed to start.  Verify that
>>> you have sufficient privileges to start system services.
>>> MSI (s) (2C:D8) [13:17:49:482]: Note: 1: 2205 2:  3: Error MSI (s)
>>> (2C:D8)
>>> [13:17:49:482]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM
>>> `Error` WHERE `Error` = 1709 MSI (s) (2C:D8) [13:17:49:482]: Product:
>>> My (64-bit) -- Error 1920. Service 'My Svc' (My-Svc) failed to start.
>>> Verify that you have sufficient privileges to start system services.
>>>
>>> MSI (s) (2C:D8) [13:18:19:482]: Note: 1: 2205 2:  3: Error MSI (s)
>>> (2C:D8)
>>> [13:18:19:482]: Note: 1: 2228 2:  3: Error 4: SELECT `Message` FROM
>>> `Error` WHERE `Error` = 1920 MSI (c) (FC:38) [13:18:19:482]: Font created.
>> Charset:
>>> Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
>>>
>>> Error 1920. Service 'My Svc' (My-Svc) failed to start.  Verify that
>>> you have sufficient privileges to start system services.
>>> MSI (s) (2C:F0) [13:18:21:216]: I/O on thread 1796 could not be cancelled.
>>> Error: 1168
>>>
>>> Even with all information being logged, there still isn't enough to
>>> determine the problem.
>>>
>>> When I don't abort the install and the files are copied into their
>>> final resting places, I can execute the following commands without
>>> any
>> errors:
>>>
>>>                My-Svc.exe /install
>>>                sc start My-Svc
>>>
>>> So it must be something wrong with the Wix file.  Any clues why the
>>> service fails to start?  Any tips, references, resources, links
>>> useful for debugging service installs using Wix?
>>>
>>> Any and all help appreciated.
>>>
>>> Eric.
>>>
>>> --------------------------------------------------------------------
>>> --
>>> -------- What Every C/C++ and Fortran developer Should Know!
>>> Read this article and learn how Intel has extended the reach of its
>>> next- generation tools to help Windows* and Linux* C/C++ and Fortran
>>> developers boost performance applications - including clusters.
>>> http://p.sf.net/sfu/intel-dev2devmay
>>> _______________________________________________
>>> WiX-users mailing list
>>> WiX-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>>>
>>> --------------------------------------------------------------------
>>> --
>>> -------- What Every C/C++ and Fortran developer Should Know!
>>> Read this article and learn how Intel has extended the reach of its
>>> next- generation tools to help Windows* and Linux* C/C++ and Fortran
>>> developers boost performance applications - including clusters.
>>> http://p.sf.net/sfu/intel-dev2devmay
>>> _______________________________________________
>>> WiX-users mailing list
>>> WiX-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/wix-users
>> ---------------------------------------------------------------------
>> --------- What Every C/C++ and Fortran developer Should Know!
>> Read this article and learn how Intel has extended the reach of its
>> next- generation tools to help Windows* and Linux* C/C++ and Fortran
>> developers boost performance applications - including clusters.
>> http://p.sf.net/sfu/intel-dev2devmay
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
>> ---------------------------------------------------------------------
>> --------- What Every C/C++ and Fortran developer Should Know!
>> Read this article and learn how Intel has extended the reach of its
>> next- generation tools to help Windows* and Linux* C/C++ and Fortran
>> developers boost performance applications - including clusters.
>> http://p.sf.net/sfu/intel-dev2devmay
>> _______________________________________________
>> WiX-users mailing list
>> WiX-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/wix-users
> ----------------------------------------------------------------------
> -------- What Every C/C++ and Fortran developer Should Know!
> Read this article and learn how Intel has extended the reach of its
> next-generation tools to help Windows* and Linux* C/C++ and Fortran
> developers boost performance applications - including clusters.
> http://p.sf.net/sfu/intel-dev2devmay
> _______________________________________________
> WiX-users mailing list
> WiX-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/wix-users


------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran developers 
boost performance applications - including clusters.
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users
------------------------------------------------------------------------------
What Every C/C++ and Fortran developer Should Know!
Read this article and learn how Intel has extended the reach of its 
next-generation tools to help Windows* and Linux* C/C++ and Fortran 
developers boost performance applications - including clusters. 
http://p.sf.net/sfu/intel-dev2devmay
_______________________________________________
WiX-users mailing list
WiX-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wix-users

Reply via email to