Search This Blog

Tuesday, September 22, 2009

SQL 2005 Patch Fails with Error 1635 "Unable to Install Windows Installer MSP"

SQL Server 2005 Patch Fails to install with an error "Unable to install Windows Installer MSP file"

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.txtI am demonstrating an example to troubleshoot an issue where KB953752 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): 3042
Product Version (Final) :
Status : Failure
Log File : C:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\LOG\Hotfix\SQL9_Hotfix_KB953752_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. We can get the similar kind of error for Analysis Services (SQLRUN_AS.SQL), Reporting Services (SQLRUN_RS.SQL), Notification Services (SQLRUN_NS.SQL) and Client Tools (SQLRUN_TOOLS.SQL).

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_KB953752_sqlrun_sql.msp.log .]

Partial Contents of SQL9_Hotfix_KB953752_sqlrun_sql.msp.log :
=== Verbose logging started: 9/15/2009 0:56:20 Build type: SHIP UNICODE 3.01.4000.4042 Calling process: c:\560c299829b765ffbb1a9492e89e2e\hotfix.exe ===
MSI (c) (80:04) [00:56:20:292]: Resetting cached policy values
MSI (c) (80:04) [00:56:20:292]: Machine policy value 'Debug' is 0
MSI (c) (80:04) [00:56:20:292]: ******* RunEngine:
******* Product: {130A3BE1-85CC-4135-8EA7-5A724EE6CE2C}
******* Action:
******* CommandLine: **********
MSI (c) (80:04) [00:56:20:308]: Client-side and UI is none or basic: Running entire install on the server.
MSI (c) (80:04) [00:56:20:308]: Grabbed execution mutex.
MSI (c) (80:04) [00:56:20:323]: Cloaking enabled.
MSI (c) (80:04) [00:56:20:323]: Attempting to enable all disabled priveleges before calling Install on Server
MSI (c) (80:04) [00:56:20:354]: Incrementing counter to disable shutdown. Counter after increment: 0
MSI (s) (38:B8) [00:56:20:401]: Grabbed execution mutex.
MSI (s) (38:BC) [00:56:20:401]: Resetting cached policy values
MSI (s) (38:BC) [00:56:20:401]: Machine policy value 'Debug' is 0
MSI (s) (38:BC) [00:56:20:401]: ******* RunEngine:
******* Product: {130A3BE1-85CC-4135-8EA7-5A724EE6CE2C}
******* Action:
******* CommandLine: **********
MSI (s) (38:BC) [00:56:20:401]: Machine policy value 'DisableUserInstalls' is 0
MSI (s) (38:BC) [00:56:20:401]: Adding MSIINSTANCEGUID to command line.
MSI (s) (38:BC) [00:56:20:417]: Warning: Local cached package 'C:\WINDOWS\Installer\5307c.msi' is missing.
MSI (s) (38:BC) [00:56:20:417]: User policy value 'SearchOrder' is 'nmu'
MSI (s) (38:BC) [00:56:20:417]: User policy value 'DisableMedia' is 0
MSI (s) (38:BC) [00:56:20:417]: Machine policy value 'AllowLockdownMedia' is 0
MSI (s) (38:BC) [00:56:20:417]: SOURCEMGMT: Media enabled only if package is safe.
MSI (s) (38:BC) [00:56:20:417]: SOURCEMGMT: Looking for sourcelist for product {130A3BE1-85CC-4135-8EA7-5A724EE6CE2C}
:
:
:
:
:
MSI (s) (38:BC) [00:57:27:434]: Opening existing patch 'c:\WINDOWS\Installer\8e91f857.msp'.
MSI (s) (38:BC) [00:57:27:450]: Note: 1: 2203 2: c:\WINDOWS\Installer\8e91f857.msp 3: -2147287038
MSI (s) (38:BC) [00:57:27:450]: Couldn't find local patch 'c:\WINDOWS\Installer\8e91f857.msp'. Looking for it at its source.MSI (s) (38:BC) [00:57:27:450]: Resolving Patch source.
MSI (s) (38:BC) [00:57:27:481]: User policy value 'SearchOrder' is 'nmu'
MSI (s) (38:BC) [00:57:27:481]: SOURCEMGMT: Media enabled only if package is safe.
MSI (s) (38:BC) [00:57:27:481]: SOURCEMGMT: Looking for sourcelist for product {4A35EF4A-D868-4B15-A84D-3E8925AA9558}MSI (s) (38:BC) [00:57:27:512]: SOURCEMGMT: Adding {4A35EF4A-D868-4B15-A84D-3E8925AA9558}; to potential sourcelist list (pcode;disk;relpath).
MSI (s) (38:BC) [00:57:27:512]: SOURCEMGMT: Now checking product {4A35EF4A-D868-4B15-A84D-3E8925AA9558}
MSI (s) (38:BC) [00:57:27:512]: SOURCEMGMT: Media is enabled for product.
MSI (s) (38:BC) [00:57:27:512]: SOURCEMGMT: Attempting to use LastUsedSource from source list.
MSI (s) (38:BC) [00:57:27:512]: SOURCEMGMT: Trying source c:\8bfd1e16f50b137a6a8397c0\HotFixSQL\Files\.
MSI (s) (38:BC) [00:57:27:528]: Note: 1: 2203 2: C:\8bfd1e16f50b137a6a8397c0\HotFixSQL\Files\sqlrun_sql.msp 3: -2147287037
MSI (s) (38:BC) [00:57:27:528]: SOURCEMGMT: Source is invalid due to missing/inaccessible package. MSI (s) (38:BC) [00:57:27:528]: Note: 1: 1706 2: -2147483647 3: sqlrun_sql.msp
MSI (s) (38:BC) [00:57:27:528]: SOURCEMGMT: Processing net source list.
MSI (s) (38:BC) [00:57:27:528]: Note: 1: 1706 2: -2147483647 3: sqlrun_sql.msp
MSI (s) (38:BC) [00:57:27:528]: SOURCEMGMT: Processing media source list.
MSI (s) (38:BC) [00:57:28:715]: SOURCEMGMT: Resolved source to: 'sqlrun_sql.msp'
MSI (s) (38:BC) [00:57:59:606]: Note: 1: 1314 2: sqlrun_sql.msp
MSI (s) (38:BC) [00:57:59:606]: Unable to create a temp copy of patch 'sqlrun_sql.msp'.
MSI (s) (38:BC) [00:57:59:638]: Note: 1: 1708
MSI (s) (38:BC) [00:57:59:638]: Note: 1: 2729
MSI (s) (38:BC) [00:57:59:685]: Note: 1: 2729
MSI (s) (38:BC) [00:57:59:685]: Product: Microsoft SQL Server 2005 -- Installation failed.
MSI (s) (38:BC) [00:57:59:981]: 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:\Scratch\SQL Svr Standard Edtn 2005 Win32 English Disk Kit MVL MVLS Only CD DVD\1\Setup\SqlRun_SQL.msi
MSI (c) (80:04) [00:58:00:091]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: -1
MSI (c) (80:04) [00:58:00:138]: MainEngineThread is returning 1635
=== Verbose logging stopped: 9/15/2009 0:58:00 ===

1. The very first error I see in the above log is Local cached package 'C:\WINDOWS\Installer\b7bac95c.msi' is missing. This file b7bac95c.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\\InstallProperties
In the right pane , look for the value of "LocalPackage" .

2. Now that we knew 'C:\WINDOWS\Installer\b7bac95c.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 b7bac95c.msi. Double check that C:\WINDOWS\Installer\b7bac95c.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\8e91f857.msp'. Looking for it at its source .The filename 8e91f857.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 8e91f857.msp is {4A35EF4A-D868-4B15-A84D-3E8925AA9558}. Also, from ******* Product: {130A3BE1-85CC-4135-8EA7-5A724EE6CE2C} , we know the ProductCode i.e. GUID is {130A3BE1-85CC-4135-8EA7-5A724EE6CE2C} .
So we have below info till this point :
GUID = {130A3BE1-85CC-4135-8EA7-5A724EE6CE2C}
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\\Patches\
Here is a catch, values for "GUID" & "PatchCode" will be in there reverse order like below:GUID = {1EB3A031CC585314E87AA527E46EECC2} PatchCode = {A4FE53A4-868D-51B4-8AD4-E39852AA5985)
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. 8e91f857.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 8e91f857.msp . Double check that 'C:\WINDOWS\Installer\8e91f857.msp' exists now.

6. Now that we have made available both the missing files (msi and msp) , apply the patch (in our case KB953752) 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_KB953752_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:\Windpws\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.

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.

I Hope this will help.
Regards
GURSETHI

1 comment:

Anonymous said...

Hi,
How can we view C2 Audit Tracing logs in AWS RDS SQL Server


Thanks,
Muralidharan Murugan