I made a patch package with WIX, and the configuration is as follows:
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Patch
AllowRemoval="yes"
Classification="Update"
Comments="Patch forv.3.5.0.0"
Description="Updates to v.3.5.1.0"
DisplayName="Patch v.3.5.0.0-v.3.5.1.0"
MoreInfoURL=""
Manufacturer=""
TargetProductName="DDD">
<Media Id="5000" Cabinet="MyPatch.cab">
<PatchBaseline Id="MyPatch" />
</Media>
<PatchFamily
Id="MyPatchFamily"
Version="0.0.1.0"
Supersede="yes" >
</PatchFamily>
<TargetProductCodes Replace="yes">
<TargetProductCode Id="{0498A327-4DB6-47FD-91EB-F6B6496F2547}"/>
<TargetProductCode Id="{6318BD0F-1B46-4AA2-B490-EC33785998B6}"/>
<TargetProductCode Id="{2FF1A3B7-B781-42EA-9AE7-4A3816621B46}"/>
</TargetProductCodes>
</Patch>
</Wix>
After my first installation, the version information was updated, but the files were not.
Then I uninstalled the patch and reinstalled the patch pack, and it worked.
By comparing the two installation records, I captured the following different places.
This is the log for the first installation
MSI (s) (A8:28) [09:05:01:778]: Executing op: FileCopy(SourceName=ihji0quu.con|DVStudio.exe.config,SourceCabKey=fileEE54A590D2CC2AE8647D5A5EB2C37313,DestName=DVStudio.exe.config,Attributes=4608,FileSize=5001,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,HashOptions=0,HashPart1=2020519154,HashPart2=1152590171,HashPart3=-1283096050,HashPart4=229789553,,)
MSI (s) (A8:28) [09:05:01:779]: File: C:\Program Files (x86)\DIAView\DVStudio.exe.config; Won't Overwrite; Won't patch; Existing file is unversioned but modified
This is the log for the second installation
MSI (s) (A8:D4) [09:06:04:078]: Executing op: FileCopy(SourceName=ihji0quu.con|DVStudio.exe.config,SourceCabKey=fileEE54A590D2CC2AE8647D5A5EB2C37313,DestName=DVStudio.exe.config,Attributes=4608,FileSize=5001,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,HashOptions=0,HashPart1=2020519154,HashPart2=1152590171,HashPart3=-1283096050,HashPart4=229789553,,)
MSI (s) (A8:D4) [09:06:04:079]: File: C:\Program Files (x86)\DIAView\DVStudio.exe.config; Overwrite; Won't patch; Existing file is unversioned and unmodified - hash doesn't match source file
MSI (s) (A8:D4) [09:06:04:079]: Source for file 'fileEE54A590D2CC2AE8647D5A5EB2C37313' is compressed
InstallFiles: File: DVStudio.exe.config, Directory: C:\Program Files (x86)\DIAView\, Size: 5001
MSI (s) (A8:D4) [09:06:04:081]: Re-applying security from existing file.
MSI (s) (A8:D4) [09:06:04:083]: Verifying accessibility of file: DVStudio.exe.config
MSI (s) (A8:D4) [09:06:04:084]: Using source file security for destination.
MSI (s) (A8:D4) [09:06:04:085]: Note: 1: 2318 2: C:\Config.Msi\8ba0779.rbf
Why is that?
Related
I come upon the warning message during uninstalls a product or major updates in the uninstall phase (when a product service is running):
"The setup must update files or service that cannot be updated while the system is running. If you choose continue, a reboot will be required to complete the setup."
Story starts here
I have developed the windows service and created the installer [msi] using Wix, then distributed to users. it is working as expected.
Now, it's time to deliver a new build with service enhancements. Hence, I have created a new msi. I was hoping that the execution of new msi shall upgrade the existing application.
But I get below error
The setup must update files or services that cannot be updated while the system is running
To support MSI upgrade, I have made below changes
Existing code for Product section
<?define UpgradeCode = "{3D197FE4-86DF-31FD-A0CD-21B5D3B97ABC}" ?>
<Product Id="$(var.ProductCode)"
Name="!(loc.ProductName_$(var.Platform)) $(var.ProductVersion)"
Language="!(loc.Language)"
Version="$(var.BuildVersion)"
Manufacturer="!(loc.Company)"
UpgradeCode="$(var.UpgradeCode)">
Changed code, Here Product ID changed to *
<?define UpgradeCode = "{3D197FE4-86DF-31FD-A0CD-21B5D3B97ABC}" ?>
<Product Id="*"
Name="!(loc.ProductName_$(var.Platform)) $(var.ProductVersion)"
Language="!(loc.Language)"
Version="$(var.ProductVersion)"
Manufacturer="!(loc.Company)"
UpgradeCode="$(var.UpgradeCode)">
Observe that upgrade code is not changed from old version to new version.
Existing code for upgrade
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />
Updated code for upgrade
<MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)"
AllowDowngrades="no"
AllowSameVersionUpgrades="yes"
RemoveFeatures="ALL"
Schedule="afterInstallInitialize"/>
Is it anything to do with service?
<ServiceControl Id="myservice"
Name="GatewayService"
Start="install"
Stop="both"
Remove="uninstall" Wait="yes" />
Install Sequence
How to get rid of this prompt? Also why it's coming if service is stopped.
Some part of logs
MSI (s) (78:5C) [19:54:21:691]: WIN64DUALFOLDERS: Substitution in 'C:\Program Files (x86)\Service\Service.dll' folder had been blocked by the 1 mask argument (the folder pair's iSwapAttrib member = 0).
The setup must update files or services that cannot be updated while
the system is running. If you choose to continue, a reboot will be
required to complete the setup.
MSI (s) (78:5C) [19:54:53:705]: Note: 1: 2727 2:
MSI (s) (78:5C) [19:54:53:706]: Doing action: RemoveExistingProducts
MSI (s) (78:5C) [19:54:53:706]: Note: 1: 2205 2: 3: ActionText
Action ended 19:54:53: InstallValidate. Return value 1.
MSI (s) (78:5C) [19:54:53:706]: Skipping RemoveExistingProducts action:
current configuration is maintenance mode or an uninstall
Action start 19:54:53: RemoveExistingProducts.
MSI (s) (78:5C) [19:54:53:706]: Doing action: InstallInitialize
MSI (s) (78:5C) [19:54:53:706]: Note: 1: 2205 2: 3: ActionText
Action ended 19:54:53: RemoveExistingProducts. Return value 0.
MSI (s) (78:5C) [19:54:53:708]: Machine policy value 'AlwaysInstallElevated' is 0
MSI (s) (78:5C) [19:54:53:708]: User policy value 'AlwaysInstallElevated' is 0
I have below code to restart service on failure. do u think it causes issue?
<util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart" />
Issue root cause
I see that old version is not getting deleted during upgrade. Hence created a new question here Wix installer upgrade with same "upgrade code" ID shows privilege error prompt
Issue resolved. Culprit was below code
<util:ServiceConfig xmlns:util="http://schemas.microsoft.com/wix/UtilExtension"
FirstFailureActionType="restart"
SecondFailureActionType="restart"
ThirdFailureActionType="restart" />
I have added delay as follow, and everything working like charm now.
RestartServiceDelayInSeconds="60"
Thanks to someone who thought the need for RestartServiceDelayInSeconds. Great thinking during ServiceConfig utility development
So I was installing MongoDB and this message kept popping up. I tried clicking on OK thinking that it would reboot the system but nothing happened. Then I turned off my internet and retried. It worked. This was weird but that's how my problem got resolved.
Symptoms
Users sometimes get one of the following error messages during uninstall through add/remove programs (or "Apps & Features" settings app):
Error 1316. The specified account already exists.
Error 1316. A network error occurred while attempting to read from the
file: C:\WINDOWS\Installer\NameOfOriginalSetup.msi
Actually these two are the exact same error, the first message only shows up when KB2918614 (aka "Secure Repair" patch) is installed and the product is not white-listed. It's just that the error code gets misinterpreted as a general system error instead of the actual MSI error in this case. Otherwise, KB2918614 doesn't matter.
Error 1406. Could not write value to key . Verify that you have sufficient access to that key, or contact your support personnel.
Seems to be less common. As the message box contains an "Ignore" button, which allows the uninstall to continue anyway, users are propably less inclined to report this error.
Log File
Obtained uninstall log file through msiexec -x {ProductCode} -l*vx LogFile.txt. Searching for "value 3" yields the part around the error location:
MSI (s) (B0:9C) [15:18:10:427]: Executing op: FeatureUnpublish(Feature=ProductFeature,,Absent=2,Component=iJm4+0tc4#uTvD')YKUXZ{NA8`o569(2MdBLg[rJ)
MSI (s) (B0:9C) [15:18:10:428]: Note: 1: 1402 2: UNKNOWN\Installer\Features\AFCEC7274CC7C0441A85705C47554DD5 3: 2
MSI (s) (B0:9C) [15:18:10:428]: Executing op: ActionStart(Name=InstallFiles,Description=Copying new files,Template=File: [1], Directory: [9], Size: [6])
MSI (s) (B0:9C) [15:18:10:428]: Executing op: ProgressTotal(Total=5,Type=0,ByteEquivalent=1)
MSI (s) (B0:9C) [15:18:10:428]: Executing op: SetTargetFolder(Folder=C:\Program Files\zett42\SpuriousFeatureAdvTest1\)
MSI (s) (B0:9C) [15:18:10:428]: Executing op: SetSourceFolder(Folder=1\zett42\xipmcfby\|zett42\SpuriousFeatureAdvTest1\)
MSI (s) (B0:9C) [15:18:10:428]: Executing op: ChangeMedia(,MediaPrompt=Please insert the disk: ,MediaCabinet=1\cab1.cab,BytesPerTick=65536,CopierType=1,,,SignatureRequired=0,,,IsFirstPhysicalMedia=1)
MSI (s) (B0:9C) [15:18:10:428]: Executing op: RegisterSharedComponentProvider(,,File=File2.txt,Component={3F28EEDB-866D-4201-8173-12532C657B6C},,ProductCode={727CECFA-7CC4-440C-A158-07C57455D45D},ProductVersion=1.0.0,PatchSize=0,PatchAttributes=0,PatchSequence=0,SharedComponent=0,IsFullFile=0)
MSI (s) (B0:9C) [15:18:10:428]: Executing op: FileCopy(SourceName=File2.txt,SourceCabKey=File2.txt,DestName=File2.txt,Attributes=512,FileSize=5,PerTick=65536,,VerifyMedia=1,,,,,CheckCRC=0,,,InstallMode=58982400,HashOptions=0,HashPart1=1397189395,HashPart2=108432067,HashPart3=-1009892414,HashPart4=374579663,,)
MSI (s) (B0:9C) [15:18:10:428]: File: C:\Program Files\zett42\SpuriousFeatureAdvTest1\File2.txt; To be installed; Won't patch; No existing file
MSI (s) (B0:9C) [15:18:10:428]: Resolving source.
MSI (s) (B0:9C) [15:18:10:428]: Using cached product context: machine assigned for product: AFCEC7274CC7C0441A85705C47554DD5
MSI (s) (B0:9C) [15:18:10:428]: Using cached product context: machine assigned for product: AFCEC7274CC7C0441A85705C47554DD5
MSI (s) (B0:9C) [15:18:10:429]: Resolving source to launched-from source.
MSI (s) (B0:9C) [15:18:10:429]: Setting launched-from source as last-used.
MSI (s) (B0:9C) [15:18:10:429]: PROPERTY CHANGE: Adding SourceDir property. Its value is 'C:\WINDOWS\Installer\'.
MSI (s) (B0:9C) [15:18:10:429]: PROPERTY CHANGE: Adding SOURCEDIR property. Its value is 'C:\WINDOWS\Installer\'.
MSI (s) (B0:9C) [15:18:10:429]: PROPERTY CHANGE: Adding SourcedirProduct property. Its value is '{727CECFA-7CC4-440C-A158-07C57455D45D}'.
MSI (s) (B0:9C) [15:18:10:429]: SOURCEDIR ==> C:\WINDOWS\Installer\
MSI (s) (B0:9C) [15:18:10:429]: SOURCEDIR product ==> {727CECFA-7CC4-440C-A158-07C57455D45D}
MSI (s) (B0:9C) [15:18:10:429]: Using cached product context: machine assigned for product: AFCEC7274CC7C0441A85705C47554DD5
MSI (s) (B0:9C) [15:18:10:429]: Determining source type
MSI (s) (B0:9C) [15:18:10:429]: Note: 1: 2203 2: C:\WINDOWS\Installer\SpuriousFeatureAdvTest1.msi 3: -2147287038
MSI (s) (B0:9C) [15:18:10:429]: Note: 1: 1316 2: C:\WINDOWS\Installer\SpuriousFeatureAdvTest1.msi
MSI (s) (B0:9C) [15:18:10:429]: SECREPAIR: Error determining package source type
MSI (s) (B0:9C) [15:18:10:429]: SECUREREPAIR: SecureRepair Failed. Error code: 524FD15800
MSI (s) (B0:9C) [15:18:11:146]: Note: 1: 2205 2: 3: Error
MSI (s) (B0:9C) [15:18:11:146]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1709
MSI (s) (B0:9C) [15:18:11:146]: Product: zett42 SpuriousFeatureAdvTest1 -- Error 1316. Das angegebene Konto ist bereits vorhanden.
MSI (c) (C4:38) [15:18:10:436]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg
Error 1316. Das angegebene Konto ist bereits vorhanden.
(The last log line is "The specified account already exists." in German.)
As can be seen from the log, the uninstallation tries to actually copy the file "File2.txt" to the hard drive (look for the FileCopy entry). This doesn't seem to make sense and of course it fails when the source is not available.
Also interesting are the feature and component states which are revealed further up in the log:
MSI (s) (B0:9C) [15:18:10:387]: Feature: ProductFeature; Installed: Advertise; Request: Absent; Action: Absent
MSI (s) (B0:9C) [15:18:10:387]: Component: File1; Installed: Absent; Request: Null; Action: Null; Client State: Unknown
MSI (s) (B0:9C) [15:18:10:387]: Component: File2; Installed: Local; Request: Null; Action: Local; Client State: Absent
Note that feature "ProductFeature" has "Installed: Advertise" state, though the feature was installed locally. The "Action: Local" for component "File2" matches what we saw in the log, that is Windows Installer wants the file installed locally during uninstall! Again, this doesn't make any sense to me.
Registry Defects
I've found out that on problem machines, random component registry keys of the product that could not be uninstalled, are missing:
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\<ComponentKey>
After manually adding the missing registry key, including all values from a clean installation state, the product could be successfully uninstalled.
It turns out that when any of the component registry keys are missing, Windows Installer determines the state of the feature that contains these components, as being "advertised". This is still not sufficient to cause error 1316 on uninstall. In fact, only when component files are physically missing on disk, an attempt for local copy is triggered by Windows Installer.
Minimal Example and Repro Steps
I have not yet been able to reproduce the problem "naturally", i. e. in the same way as it happens on customers machines. Only by manually deleting one of the above mentioned component registry keys, I can artificially reproduce the problem.
Build a minimal WiX setup that installs two files, "File1.txt" and "File2.txt":
<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<?define ProductName = "SpuriousFeatureAdvTest1"?>
<?define Manufacturer = "zett42"?>
<?if $(var.Platform) = x64 ?>
<?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
<?else ?>
<?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
<?endif ?>
<Product Id="*" Name="$(var.Manufacturer) $(var.ProductName)" Language="1033" Version="1.0.0.0" Manufacturer="$(var.Manufacturer)" UpgradeCode="{65CEA630-EFC0-4199-86EE-88867AABEDEF}">
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
<MajorUpgrade DowngradeErrorMessage="A newer version of $(var.ProductName) is already installed." />
<MediaTemplate />
<Feature Id="ProductFeature" Title="$(var.ProductName)" Level="1" AllowAdvertise="no" >
<ComponentGroupRef Id="ProductComponents" />
</Feature>
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="$(var.PlatformProgramFilesFolder)">
<Directory Id="MANUFACTURERFOLDER" Name="$(var.Manufacturer)">
<Directory Id="INSTALLFOLDER" Name="$(var.ProductName)" />
</Directory>
</Directory>
</Directory>
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="File1" Guid="{19819F06-DD45-4B48-BD00-810DEF7C0297}">
<File Source="File1.txt"/>
</Component>
<Component Id="File2" Guid="{3F28EEDB-866D-4201-8173-12532C657B6C}">
<File Source="File2.txt"/>
</Component>
</ComponentGroup>
</Product>
</Wix>
Install the MSI file.
Delete the following registry key that belongs to component "File1":
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Components\60F9189154DD84B4DB0018D0FEC72079
Delete a key file that belongs to any of the other components of the same feature, in this case "File2":
c:\Program Files\zett42\SpuriousFeatureAdvTest1\File2.txt
Try to uninstall the product via "Add/Remove Programs" or "Apps & Features".
Uninstallation fails with "Error 1316" message.
Attempted solutions / workarounds
For support: The Microsoft Program Install and Uninstall troubleshooter successfully removes the problematic product.
I have tried to disable advertising of the feature (<Feature AllowAdvertise="no"/>), but it doesn't change anything.
Question
What could be possible causes of the problem and how to actually solve it?
Violation of component rules in the setup. Although I cannot exclude this cause, it seems unlikely as the missing component registry key(s) are random and only a small percentage of users is affected.
Interference of 3rd party software, like AV or registry cleanup utilities.
Disk or memory failures.
Bug in Windows Installer.
Anything else?
Searching for the error message shows that the problem is quite common. In some cases the error is caused by changing the file name of the MSI during a minor upgrade. This is definitely not the case here, because we don't do minor upgrades and the MSI files of the problematic setups were not renamed. As explained above it is very clear that there is a registry defect. A possibly similar case is described here, but the answer doesn't explain anything, it just points to the MS troubleshooting tool.
I have been able to reproduce the problem using a registry cleaner.
Repro Steps:
Install a program using Windows Installer.
Delete one or more files that are keyfiles of their components from the program folder.
Run the registry cleaner. The cleaner mistakenly determined that the Windows Installer component registry keys, who's keyfiles don't exist, are no longer needed. The cleaner deletes the registry keys.
Delete more files that are keyfiles of their components from the program folder.
Try to uninstall the program. It fails with error 1316.
Even without step 4, this uninstall will be broken, because any other resources installed by components of the same feature that contains the deleted components, won't be uninstalled. Delete one component registry key and the whole feature won't be uninstalled anymore!
With step 4, the issue turns into a problem, as the whole uninstall will rollback. It may also turn into an install problem, when the uninstall runs as part of a major upgrade that requires the older version to be removed first.
While the steps appear somewhat artificial, it is certainly not unlikely that users manually delete files from a programs installation folder. This could also happen accidentally when programs are installed on removable disks and the cleaner runs after the disk has been removed. Other reasons could be thought of.
Solution:
Don't use registry cleaners. While some may actually work, there is always the risk that they break something.
If error 1316 or 1406 occur during uninstall of any program (possibly also during major upgrade, when the older version gets removed), use Microsoft Program Install and Uninstall troubleshooter in "uninstall" mode. In some cases you may also succeed by rerunning the original setup package used to install the program.
I'm using wix tool 3.11 to create a msi which install a service. The installer runs a Custom Action and returns vars to wix to write to registry (HKLM). The service starts and try to read the registry but it can't be done and it fails. If I wrote the registry manually the installer works perfectly.
Error message from msi logs:
Product: Installer-- Error 1920. Service 'XPTO Server' (xpto_server) failed to start. Verify that you have sufficient privileges to start system services.
My Wix XML:
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" InstallPrivileges="elevated" />
...
<ComponentGroup Id="ProductComponents" Directory="INSTALLFOLDER">
<Component Id="CMP_RegistryEntries" Guid="xxxxxxxxx" >
<RegistryKey Root="HKLM" Key="SOFTWARE\XPTOInc\XPTO\XPTOServer\BetaVersion">
<RegistryValue Name="token" Action="write" Value="[TOKEN]" Type="string" KeyPath="yes" />
<RegistryValue Name="[IDENTIFIER_TYPE]" Action="write" Value="[INSTALLEDID]" Type="string" />
<RegistryValue Name="installDir" Action="write" Value="[INSTALLFOLDER]" Type="string" />
</RegistryKey>
</Component>
<Component Id="CMP_XPTOServerEXE" Guid="xxxxxx">
<File Id="FILE_XPTOServerEXE" Name="xpto-server.exe" Source="Work\xpto-server.exe" KeyPath="yes" />
<ServiceInstall Id="InstallExporterService" Name="xpto_server" DisplayName="XPTO Server" Description="Read data from Registry and do simple stuff" ErrorControl="normal" Start="auto" Type="ownProcess" />
<ServiceControl Id="ServiceStateControl" Name="xpto_server" Remove="uninstall" Start="install" Stop="both" />
</Component>
</ComponentGroup>
EDIT: When I manually wrote the vars to Registry, the service installs with msi pkg or running with sc.exe
EDIT 2: Here follows the log where sets the registry and then star service
MSI (s) (70:74) [15:40:37:560]: Created Custom Action Server with PID 16808 (0x41A8).
MSI (s) (70:E4) [15:40:37:613]: Running as a service.
MSI (s) (70:E4) [15:40:37:615]: Hello, I'm your 32bit Elevated Non-remapped custom action server.
MSI (s) (70:38) [15:40:37:973]: Executing op: ActionStart(Name=WriteRegistryValues,Description=Writing system registry values,Template=Key: [1], Name: [2], Value: [3])
Action 15:40:37: WriteRegistryValues. Writing system registry values
MSI (s) (70:38) [15:40:37:974]: Executing op: ProgressTotal(Total=3,Type=1,ByteEquivalent=13200)
MSI (s) (70:38) [15:40:37:975]: Executing op: RegOpenKey(Root=-2147483646,Key=SOFTWARE\XPTOInc\XPTO\XPTOServer\BetaVersion,,BinaryType=0,,)
MSI (s) (70:38) [15:40:37:975]: Executing op: RegAddValue(Name=token,Value=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx,)
WriteRegistryValues: Key: \SOFTWARE\XPTOInc\XPTO\XPTOServer\BetaVersion, Name: token, Value: xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
MSI (s) (70:38) [15:40:37:976]: Executing op: RegAddValue(Name=envId,Value=xxxxxxxxxxxxxxxxxxxxxxxx,)
WriteRegistryValues: Key: \SOFTWARE\XPTOInc\XPTO\XPTOServer\BetaVersion, Name: envId, Value: xxxxxxxxxxxxxxxxxxxxxxxxx
MSI (s) (70:38) [15:40:37:976]: Executing op: RegAddValue(Name=installDir,Value=C:\Program Files (x86)\XPTOInc\XPTO\XPTO Server Beta\,)
WriteRegistryValues: Key: \SOFTWARE\XPTOInc\XPTO\XPTOServer\BetaVersion, Name: installDir, Value: C:\Program Files (x86)\XPTOInc\XPTO\XPTO Server Beta\
MSI (s) (70:38) [15:40:37:977]: Executing op: ActionStart(Name=InstallServices,Description=Installing new services,Template=Service: [2])
Action 15:40:37: InstallServices. Installing new services
MSI (s) (70:38) [15:40:37:977]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (70:38) [15:40:37:978]: Executing op: ServiceInstall(Name=xpto_server,DisplayName=XPTOServer,ImagePath="C:\Program Files (x86)\XPTOInc\XPTO\XPTO Server Beta\xpto-server.exe",ServiceType=16,StartType=2,ErrorControl=1,,Dependencies=[~],,,Password=**********,Description=Read data from Registry and do simple stuff,,)
InstallServices: Service:
MSI (s) (70:38) [15:40:37:980]: Executing op: ActionStart(Name=StartServices,Description=Starting services,Template=Service: [1])
Action 15:40:37: StartServices. Starting services
MSI (s) (70:38) [15:40:37:981]: Executing op: ProgressTotal(Total=1,Type=1,ByteEquivalent=1300000)
MSI (s) (70:38) [15:40:37:981]: Executing op: ServiceControl(,Name=xpto_server,Action=1,,)
StartServices: Service: XPTO Server
Error 1920. Service 'XPTO Server' (xpto_server) failed to start. Verify that you have sufficient privileges to start system services.
Solution: The problem in this case was that the registry keys were not found in the expected location in the registry due to 32-bit / 64-bit issues.
64-bit section: HKEY_LOCAL_MACHINE\SOFTWARE\Company\App - MyValue
32 bit section: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Company\App - MyValue
End of answer. Leaving debugging efforts in place below though:
Round 1:
Maybe try to read these two recent answers and check if anything rings a bell:
Wix Service Installer sometimes fails to install or start
Wix - ServiceControl start takes four minutes to fail, should be 30 sec
What does it say in the event viewer? (Windows + R eventvwr and OK)
Round 2:
Bitness: Are you sure you are reading from the right location in the registry? Are you installing a 32-bit MSI or a 64-bit MSI? (looks like 32-bit)
64-bit section: HKEY_LOCAL_MACHINE\SOFTWARE\Company\App
32 bit section: HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Company\App
Permissions: Did you check the permissions for the registry keys and values your setup writes using regedit.exe to inspect? Right click => Permissions (have to ask).
Privileges: What account do you use to run the service? It sort of looks like standard LocalSystem? The account needs the SeServiceLogonRight privilege. See second line on section above for details.
Logging: Do you use log4net or some other logging feature in your service? Did you try the verbose, debug MSI logging found in the first link in the top section?
Using WiX 3.11 I've developed a simple installation file which installs one DLL in the global assembly cache:
<Directory Id="TARGETDIR" Name="SourceDir">
<Component Id="CMP_ABC"
Guid="XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
Permanent="no"
Shared="yes" >
<File Id="File_ABC"
Assembly=".net"
Source="ABC.dll"
KeyPath="yes"
Vital="yes"/>
</Component>
</Directory>
Installation works and the file is placed in the GAC_32 folder. When trying to uninstall the package and the file is currently in use by a different process (loaded in Visual Studio for example), the file does not get uninstalled and the WiX installation package does not return any error:
MSI (s) (68:EC) [09:24:58:210]: MsiProvideAssembly is returning: 1607
MSI (s) (68:EC) [09:24:58:429]: Assembly Error:The process cannot access the file because it is being used by another process.
MSI (s) (68:EC) [09:24:58:429]: Note: 1: 1935 2: {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} 3: 0x80070020 4: IAssemblyCache 5: UninstallAssembly 6: ABC,version="X.YY.ZZ.0",culture="neutral",publicKeyToken="XXXXXXXXXXXXXXXX",processorArchitecture="x86"
MSI (s) (68:EC) [09:24:58:429]: Note: 1: 2205 2: 3: Error
MSI (s) (68:EC) [09:24:58:429]: Note: 1: 2228 2: 3: Error 4: SELECT `Message` FROM `Error` WHERE `Error` = 1935
The last line however always shows
MSI (c) (30:88) [09:24:59:505]: Product: ABC -- Configuration completed successfully.
Is it possible to fail the uninstallation if the file is currently in use or for some other reason cannot be removed?
Major upgrade does not work correctly for following installation.
If the previous version of the application is installed on the current PC, then during major upgrade old version will be automatically uninstalled, but new version is not installed by some reason.
I need to run this new installation twice in order to uninstall the old version and then install new one.
But if I comment out the custom action LaunchApplication in the old version of installation, then there will not be any problems and old version will be uninstalled and new version will be installed during the one run of the new installation.
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name='Foobar 2.0.0' Id='GUID' UpgradeCode='GUID'
Language='1033' Codepage='1252' Version='2.0.0' Manufacturer='Acme Ltd.'>
<Package Id='*' Keywords='Installer' Description="Acme's Foobar 2.0.0 Installer"
Comments='Foobar is a registered trademark of Acme Ltd.' Manufacturer='Acme Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
<Property Id='ApplicationFolderName' Value="Acme" />
<Property Id='WixAppFolder' Value="WixPerUserFolder" />
<Upgrade Id='GUID'>
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
Minimum='0.0.1' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='no' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
Minimum='2.0.0' IncludeMinimum='no' />
</Upgrade>
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="Acme's Foobar 2.0.0 Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='Acme' Name='Acme'>
<Directory Id='INSTALLDIR' Name='Foobar 2.0.0'>
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id='start.vbs' Guid='GUID'>
<File Id='start.vbs' Name='start.vbs' DiskId='1' Source='start.vbs' KeyPath='yes' >
</File>
</Component>
</DirectoryRef>
<Feature Id='Complete' Title='Foobar 2.0.0' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
<ComponentRef Id='start.vbs' />
</Feature>
</Feature>
<CustomAction Id='AlreadyUpdated' Error='[ProductName] has already been updated to 2.0.0 or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' />
<Property Id="WixShellExecTarget" Value="[#start.vbs]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
<Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom>
<RemoveExistingProducts Before="InstallInitialize" />
<Custom Action="LaunchApplication" After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
</Wix>
What could be wrong with this installation or with custom action?
VBS procedure is empty.
start.vbs:
Private Function startServerSub()
End Function
startServerSub
What should be changed to have ability to uninstall previous version and install new one during one run of new application?
UPDATE:
I changed my installation a little.
1. RemoveExistingProducts will be executed after InstallInitialize.
2. Added SELFFOUND to Upgrade element.
<?xml version='1.0' encoding='windows-1252'?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name='TestApp 2.0.0' Id='GUID' UpgradeCode='GUID'
Language='1033' Codepage='1252' Version='2.0.0' Manufacturer='TestManufacturer Ltd.'>
<Package Id='*' Keywords='Installer' Description="TestManufacturer's TestApp 2.0.0 Installer"
Comments='TestAppis a registered trademark of TestManufacturer Ltd.' Manufacturer='TestManufacturer Ltd.'
InstallerVersion='100' Languages='1033' Compressed='yes' SummaryCodepage='1252' />
<Property Id="ALLUSERS" Secure="yes" Value="2" />
<Property Id="MSIINSTALLPERUSER" Secure="yes" Value="1" />
<Property Id='ApplicationFolderName' Value="TestManufacturer" />
<Property Id='WixAppFolder' Value="WixPerUserFolder" />
<Upgrade Id='GUID'>
<UpgradeVersion OnlyDetect='yes' Property='SELFFOUND'
Minimum='2.0.0' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='yes' />
<UpgradeVersion OnlyDetect='no' Property='PREVIOUSFOUND'
Minimum='0.0.1' IncludeMinimum='yes'
Maximum='2.0.0' IncludeMaximum='no' />
<UpgradeVersion OnlyDetect='yes' Property='NEWERFOUND'
Minimum='2.0.0' IncludeMinimum='no' />
</Upgrade>
<Media Id='1' Cabinet='Sample.cab' EmbedCab='yes' DiskPrompt="CD-ROM #1" />
<Property Id='DiskPrompt' Value="TestManufacturer's TestApp 2.0.0 Installation [1]" />
<Directory Id='TARGETDIR' Name='SourceDir'>
<Directory Id='ProgramFilesFolder' Name='PFiles'>
<Directory Id='TestManufacturer' Name='TestManufacturer'>
<Directory Id='INSTALLDIR' Name='TestApp 2.0.0'>
</Directory>
</Directory>
</Directory>
</Directory>
<DirectoryRef Id="INSTALLDIR">
<Component Id='start.vbs' Guid='GUID'>
<File Id='start.vbs' Name='start.vbs' DiskId='1' Source='start.vbs' KeyPath='yes' >
</File>
</Component>
</DirectoryRef>
<Feature Id='Complete' Title='TestApp 2.0.0' Description='The complete package.'
Display='expand' Level='1' ConfigurableDirectory='INSTALLDIR'>
<Feature Id='MainProgram' Title='Program' Description='The main executable.' Level='1'>
<ComponentRef Id='start.vbs' />
</Feature>
</Feature>
<CustomAction Id='AlreadyUpdated' Error='[ProductName] has already been updated to 2.0.0 or newer.' />
<CustomAction Id='NoDowngrade' Error='A later version of [ProductName] is already installed.' />
<Property Id="WixShellExecTarget" Value="[#start.vbs]" />
<CustomAction Id="LaunchApplication"
BinaryKey="WixCA"
DllEntry="WixShellExec"
Execute="immediate"
Impersonate="yes" />
<InstallExecuteSequence>
<Custom Action='AlreadyUpdated' After='FindRelatedProducts'>SELFFOUND</Custom>
<Custom Action="NoDowngrade" After="FindRelatedProducts">NEWERFOUND</Custom>
<RemoveExistingProducts After="InstallInitialize" />
<Custom Action="LaunchApplication" After="InstallFinalize"/>
</InstallExecuteSequence>
</Product>
</Wix>
Then I created 4 installation packages:
1. Version 1.0.0 with custom action LaunchApplication after InstallFinalize.
2. Version 1.0.0 without custom action LaunchApplication.
3. Version 2.0.0 with custom action LaunchApplication after InstallFinalize.
4. Version 2.0.0 without custom action LaunchApplication.
It is impossible to install any type of version 2.0.0, if version 1.0.0 with custom action was installed.
I tried to install version 2.0.0(without custom action) after version 1.0.0(with custom action):
=== Verbose logging started: 7/22/2015 18:37:48 Build type: SHIP UNICODE 5.00.7601.00 Calling process: C:\Windows\system32\msiexec.EXE ===
...
Action 18:37:48: FindRelatedProducts. Searching for related applications
Action start 18:37:48: FindRelatedProducts.
FindRelatedProducts: Found application: {GUID of 1.0.0}
MSI (c) (A8:A4) [18:37:48:221]: PROPERTY CHANGE: Adding PREVIOUSFOUND property. Its value is '{GUID of 1.0.0}'.
...
Action start 18:37:48: InstallInitialize.
MSI (s) (F4:0C) [18:37:48:299]: Machine policy value 'AlwaysInstallElevated' is 0
MSI (s) (F4:0C) [18:37:48:299]: User policy value 'AlwaysInstallElevated' is 0
MSI (s) (F4:0C) [18:37:48:299]: BeginTransaction: Locking Server
MSI (s) (F4:0C) [18:37:48:299]: Note: 1: 1715 2: TestApp 2.0.0
MSI (s) (F4:0C) [18:37:48:299]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (F4:0C) [18:37:48:299]: Calling SRSetRestorePoint API. dwRestorePtType: 0, dwEventType: 102, llSequenceNumber: 0, szDescription: "Installed TestApp 2.0.0".
MSI (s) (F4:0C) [18:37:48:299]: The System Restore service is disabled. Returned status: 1058. GetLastError() returned: 1058
MSI (s) (F4:0C) [18:37:48:299]: Server not locked: locking for product {GUID of 2.0.0}
Action ended 18:37:48: InstallInitialize. Return value 1.
MSI (s) (F4:0C) [18:37:48:845]: Doing action: RemoveExistingProducts
MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2205 2: 3: ActionText
Action start 18:37:48: RemoveExistingProducts.
MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (F4:0C) [18:37:48:845]: Note: 1: 2262 2: Error 3: -2147287038
...
Action start 18:37:48: InstallFinalize.
...
MSI (s) (F4:AC) [18:37:48:939]: Verifying accessibility of file: start.vbs
MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2318 2:
MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2318 2:
...
Action ended 18:37:48: InstallFinalize. Return value 1.
MSI (s) (F4:AC) [18:37:48:939]: Doing action: LaunchApplication
MSI (s) (F4:AC) [18:37:48:939]: Note: 1: 2205 2: 3: ActionText
Action start 18:37:48: LaunchApplication.
MSI (s) (F4:AC) [18:37:48:939]: Creating MSIHANDLE (9) of type 790542 for thread 8108
MSI (s) (F4:B0) [18:37:48:939]: Invoking remote custom action. DLL: C:\Windows\Installer\MSIECB.tmp, Entrypoint: WixShellExec
MSI (s) (F4:24) [18:37:48:939]: Generating random cookie.
MSI (s) (F4:24) [18:37:48:939]: Created Custom Action Server with PID 8596 (0x2194).
MSI (s) (F4:48) [18:37:48:970]: Running as a service.
MSI (s) (F4:48) [18:37:48:970]: Hello, I'm your 32bit Impersonated custom action server.
MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (10) of type 790541 for thread 1140
MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (11) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:001]: Closing MSIHANDLE (11) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:001]: Creating MSIHANDLE (12) of type 790531 for thread 1140
WixShellExec: Error 0x80070002: ShellExec failed with return code 2
MSI (s) (F4!74) [18:37:49:001]: Closing MSIHANDLE (12) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:017]: Creating MSIHANDLE (13) of type 790531 for thread 1140
WixShellExec: Error 0x80070002: failed to launch target
MSI (s) (F4!74) [18:37:49:017]: Closing MSIHANDLE (13) of type 790531 for thread 1140
MSI (s) (F4!74) [18:37:49:017]: Closing MSIHANDLE (10) of type 790541 for thread 1140
CustomAction LaunchApplication returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (F4:B0) [18:37:49:017]: Closing MSIHANDLE (9) of type 790542 for thread 8108
Action ended 18:37:49: LaunchApplication. Return value 3.
Action ended 18:37:49: INSTALL. Return value 3.
...
Property(N): WixShellExecTarget = [#start.vbs]
...
CustomAction returned actual error code 1603 (note this may not be 100% accurate if translation happened inside sandbox)
MSI (s) (F4:0C) [18:37:49:017]: Note: 1: 2262 2: Error 3: -2147287038
MSI (s) (F4:0C) [18:37:49:017]: Note: 1: 2262 2: Error 3: -2147287038
Action ended 18:37:49: RemoveExistingProducts. Return value 3.
MSI (s) (F4:0C) [18:37:49:017]: User policy value 'DisableRollback' is 0
MSI (s) (F4:0C) [18:37:49:017]: Machine policy value 'DisableRollback' is 0
MSI (s) (F4:0C) [18:37:49:017]: Executing op: Header(Signature=1397708873,Version=500,Timestamp=1190565049,LangId=1033,Platform=0,ScriptType=2,ScriptMajorVersion=21,ScriptMinorVersion=4,ScriptAttributes=0)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: DialogInfo(Type=0,Argument=1033)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: DialogInfo(Type=1,Argument=TestApp 1.0.0)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: RollbackInfo(,RollbackAction=Rollback,RollbackDescription=Rolling back action:,RollbackTemplate=[1],CleanupAction=RollbackCleanup,CleanupDescription=Removing backup files,CleanupTemplate=File: [1])
MSI (s) (F4:0C) [18:37:49:017]: Executing op: SetTargetFolder(Folder=C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\)
MSI (s) (F4:0C) [18:37:49:017]: Executing op: FileCopy(SourceName=C:\Config.Msi\1bc1cc05.rbf,,DestName=C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\start.vbs,Attributes=40992,FileSize=331,PerTick=0,,VerifyMedia=0,ElevateFlags=1,,,,,,,InstallMode=4194308,,,,,,,)
MSI (s) (F4:0C) [18:37:49:017]: File: C:\Users\user1\AppData\Local\Programs\TestManufacturer\TestApp 1.0.0\start.vbs; To be installed; Won't patch; No existing file
...
MSI (s) (F4:0C) [18:37:49:126]: Executing op: End(Checksum=0,ProgressTotalHDWord=0,ProgressTotalLDWord=0)
MSI (s) (F4:0C) [18:37:49:126]: Error in rollback skipped. Return: 5
MSI (s) (F4:0C) [18:37:49:126]: No System Restore sequence number for this installation.
MSI (s) (F4:0C) [18:37:49:126]: Unlocking Server
MSI (s) (F4:0C) [18:37:49:173]: Note: 1: 2205 2: 3: Control
Action ended 18:37:49: INSTALL. Return value 3.
...
MSI (s) (F4:0C) [18:37:49:173]: MainEngineThread is returning 1603
MSI (s) (F4:78) [18:37:49:173]: RESTART MANAGER: Session closed.
MSI (s) (F4:78) [18:37:49:173]: RESTART MANAGER: Session closed.
MSI (s) (F4:78) [18:37:49:173]: No System Restore sequence number for this installation.
MSI (s) (F4:78) [18:37:49:173]: User policy value 'DisableRollback' is 0
MSI (s) (F4:78) [18:37:49:173]: Machine policy value 'DisableRollback' is 0
MSI (s) (F4:78) [18:37:49:173]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (F4:78) [18:37:49:173]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (F4:78) [18:37:49:173]: Note: 1: 1402 2: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Installer\Rollback\Scripts 3: 2
MSI (s) (F4:78) [18:37:49:189]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (s) (F4:78) [18:37:49:189]: Restoring environment variables
MSI (s) (F4:78) [18:37:49:189]: Destroying RemoteAPI object.
MSI (s) (F4:24) [18:37:49:189]: Custom Action Manager thread ending.
MSI (c) (A8:A4) [18:37:49:189]: Back from server. Return value: 1603
MSI (c) (A8:A4) [18:37:49:189]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (A8:A4) [18:37:49:189]: PROPERTY CHANGE: Deleting SECONDSEQUENCE property. Its current value is '1'.
Action ended 18:37:49: ExecuteAction. Return value 3.
Action ended 18:37:49: INSTALL. Return value 3.
...
=== Logging stopped: 7/22/2015 18:37:49 ===
MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 1708
MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 2262 2: Error 3: -2147287038
MSI (c) (A8:A4) [18:37:49:189]: Note: 1: 2262 2: Error 3: -2147287038
MSI (c) (A8:A4) [18:37:49:189]: Product: TestApp 2.0.0 -- Installation failed.
As I understand the root cause problem is that I do not use "NOT Installed AND NOT UPGRADINGPRODUCTCODE" condition in custom action LaunchApplication.
<Custom Action="LaunchApplication" After="InstallFinalize">NOT Installed AND NOT UPGRADINGPRODUCTCODE</Custom>
In this case installer during installation of new version removes the old version, and then tries to run custom action LaunchApplication from the old version, but all files are already removed. That's why installation fails.
I added condition "NOT Installed AND NOT UPGRADINGPRODUCTCODE" to LaunchApplication and now it is possible to perform major upgrade of my application.
But I am not sure which condition should I use - "NOT Installed AND NOT UPGRADINGPRODUCTCODE" or "NOT Installed".
I need to run custom action LaunchApplication during first installation and during all major upgrades.
Not sure this is an answer but there's too much for a comment.
First, do the upgrades with verbose logging, msiexec.exe command with a /L*vx to see what's going on because there are a number of things that don't make sense.
Your custom action is after InstallFinalize, which means it is after the install has completed and committed so it cannot cause the the upgrade to fail.
Your RemoveExistingProducts is before InstallInitialize. This means that it is outside the install transaction that starts at InstallInitialize. It really needs to be just after InstallInitialize to be included in the transation because currently it is independent of your new product install, and so you can get any combination of the remove failing or working and your install failing or working and you can end up with an indeterminate set of products on your system. None, noth or one of them.
What's SELFFOUND? I'd expect an Upgrade element to refer to it but there isn't one. In general you should look at the MajorUpgrade element and set attributes such as AllowSameVersionUpgrades to No if you want to prevent installing a major upgrade with the same version. If SELFFOUND is intended to prevent installing the same MSI file twice, then don't bother because Windows won't let you do that anyway.
So there's not really enough info to see what's going on, but that CA can't be responsible. The most likely explanation is that the first upgrade fails - it removes the older product, then your new install fails, and because the remove is outside the transaction all you see is the remove working and your install failing. When you install again it's a fresh system, that's the main difference. Check the logs!