Jira (PUP-11695) Windows package uninstall uses msi provider when exe provider available

13 views
Skip to first unread message

GeorgesZ (Jira)

unread,
Jan 4, 2023, 5:56:01 PM1/4/23
to puppe...@googlegroups.com
GeorgesZ created an issue
 
Puppet / Bug PUP-11695
Windows package uninstall uses msi provider when exe provider available
Issue Type: Bug Bug
Affects Versions: PUP 7.20.0
Assignee: Unassigned
Components: Windows
Created: 2023/01/04 2:55 PM
Priority: Normal Normal
Reporter: GeorgesZ

Puppet Version: 7.20.0
Puppet Server Version: ** 7.20.0
OS Name/Version: Windows 10

Using the package resource, version 2.1.802 of Microsoft .NET SDK x86 cannot be uninstalled like the x64 architecture or other versions (eg: 2.1.403, 5.0.102, 5.0.401).

Installers for Microsoft .NET SDK can be downloaded using a url like this https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-${version}-windows-x86-installer and can be installed/uninstalled using something like this:

package { "Microsoft .NET ${optional_core}SDK ${version} (x86)":
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-${version}-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}
package { "Microsoft .NET ${optional_core}SDK ${version} (x64)":
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-${version}-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}

except for version 2.1.802 that MUST be installed/uninstalled using something like this:

package { 'Microsoft .NET Core SDK 2.1.802 (x86)':
  ensure            => absent,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => undef,
}
package { 'Microsoft .NET Core SDK 2.1.802 (x64)':
  ensure            => absent,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x64.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}

The cause seems to be that the package resource uninstalls Microsoft .NET SDK version 2.1.802 x86 using the msi provider:

msiexec.exe /qn /norestart /x {F56405A6-5942-4EC9-A446-54167AA57752} $uninstall_options

when it could use the exe provider:

"C:\ProgramData\Package Cache\{92a4ca67-9d75-4067-8522-e684fd033096}\dotnet-sdk-2.1.802-win-x86.exe"  /uninstall $uninstall_options

I am wondering if the root cause could be this where the MSI provider may be used before the EXE provider. It seems that in this case, the Microsoft .NET SDK EXE installer uses internally an MSI installer which results in both EXE and MSI Uninstall entries in the registry. It seems that uninstalling should be looking for the entry created by the EXE before looking for the entry created by the MSI.

Desired Behavior:

Installing/uninstalling Microsoft .NET SDK version 2.1.802 should work using something like this:

package { 'Microsoft .NET Core SDK 2.1.802 (x86)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}
package { 'Microsoft .NET Core SDK 2.1.802 (x64)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x64.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}

Actual Behavior:

The Microsoft .NET SDK version Version 2.1.802 must be installed/uninstalled with something like this:

package { 'Microsoft .NET Core SDK 2.1.802 (x86)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => [],
}
package { 'Microsoft .NET Core SDK 2.1.802 (x64)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x64.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
} 

 

Add Comment Add Comment
 
This message was sent by Atlassian Jira (v8.20.11#820011-sha1:0629dd8)
Atlassian logo

GeorgesZ (Jira)

unread,
Jan 5, 2023, 9:24:03 AM1/5/23
to puppe...@googlegroups.com
GeorgesZ updated an issue
Change By: GeorgesZ
*Puppet Version:* 7.20.0
{*}Puppet Server Version:{*} ** 7.20.0
*OS Name/Version:* Windows 10


Using the package resource, version 2.1.802 of Microsoft .NET SDK x86 cannot be uninstalled like the x64 architecture or other versions (eg: 2.1.403, 5.0.102, 5.0.401).

Installers for Microsoft .NET SDK can be downloaded using a url like this [https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-${version}-windows-x86-installer|https://dotnet.microsoft.com/en-us/download/dotnet] and can be installed/uninstalled using something like this:
{code:
java puppet }

package { "Microsoft .NET ${optional_core}SDK ${version} (x86)":
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-${version}-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}
package { "Microsoft .NET ${optional_core}SDK ${version} (x64)":
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-${version}-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}{code}

except for version 2.1.802 that MUST be installed/uninstalled using something like this:
{code: java puppet }
if $ensure == absent {
    exec { '"C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe" /uninstall /passive /norestart':
    onlyif => 'C:\\Windows\\System32\\reg.exe query HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{92a4ca67-9d75-4067-8522-e684fd033096}',
  }
} else {
package { 'Microsoft .NET Core SDK 2.1.802 (x86)':
  ensure            => absent present ,

  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => undef,   }
}
package { 'Microsoft .NET Core SDK 2.1.802 (x64)':
  ensure            => absent $ensure ,

  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x64.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}{code}

The cause seems to be that the package resource uninstalls Microsoft .NET SDK version 2.1.802 x86 using the msi provider:
{noformat}
msiexec.exe /qn /norestart /x {F56405A6-5942-4EC9-A446-54167AA57752} $uninstall_options{noformat}

when it could use the exe provider:
{noformat}
"C:\ProgramData\Package Cache\{92a4ca67-9d75-4067-8522-e684fd033096}\dotnet-sdk-2.1.802-win-x86.exe"  /uninstall $uninstall_options{noformat}
I am wondering if the root cause could be [this|https://github.com/puppetlabs/puppet/blob/main/lib/puppet/provider/package/windows/package.rb#L28] where the MSI provider may be used before the EXE provider. It seems that in this case, the Microsoft .NET SDK EXE installer uses internally an MSI installer which results in both EXE and MSI Uninstall entries in the registry. It seems that uninstalling should be looking for the entry created by the EXE before looking for the entry created by the MSI.

*Desired Behavior:*


Installing/uninstalling Microsoft .NET SDK version 2.1.802 should work using something like this:
{code: java puppet }

package { 'Microsoft .NET Core SDK 2.1.802 (x86)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}
package { 'Microsoft .NET Core SDK 2.1.802 (x64)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x64.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
}{code}

*Actual Behavior:*


The Microsoft .NET SDK version Version 2.1.802 must be installed/uninstalled with something like this:
{code: java puppet }
if $ensure == absent {
    exec { '"C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe" /uninstall /passive /norestart':
    onlyif => 'C:\\Windows\\System32\\reg.exe query HKLM\\SOFTWARE\\WOW6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{92a4ca67-9d75-4067-8522-e684fd033096}',
  }
} else {
package { 'Microsoft .NET Core SDK 2.1.802 (x86)':
  ensure            => $ensure present ,

  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x86.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => [],   }
}
package { 'Microsoft .NET Core SDK 2.1.802 (x64)':
  ensure            => $ensure,
  source            => "${download_folder}/dotnet-sdk-2.1.802-win-x64.exe",
  install_options   => ['/install', '/passive', '/norestart'],
  uninstall_options => ['/uninstall', '/passive', '/norestart'],
} {code}
 

Morgan Rhodes (Jira)

unread,
Jan 10, 2023, 4:28:03 PM1/10/23
to puppe...@googlegroups.com
Morgan Rhodes commented on Bug PUP-11695
 
Re: Windows package uninstall uses msi provider when exe provider available

Hi GeorgesZ,

It seems like there's an issue with that particular .net core sdk that doesn't accurately report how the package was installed. The code to check whether or not a package is a valid MSI is here, so you may be able to clear that registry key.

Unfortunately since this is an issue with a specific package there's nothing we can do to resolve it.

GeorgesZ (Jira)

unread,
Jan 11, 2023, 9:54:02 AM1/11/23
to puppe...@googlegroups.com
GeorgesZ commented on Bug PUP-11695

This is not a issue with that particular .net core sdk. Uninstall from the Add/Remove control panel works correctly and uninstalls things using the cached exe, not using the msiexec.

Josh Cooper (Jira)

unread,
Jan 11, 2023, 7:57:02 PM1/11/23
to puppe...@googlegroups.com
Josh Cooper commented on Bug PUP-11695

GeorgesZ Puppet uses the WindowsInstaller registry value to determine if something was installed via msiexec or something else. For whatever reason that particular package is setting the value incorrectly. I don't know how Add/Remove Programs "knows better", but given this only happens with the one .net sdk and that version of the sdk is EOL, we don't have plans on changing puppet, so I'm going to close this ticket. If you can provide additional details about how Add/Remove Programs is determining that the package is not an MSI, then please reopen this ticket with those details.

GeorgesZ (Jira)

unread,
Jan 13, 2023, 3:46:02 PM1/13/23
to puppe...@googlegroups.com
GeorgesZ commented on Bug PUP-11695

The dotnet-sdk-2.1.802-win-x86.exe downloadable from https://dotnet.microsoft.com/en-us/download/dotnet/thank-you/sdk-2.1.802-windows-x86-installer creates two entries in the Installer registry:

  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{92a4ca67-9d75-4067-8522-e684fd033096}:

Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{92a4ca67-9d75-4067-8522-e684fd033096}]
"BundleAddonCode"=hex(7):
"BundleCachePath"="C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe"
"BundleDetectCode"=hex(7):
"BundlePatchCode"=hex(7):
"BundleProviderKey"="{92a4ca67-9d75-4067-8522-e684fd033096}"
"BundleTag"=""
"BundleUpgradeCode"=hex(7):7b,00,37,00,39,00,32,00,38,00,43,00,42,00,43,00,38,\
  00,2d,00,35,00,37,00,44,00,43,00,2d,00,37,00,30,00,31,00,32,00,2d,00,44,00,\
  37,00,46,00,37,00,2d,00,38,00,30,00,45,00,45,00,33,00,32,00,35,00,38,00,42,\
  00,30,00,43,00,41,00,7d,00,00,00,00,00
"BundleVersion"="2.1.802.0"
"DisplayIcon"="C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe,0"
"DisplayName"="Microsoft .NET Core SDK 2.1.802 (x86)"
"DisplayVersion"="2.1.802"
"EngineVersion"="3.10.4.4718"
"EstimatedSize"=dword:000736af
"Installed"=dword:00000001
"ModifyPath"="\"C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe\" /modify"
"NoElevateOnModify"=dword:00000001
"Publisher"="Microsoft Corporation"
"QuietUninstallString"="\"C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe\" /uninstall /quiet"
"Resume"=dword:00000003
"UninstallString"="\"C:\\ProgramData\\Package Cache\\{92a4ca67-9d75-4067-8522-e684fd033096}\\dotnet-sdk-2.1.802-win-x86.exe\"  /uninstall"
"URLInfoAbout"=https://dotnet.github.io/
 
"BundleUpgradeCode" is REG_MULTI_SZ with value `{7928CBC8-57DC-7012-D7F7-80EE3258B0CA}`.

  • HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{F56405A6-5942-4EC9-A446-54167AA57752}:

Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F56405A6-5942-4EC9-A446-54167AA57752}]
"AuthorizedCDFPrefix"=""
"Comments"=""
"Contact"=""
"DisplayName"="Microsoft .NET Core SDK 2.1.802 (x86)"
"DisplayVersion"="8.216.42515"
"EstimatedSize"=dword:00033e7c
"HelpLink"=""
"HelpTelephone"=""
"InstallDate"="20230113"
"InstallLocation"=""
"InstallSource"="C:\\ProgramData\\Package Cache\\{F56405A6-5942-4EC9-A446-54167AA57752}v8.216.42515\\"
"Language"=dword:00000409
"ModifyPath"=hex(2):4d,00,73,00,69,00,45,00,78,00,65,00,63,00,2e,00,65,00,78,\
  00,65,00,20,00,2f,00,49,00,7b,00,46,00,35,00,36,00,34,00,30,00,35,00,41,00,\
  36,00,2d,00,35,00,39,00,34,00,32,00,2d,00,34,00,45,00,43,00,39,00,2d,00,41,\
  00,34,00,34,00,36,00,2d,00,35,00,34,00,31,00,36,00,37,00,41,00,41,00,35,00,\
  37,00,37,00,35,00,32,00,7d,00,00,00
"Publisher"="Microsoft Corporation"
"Readme"=""
"Size"=""
"SystemComponent"=dword:00000001
"UninstallString"=hex(2):4d,00,73,00,69,00,45,00,78,00,65,00,63,00,2e,00,65,00,\
  78,00,65,00,20,00,2f,00,49,00,7b,00,46,00,35,00,36,00,34,00,30,00,35,00,41,\
  00,36,00,2d,00,35,00,39,00,34,00,32,00,2d,00,34,00,45,00,43,00,39,00,2d,00,\
  41,00,34,00,34,00,36,00,2d,00,35,00,34,00,31,00,36,00,37,00,41,00,41,00,35,\
  00,37,00,37,00,35,00,32,00,7d,00,00,00
"URLInfoAbout"=""
"URLUpdateInfo"=""
"Version"=dword:08d8a613
"VersionMajor"=dword:00000008
"VersionMinor"=dword:000000d8
"WindowsInstaller"=dword:00000001
 
"ModifyPath" is REG_EXPAND_SZ with value `MsiExec.exe /I{F56405A6-5942-4EC9-A446-54167AA57752}`. "UninstallString" is REG_EXPAND_SZ with value `MsiExec.exe /I{F56405A6-5942-4EC9-A446-54167AA57752}`.

The Apps & Features control panel uses the entry HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall{92a4ca67-9d75-4067-8522-e684fd033096} to display and uninstall. But the package resource seems to be using the entry [HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{F56405A6-5942-4EC9-A446-54167AA57752}] to uninstall.

GeorgesZ (Jira)

unread,
Jan 13, 2023, 3:59:03 PM1/13/23
to puppe...@googlegroups.com
GeorgesZ commented on Bug PUP-11695

A non-MSI installer like an executable, can use internally MSI installer to install things. When there is a choice between an MSI installer registry (SystemComponent=1) and a non-MSI installer registry, it seems that the choice should be given to the non-MSI installer registry, so that it has a change to run the MSI uninstaller before uninstalling itself.

In the above case, uninstalling using the MSI registry does not remove the entry from the Apps & Features control panel. It only removes pieces of the components. In fact uninstalling using the MSI {{msiexec /uninstall "

{F56405A6-5942-4EC9-A446-54167AA57752}

"}} gives this warning: If you continue with this uninstall, 1 or more products may stop working properly. Do you want to continue with this uninstall anyway?

Reply all
Reply to author
Forward
0 new messages