We have seen several issues where installation of Service Pack/Hotfix/GDR/CU fails to install on one or more components of SQL Server 2005. In this blog , I have tried to include few troubleshooting tips and tricks for these kinds of installation failures.

Whenever a hotfix installation fails, we start troubleshooting  with the log file usually located at  %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\Summary.txt

I am demonstrating an example to troubleshoot an issue where KB954606 (Security Update MS08-052) failed to install .

First , go to %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\ and see Summary.txt :

----------------------------------------------------------------------------------

Product Installation Status

Product                   : SQL Server Database Services 2005 (MSSQLSERVER)

Product Version (Previous): 3073

Product Version (Final)   :

Status                    : Failure

Log File                  : C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\SQL9_Hotfix_KB954606_sqlrun_sql.msp.log

Error Number              : 1635

Error Description         : Unable to install Windows Installer MSP file

----------------------------------------------------------------------------------

Above error is for SQL Server Database Services 2005 , so in this example I will display troubleshooting steps for Database Engine only.

To troubleshoot this issue, I like to analyze verbose log which is usually located at %ProgramFiles%\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\SQL9_Hotfix_KBnnnnnn_sqlrun_sql.msp.log .

[Where KBnnnnnn is a placeholder for the hotfix number which is failing to install. In our example, it is SQL9_Hotfix_KB954606_sqlrun_sql.msp.log .]

Partial Contents of SQL9_Hotfix_KB954606_sqlrun_sql.msp.log :

=== Verbose logging started: 1/18/2009  05:21:19  Build type: SHIP UNICODE 3.01.4000.4042  Calling process: c:\cf7b299b237d95aef330b0000d8d947f\hotfix.exe ===

MSI (c) (AC:D0) [17:45:28:483]: Resetting cached policy values

MSI (c) (AC:D0) [17:45:28:483]: Machine policy value 'Debug' is 0

MSI (c) (AC:D0) [17:45:28:483]: ******* RunEngine:

           ******* Product: {2373A92B-1C1C-4E71-B494-5CA97F96AA19}

           ******* Action:

           ******* CommandLine: **********

MSI (c) (AC:D0) [17:45:28:483]: Client-side and UI is none or basic: Running entire install on the server.

MSI (c) (AC:D0) [17:45:28:483]: Grabbed execution mutex.

MSI (c) (AC:D0) [17:45:28:515]: Cloaking enabled.

MSI (c) (AC:D0) [17:45:28:515]: Attempting to enable all disabled priveleges before calling Install on Server

MSI (c) (AC:D0) [17:45:28:530]: Incrementing counter to disable shutdown. Counter after increment: 0

MSI (s) (D0:F8) [17:45:28:546]: Grabbed execution mutex.

MSI (s) (D0:F4) [17:45:28:546]: Resetting cached policy values

MSI (s) (D0:F4) [17:45:28:546]: Machine policy value 'Debug' is 0

MSI (s) (D0:F4) [17:45:28:546]: ******* RunEngine:

******* Product: {2373A92B-1C1C-4E71-B494-5CA97F96AA19}

           ******* Action:

           ******* CommandLine: **********

MSI (s) (D0:F4) [17:45:28:546]: Machine policy value 'DisableUserInstalls' is 0

MSI (s) (D0:F4) [17:45:28:546]: Adding MSIINSTANCEGUID to command line.

MSI (s) (D0:F4) [17:45:28:546]: Warning: Local cached package 'C:\WINDOWS\Installer\638de4.msi' is missing.

MSI (s) (D0:F4) [17:45:28:546]: User policy value 'SearchOrder' is 'nmu'

MSI (s) (D0:F4) [17:45:28:546]: User policy value 'DisableMedia' is 0

MSI (s) (D0:F4) [17:45:28:546]: Machine policy value 'AllowLockdownMedia' is 0

MSI (s) (D0:F4) [17:45:28:546]: SOURCEMGMT: Media enabled only if package is safe.

MSI (s) (D0:F4) [17:45:28:546]: SOURCEMGMT: Looking for sourcelist for product {2373A92B-1C1C-4E71-B494-5CA97F96AA19}

:

:

:

:

:

MSI (s) (D0:F4) [17:45:47:452]: Opening existing patch 'C:\WINDOWS\Installer\9be677.msp'.

MSI (s) (D0:F4) [17:45:47:452]: Note: 1: 2203 2: C:\WINDOWS\Installer\9be677.msp 3: -2147287038

MSI (s) (D0:F4) [17:45:47:452]: Couldn't find local patch 'C:\WINDOWS\Installer\9be677.msp'. Looking for it at its source.

MSI (s) (D0:F4) [17:45:47:452]: Resolving Patch source.

MSI (s) (D0:F4) [17:45:47:452]: User policy value 'SearchOrder' is 'nmu'

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Media enabled only if package is safe.

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Looking for sourcelist for product {4A35EF4A-D868-4B15-A84D-3E8925AA9558}

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Adding {4A35EF4A-D868-4B15-A84D-3E8925AA9558}; to potential sourcelist list (pcode;disk;relpath).

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Now checking product {4A35EF4A-D868-4B15-A84D-3E8925AA9558}

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Media is enabled for product.

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Attempting to use LastUsedSource from source list.

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Trying source d:\05ba72b40ba6b4d61d14cd3c3283\HotFixSQL\Files\.

MSI (s) (D0:F4) [17:45:47:452]: Note: 1: 2203 2: d:\05ba72b40ba6b4d61d14cd3c3283\HotFixSQL\Files\sqlrun_sql.msp 3: -2147287037

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Source is invalid due to missing/inaccessible package.

MSI (s) (D0:F4) [17:45:47:452]: Note: 1: 1706 2: -2147483647 3: sqlrun_sql.msp

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Processing net source list.

MSI (s) (D0:F4) [17:45:47:452]: Note: 1: 1706 2: -2147483647 3: sqlrun_sql.msp

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Processing media source list.

MSI (s) (D0:F4) [17:45:47:452]: Note: 1: 2303 2: 87 3: E:\

MSI (s) (D0:F4) [17:45:47:452]: Note: 1: 2303 2: 87 3: E:\

MSI (s) (D0:F4) [17:45:47:452]: SOURCEMGMT: Resolved source to: 'sqlrun_sql.msp'

MSI (s) (D0:F4) [17:46:19:702]: Note: 1: 1314 2: sqlrun_sql.msp

MSI (s) (D0:F4) [17:46:19:702]: Unable to create a temp copy of patch 'sqlrun_sql.msp'.

MSI (s) (D0:F4) [17:46:19:702]: Note: 1: 1708

MSI (s) (D0:F4) [17:46:19:702]: Note: 1: 2729

MSI (s) (D0:F4) [17:46:19:702]: Note: 1: 2729

MSI (s) (D0:F4) [17:46:19:702]: Product: Microsoft SQL Server 2005 -- Installation failed.

MSI (s) (D0:F4) [17:46:19:718]: MainEngineThread is returning 1635

This patch package could not be opened.  Verify that the patch package exists and that you can access it, or contact the application vendor to verify that this is a valid Windows Installer patch package.

C:\SQLSETUP\Servers\Setup\SqlRun_SQL.msi

MSI (c) (AC:D0) [17:46:19:827]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied.  Counter after decrement: -1

MSI (c) (AC:D0) [17:46:19:827]: MainEngineThread is returning 1635

=== Verbose logging stopped: 1/20/2009  17:46:19 ===

1. The very first error I see in the above log is Local cached package 'C:\WINDOWS\Installer\638de4.msi' is missing. This file 638de4.msi is the cached msi file for sqlrun_sql.msi i.e. the main installation (RTM) of an instance of SQL Server Database Engine. During installation of RTM product, ..\Servers\Setup\SqlRun_SQL.msi is cached to %windir%\Installer folder for future use such as un-installation etc. Cached file has a different name which is a randomized alphanumeric name generated by the installer , this is because if you have multiple instances then multiple ‘Sqlrun_sql.msi’ has to be cached and hence a name conflict may occur. Anyways, if you know the GUID (ProductCode) of the instance , you can find the name of this cached file , go to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\<GUID>\InstallProperties

In the right pane , look for the value of “LocalPackage” .

2. Now that we knew 'C:\WINDOWS\Installer\638de4.msi' is missing , we need to put it back to C:\Windows\Installer. To do so , locate your main installation setup of SQL Server (viz. CD media or setup folder copied on local disk) , copy Servers\Setup\SqlRun_SQL.msi and paste it into C:\Windows\Installer , rename it to the cached filename , in our case we have to rename it to 638de4.msi. Double check that C:\WINDOWS\Installer\638de4.msi is available now.

3. Let’s look for the next error in the log file and that is Couldn't find local patch 'C:\WINDOWS\Installer\9be677.msp'. Looking for it at its source .The filename 9be677.msp employs it is a MSP file means a patch , not a main product. I want to make it clear here that If we apply any patch , installer looks for the cached files of previously applied patche(s) as well as the cached msi file. So this cached msp file is also missing and we need to put it back. But the challenge is how to find which patch is this ? It is explained in following steps.

4. In the following lines in log file, we see : Looking for sourcelist for product {4A35EF4A-D868-4B15-A84D-3E8925AA9558} means the PatchCode for missing msp file 9be677.msp is {4A35EF4A-D868-4B15-A84D-3E8925AA9558}. Also, from ******* Product: {2373A92B-1C1C-4E71-B494-5CA97F96AA19} , we know the ProductCode i.e. GUID is {2373A92B-1C1C-4E71-B494-5CA97F96AA19} .

So we have below info till this point :

GUID          = {2373A92B-1C1C-4E71-B494-5CA97F96AA19}

PatchCode     = {4A35EF4A-D868-4B15-A84D-3E8925AA9558}

The GUID and PatchCode are stored in registry in encrypted format. Search* (See Search Hints below) them ,open regedit , go to

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\<GUID>\Patches\<PatchCode>

In the right pane , see the value of “DisplayName” . In our case , it was like below :

DisplayName = Service Pack 2 for SQL Server Database Services 2005 ENU (KB921896)

So DisplayName explains that {4A35EF4A-D868-4B15-A84D-3E8925AA9558} is Patch Code for KB921896 i.e. SP2 .

5. Recall Step 3 , we found the missing msp file i.e. 9be677.msp is for KB921896 . In order to put his cached msp file back , download KB921896 , extract it at a command prompt using switch /extract , go to extracted directory of KB921896 and copy ..\ hotfixsql\files\sqlrun_sql.msp , paste it in C:\Windows\Installer and rename it to 9be677.msp . Double check that 'C:\WINDOWS\Installer\9be677.msp' exists now.

6. Now that we have made available both the missing files (msi and msp) , apply the patch (in our case KB954606) again which failed to install .It should succeed now. However , in case if it fails again, that may be due to the fact that it might be looking for some other patch which might have been applied previously and is missing now. If so, failure installation will again generate verbose log , open the verbose log (like SQL9_Hotfix_KB954606_sqlrun_sql.msp.log) , look at 15-20 lines above the bottom of the log file , you may find Couldn't find local patch , put the appropriate cached msp file back to C:\Windows\Installer , rename it appropriately and re-try the setup.

[It’s expected that log file after performing above steps won’t complain for ‘*.msi file is missing’ anymore .]

7. For other failing components like AS, RS, NS, Tools, IS  etc please follow the troubleshooting method as explained in step1 to step6 looking at the appropriate verbose log file. Please note that GUID, msp filename and msp file path in the extracted folder would be different for different components. Choose carefully.

Hope this helps !

*Search Hints  :

1.          As ‘Note’ of KB article 938321 explains , to locate the specific Product Code registry subkey, search for the ProductName registry entry that has the value of "Microsoft SQL Server 2005 (InstanceName)"

under the HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\ registry subkey.

2.          Alternatively, see this link , very useful in locating GUID in registry .

Additionally, you may see these errors as well in Summary.txt under Hotfix folder :

----------------------------------------------------------------------------------

Error Number              : 1642

Error Description         : Unable to install Windows Installer MSP file

----------------------------------------------------------------------------------

Error Number              : 1612

Error Description         : Unable to install Windows Installer MSP file

----------------------------------------------------------------------------------

Error Number              : 1646

Error Description         : Unable to install Windows Installer MSP file

----------------------------------------------------------------------------------

Please see KB304888 for a list of error codes and error messages for Windows Installer processes.

Some More Information :

Service Pack/Hotfix/GDR/CU contains MSP files as compared to RTM product which has MSI files.

What is MSP ?

--------------------

A MSP (Microsoft Software Patch) is basically a set of transforms (modifications) against a baseline MSI (Microsoft Software Installer) file.  When a MSP is installed, instead of updating the contents of the cached MSI (modifying it according to the transforms included in the MSP), Windows Installer simply caches the MSP.  Then each time the MSI is run, the cached MSP is applied on the fly again.  The reason it works this way is to simplify the authoring and building of MSPs, so that each MSP can be built only against RTM and not have to know about all the possible MSPs that have been released since then.  For example, when SP2 is applied the SP1 patch is obsolete and Windows Installer just applies SP2 directly against the cached contents of the RTM product.

(credits for this article - Prashant Kumar SE, Microsoft SQL Server)