SQL Server Setup prompts with “The installed product does not match the installation source(s).” (Part I)

Recently I looked at an issue when upgrading from SQL Server 2005 to SQL Server 2008 and in the middle of the upgrade it would halt asking for a matching source for VSS Writer.  However, there is nothing descriptive to tell you what specific source it is that you need to choose to find the right match.   The customer that inspired this blog post had browsed over and over to what they figured was the source, but they kept getting prompted until they were finally forced to cancel and give Microsoft support a call.

This can happen for other components besides SQL Server VSS Writer, however the steps to address will be the same but just for a different component.  In this blog I will use the VSS Writer as the basis for an example to walk you through the steps.

(I am also pasting the text of the message here for search purposes.)

“The installed product does not match the installation source(s).  Until a matching source is provided or the installed product and source are synchronized, this action can not be performed.”

image

What’s happening here is that even though after you browse and choose a msi file, if the msi does not have the matching package code it will continue to prompt and not proceed.  So how do you find the right matching file and get out of this circle?  The following steps will walk you through how to address this.

1.   Copy the script at the end of this blog and save it on the machine with the problem as GetCodeInfo.bat.  Anywhere on local disk is fine.  In this blog I will refer to this batch file as GetCodeInfo.bat.

2.   Open the related setup/uninstall log that has the failure.  For SQL Server 2008 you can find this “Log with failure” referred in the Summary.txt that is located in the Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log folder.  In my example the Log with failure was ‘E:\Program Files\Microsoft SQL Server\100\Setup Bootstrap\Log\20090513_160209\SqlWriter_Cpu32_1.log’.

3.   Open the log and browse until you find a section that looks like the following.  I have bolded in maroon the key items that I will explain:

MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Now checking product {56B4002F-671C-49F4-984C-C760FE3806B5}
MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Media is enabled for product.
MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Attempting to use LastUsedSource from source list.
MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Trying source E:\Program Files\Microsoft SQL Server\90\Setup Bootstrap\Cache\.
MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Source is invalid due to client source out of sync (product code is the same).
MSI (s) (20:48) [16:04:34:978]: Note: 1: 1731 2: -2147483645 3: SqlWriter.msi
MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Processing net source list.
MSI (s) (20:48) [16:04:34:978]: Note: 1: 1706 2: -2147483647 3: SqlWriter.msi
MSI (s) (20:48) [16:04:34:978]: SOURCEMGMT: Processing media source list.
MSI (s) (20:48) [16:04:35:994]: Note: 1: 2203 2: 3: -2147287037
MSI (s) (20:48) [16:04:35:994]: SOURCEMGMT: Source is invalid due to missing/inaccessible package.
MSI (s) (20:48) [16:04:35:994]: Note: 1: 1706 2: -2147483647 3: SqlWriter.msi
MSI (s) (20:48) [16:04:35:994]: SOURCEMGMT: Processing URL source list.
MSI (s) (20:48) [16:04:35:994]: Note: 1: 1402 2: UNKNOWN\URL 3: 2
MSI (s) (20:48) [16:04:35:994]: Note: 1: 1706 2: -2147483647 3: SqlWriter.msi
MSI (s) (20:48) [16:04:35:994]: Note: 1: 1731 2: 3: SqlWriter.msi
MSI (c) (D0:A4) [16:04:35:994]: User policy value 'SearchOrder' is 'nmu'
MSI (c) (D0:A4) [16:04:35:994]: User policy value 'DisableMedia' is 0
MSI (c) (D0:A4) [16:04:35:994]: Machine policy value 'AllowLockdownMedia' is 0
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Media enabled only if package is safe.
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Prompting user for a valid source.
MSI (c) (D0:A4) [16:04:35:994]: Machine policy value 'DisableBrowse' is 0
MSI (c) (D0:A4) [16:04:35:994]: Machine policy value 'AllowLockdownBrowse' is 0
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Browsing is enabled.
MSI (c) (D0:A4) [16:04:35:994]: Font created. Charset: Req=0, Ret=0, Font: Req=MS Shell Dlg, Ret=MS Shell Dlg

MSI (c) (D0:A4) [16:04:35:994]: Machine policy value 'DisableUserInstalls' is 0
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Now checking product {56B4002F-671C-49F4-984C-C760FE3806B5}
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Media is enabled for product.
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Attempting to use LastUsedSource from source list.
MSI (c) (D0:A4) [16:04:35:994]: Note: 1: 1706 2: 3: SqlWriter.msi
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Processing net source list.
MSI (c) (D0:A4) [16:04:35:994]: Note: 1: 1706 2: -2147483647 3: SqlWriter.msi
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Processing media source list.
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Trying media source SqlWriter;.
MSI (c) (D0:A4) [16:04:35:994]: Note: 1: 1706 2: 3: SqlWriter.msi
MSI (c) (D0:A4) [16:04:35:994]: SOURCEMGMT: Processing URL source list.
MSI (c) (D0:A4) [16:04:35:994]: Note: 1: 1402 2: UNKNOWN\URL 3: 2
MSI (c) (D0:A4) [16:04:35:994]: Note: 1: 1706 2: -2147483647 3: SqlWriter.msi
MSI (c) (D0:A4) [16:04:35:994]: Note: 1: 1706 2: 3: SqlWriter.msi
MSI (c) (D0:58) [16:05:49:620]: SOURCEMGMT: Trying source \\kittycat\d$\BINARIES\Katmai_RTM\x86\Setup\x86\SqlWriter.msi.
MSI (c) (D0:58) [16:05:49:682]: Incrementing counter to disable shutdown. Counter after increment: 1
MSI (c) (DMSI (s) (20:B8) [16:05:52:713]: I/O on thread 3476 could not be cancelled. Error: 127
MSI (s) (20:B8) [16:05:52:713]: I/O on thread 3620 could not be cancelled. Error: 127
MSI (s) (20:B8) [16:05:52:713]: I/O on thread 2448 could not be cancelled. Error: 127
MSI (s) (20:B8) [16:05:52:713]: I/O on thread 3412 could not be cancelled. Error: 127
MSI (s) (20:B8) [16:05:52:713]: I/O on thread 2184 could not be cancelled. Error: 127
MSI (s) (20:B8) [16:05:52:713]: I/O on thread 3656 could not be cancelled. Error: 127
MSI (s) (20:48) [16:05:52:713]: SOURCEMGMT: Failed to resolve source
MSI (s) (20:48) [16:05:52:713]: MainEngineThread is returning 1612
0:58) [16:05:49:698]: Incrementing counter to disable shutdown. Counter after increment: 2
MSI (c) (D0:58) [16:05:49:745]: Decrementing counter to disable shutdown. If counter >= 0, shutdown will be denied. Counter after decrement: 1
MSI (c) (D0:58) [16:05:49:745]: SOURCEMGMT: Source is invalid due to invalid package code (product code doesn't match).

4.   What the bolded items in this log show is the windows installer has tried to find the matching msi from the current source entries that are stored in the registry and installer cache and did not result in a match.  In this case prompting for a valid source is enabled and is why you get the dialog prompt during setup and correlates to the log entry “SOURCEMGMT: Prompting user for a valid source.” .  Next in the log you can see where it tried the source that I had browsed from the dialog in the line that looks like  SOURCEMGMT: Trying source \\kittycat\d$\BINARIES\Katmai_RTM\x86\Setup\x86\SqlWriter.msi.  

However, this wasn’t the right msi and that is why it resulted in this message:

MSI (c) (D0:58) [16:05:49:745]: SOURCEMGMT: Source is invalid due to invalid package code (product code doesn't match).

5.   To look up the right msi, you will need to locate the code (GUID) that is referred in the line that starts with “Now checking product” before the “Source is invalid” error.  In my example the code is this one:

SOURCEMGMT: Now checking product {56B4002F-671C-49F4-984C-C760FE3806B5}

6.   Next, take that code and wash it through the batch file.  An example usage is:

C:\GetCodeInfo.bat {56B4002F-671C-49F4-984C-C760FE3806B5}

The batch file will look up the code and find the version and package information that you need.  In this example, the output showed the following:

*
Product code results...
*
Product name: Microsoft SQL Server VSS Writer
Product version: 9.00.3042.00
Local package: E:\WINDOWS\Installer\2ee6ea39.msi
Package name: SqlWriter.msi
Package code: {0E32A242-9E56-4D23-BD75-C1A25B595CB2}

In this example this shows that the particular .msi is the SqlWriter.msi and the version that installer is looking for is the 9.00.3042 (SQL 2005 SP2) SqlWriter.msi.  Since this is in a Service Pack, the next step is to extract the service pack binaries so that you can browse in the prompt to the appropriate file.  You can extract the binaries anywhere you want as long as you can browse to them.

a.   Make sure to point to the binaries that match the platform and edition of your installation! For example, if your installation is Enterprise Edition X64 and the version of binaries you need to point to are RTM, then be sure to browse to the X64 Enterprise Edition binaries.  If it is a service pack or patch that you need to point to, then make sure to extract the ones that match the platform of your installation.  In the example above, my install is X86, so I located the X86 SP2 SQLServer2005SP2-KB921896-x86-ENU.exe and then extracted with the /x option:

SQLServer2005SP2-KB921896-x86-ENU.exe /x

b.   Next locate in the RTM binaries or extracted files the package name indicated by the batch file.  The particular .msi may vary and if it is a patch it may be a .msp.  In this example it was the SqlWriter.msi and stored here in the SP2 binaries for x86 platform after I extracted:

SQLServer2005SP2-KB921896-x86-ENU\hotfixsqlwriter\files\sqlwriter.msi

You can now browse to the right .msi or .msp in the prompt.

How to use ORCA to confirm a match on the Package Code

If you want to be completely sure you are browsing to the matching package, you can use the Package code that is listed in the results from the batch file and then open the msi or msp you are browsing to in Orca and compare that you have a match on the Package Code. 

a.  You can install ORCA on any machine to do this check.  ORCA is included in the Windows SDK. 

https://msdn.microsoft.com/en-us/library/aa370557.aspx

  • Download and install the SDK
  • Navigate to the \bin folder (depending the version it will be something like Microsoft SDKs\Windows\v6.0\Bin or \Microsoft SDK\bin)
  • Double click the orca.msi file to install Orca.

b.  After you open ORCA, then go to File –> Open and browse to the .msi or .msp in the binaries you extracted and Open. 

c.  Then go to View -> Summary Information -> Look at the section Package Code: .  This package code needs to match the code that is referenced in the batch file output.  In this example the batch file indicated that the package code installer is expecting the msi to have is:

Package code: {0E32A242-9E56-4D23-BD75-C1A25B595CB2}

Typically I have found if I don’t have a match on the package code, I’ve either extracted the wrong version or have pointed to the wrong platform.

Variations

If it is a patch .msp that installer is looking for, the output of your batch script will look something like:

ERROR: The system was unable to find the specified registry key or value.
Not in product, checking in patches now...
*
Patch code results...
*
This code corresponds to patch: GDR 3077 for SQL Server Database Services 2005 ENU (KB960089)
Patch code is: {B21D60C7-4A8C-42A9-AF46-53F9136FCBC3}
Package Name is: sqlrun_sql.msp
Local package and path is: e:\WINDOWS\Installer\2f2c2709.msp

  • So in this case I needed to extract the GDR version 3077 from KB960089 and browse to that version of the sqlrun_sql.msp.
  • If you open the .msp in ORCA and go to View -> Summary Information –> Look at the section titled Patch Code: .  The msp you browse to needs to have the Patch code that matches the output from the batch script.

Additional Variations to be Continued in Part II

This same methodology and batch script can be used with other patch and update scenarios where you might not be prompted to browse to the needed source.  In those cases the patch or setup may fail with no prompt, but you see in the SQL Server 2005 or SQL Server 2008 setup log the same type of messages about the source being invalid because it is missing or because of invalid package code. 

@rem <------------------ BEGIN BATCH SCRIPT --------------------->
@rem Batch file to get related version, patch code and package name from code indicated in failing SQL setup log. @IF "%1"=="/?" GOTO :PrintUsage
@IF "%1"=="-?" GOTO :PrintUsage @IF "%1"=="?" GOTO :PrintUsage
@IF "%1"=="" GOTO :PrintUsage @set S=%1
@set Sa=%S:~26,1%%S:~25,1%%S:~28,1%%S:~27,1%%S:~30,1%%S:~29,1%%S:~32,1%%S:~31,1%%S:~34,1%%S:~33,1%%S:~36,1%%S:~35,1% @set Sb=%S:~21,1%%S:~20,1%%S:~23,1%%S:~22,1%
@set Sc=%S:~18,1%%S:~17,1%%S:~16,1%%S:~15,1% @set Sd=%S:~13,1%%S:~12,1%%S:~11,1%%S:~10,1%
@set Se=%S:~8,1%%S:~7,1%%S:~6,1%%S:~5,1%%S:~4,1%%S:~3,1%%S:~2,1%%S:~1,1% @set key=%Se%%Sd%%Sc%%Sb%%Sa%
@set Query="" @set PatchName=""
@set PkgCode="" @set PatchPkgName=""
@set PDisplayName="" @set PDisplayVersion=""
@set PInstallSource="" @set PLocalPackage=""
@set PPackageName="" @set PPackageCode=""
@call :GetPatchKey @if errorlevel 1 goto error_no_patch_key
@call :QueryProduct @if errorlevel 1 goto GetPatchInfo
@echo * @echo Product code results...
@echo * @echo Product name: %PDisplayName%
@call :QueryProductB @echo Product version: %PDisplayVersion%
@call :QueryProductD @echo Local package: %PLocalPackage%
@call :QueryPackageName @echo Package name: %PPackageName%
@call :ProductPackageCode @set P=%PPackageCode%
@set Pb=%P:~7,1%%P:~6,1%%P:~5,1%%P:~4,1%%P:~3,1%%P:~2,1%%P:~1,1%%P:~0,1% @set Pc=%P:~11,1%%P:~10,1%%P:~9,1%%P:~8,1%
@set Pd=%P:~15,1%%P:~14,1%%P:~13,1%%P:~12,1% @set Pe=%P:~17,1%%P:~16,1%%P:~19,1%%P:~18,1%
@set Pf=%P:~21,1%%P:~20,1%%P:~23,1%%P:~22,1%%P:~25,1%%P:~24,1%%P:~27,1%%P:~26,1%%P:~29,1%%P:~28,1%%P:~31,1%%P:~30,1% @echo Package code: {%Pb%-%Pc%-%Pd%-%Pe%-%Pf%}
@goto end :GetPatchInfo
@echo Not in product, checking in patches now... @call :QueryPatch
@echo * @echo Patch code results...
@if errorlevel 1 goto error_no_product_patch @echo *
@echo This code corresponds to patch: %PatchName% @echo Patch code is: %1
@call :QueryPatchPackageName @if errorlevel 1 goto no_patch_package
@echo Package Name is: %PatchPkgName% @call :QueryLocalPackage
@if errorlevel 1 goto no_local_package @echo Local package and path is: %LocalPackagePath%
:GetPatchKey @for /F "eol=E tokens=1,2*" %%i in ('reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products" /f %key% /k /e /s') DO @SET "Query=%%i"
@if "%Query%"=="""" exit /B 1 @exit /B 0
:QueryProduct @for /F "tokens=1,2*" %%i in ('reg query "%Query%\InstallProperties" /v "DisplayName"') DO @if %%i==DisplayName SET "PDisplayName=%%k"
@if "%PDisplayName%"=="""" exit /B 1 @exit /B 0
:QueryProductB @for /F "tokens=1,2*" %%i in ('reg query "%Query%\InstallProperties" /v "DisplayVersion"') DO @if %%i==DisplayVersion SET "PDisplayVersion=%%k"
@if "%PDisplayVersion%"=="""" exit /B 1 @exit /B 0
:QueryProductD @for /F "tokens=1,2*" %%i in ('reg query "%Query%\InstallProperties" /v "LocalPackage"') DO @if %%i==LocalPackage SET "PLocalPackage=%%k"
@if "%PLocalPackage%"=="""" exit /B 1 @exit /B 0
:QueryPackageName @for /F "tokens=1,2*" %%i in ('reg query "HKLM\SOFTWARE\Classes\Installer\Products\%key%\SourceList" /v "PackageName"') DO @if %%i==PackageName SET "PPackageName=%%k"
@if "%PPackageName%"=="""" exit /B 1 @exit /B 0
:ProductPackageCode @for /F "tokens=1,2*" %%i in ('reg query "HKLM\SOFTWARE\Classes\Installer\Products\%key%" /v "PackageCode"') DO @if %%i==PackageCode SET "PPackageCode=%%k"
@if "%PPackageCode%"=="""" exit /B 1 @exit /B 0
:QueryPatch @for /F "tokens=1,2*" %%i in ('reg query "%Query%" /v "DisplayName"') DO @if %%i==DisplayName SET "PatchName=%%k"
@if "%PatchName%"=="""" exit /B 1 @exit /B 0
:QueryPatchPackageName @for /F "tokens=1,2*" %%i in ('reg query "HKLM\SOFTWARE\Classes\Installer\Patches\%key%\SourceList" /v "PackageName"') DO @if %%i==PackageName SET "PatchPkgName=%%k"
@if "%PatchPkgName%"=="""" exit /B 1 @exit /B 0
:QueryLocalPackage @for /F "tokens=1,2*" %%i in ('reg query "HKLM\Software\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Patches\%key%" /v "LocalPackage"') DO @if %%i==LocalPackage SET "LocalPackagePath=%%k"
@if "%LocalPackagePath%"=="""" exit /B 1 @exit /B 0
:error_no_patch_key @echo ERROR: No patch or product found for that code.
@echo Verify you have entered the complete code with curly braces. @echo Example: test_A.bat {CC67DE68-1870-481E-9054-0568556B992A}
@goto end :error_no_product_patch
@echo ERROR: No patch found for that code. @goto end
:no_package_code @echo No package code found.
@goto end :no_patch_package
@echo No patch package name found. @call :QueryLocalPackage
:no_local_package @echo No local package path found.
@goto end :PrintUsage
@echo ******************************************************************** @echo Usage: test_A.bat {patch code}
@echo Example: test_A.bat {CC67DE68-1870-481E-9054-0568556B992A} @echo .
@echo Please specify the entire package code including the curly braces. @echo ********************************************************************
@goto end :end
@rem <----------------------- END BATCH SCRIPT -------------------------------->

Sarah Henwood | Microsoft SQL Server Escalation Services