Remove the option to install WSL/HyperV

The Windows installer was able to automatically enable the
Windows features for WSL or HyperV when they were not
already enabled. This PR removes this capability.

Having the installer to automatically install the right prerequiste
(WSL or HyperV) was helpful as users won't have to do it manually to
use Podman after the installation. But it also made the code of
installer more complicated as it needed to manage the installation
of these OS features and a reboot. And we weren't able to automatically
test these scenarios that required a reboot.

In other words the Windows installer, that merely just extracted
some files in a folder, required, to support the installation of
WSL and HyperV, an advanced knowledge of WiX toolkit and of the
Windows Installer SDK, plus contributors-time to manually test
the scenarios that require a reboot.

We decided to remove this capability based on the following reasons:
- We had a couple of regressions in the last month that were hard to
  analyse and fix (#24624 and #24735)
- Podman maintainers currently have a scarce knowledge of the Windows Installer
  and there is no plan to invest in that
- Manually installing WSL or HyperV is not hard (e.g. run `wsl --install`) and
  are features that admins can manage on their fleet of Windows machines
- Competitors such as Docker Desktop don't automatically install these
  components
- Podman `machine init` currently verifies if WSL and HyperV are installed and
  guide the user to install them when they are not

Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
This commit is contained in:
Mario Loriedo
2025-02-07 16:10:50 +01:00
parent dce52b3e77
commit 91e4f6918a
7 changed files with 9 additions and 65 deletions

View File

@@ -356,15 +356,12 @@ which include detailed installation information, in the current directory.
Run it in `quiet` mode to automate the installation and avoid interacting with
the GUI. Open the terminal **as an administrator**, add the `/quiet` option, and
set the bundle variables `MachineProvider` (`wsl` or `hyperv`), `WSLCheckbox`
(`1` to install WSL as part of the installation, `0` otherwise), and
`HyperVCheckbox` (`1` to install Hyper-V as part of the installation, `0`
otherwise):
set the bundle variable `MachineProvider` (`wsl` or `hyperv`):
```pwsh
contrib\win-installer\podman-5.1.0-dev-setup.exe /install `
/log podman-setup.log /quiet `
MachineProvider=wsl WSLCheckbox=0 HyperVCheckbox=0
MachineProvider=wsl
```
:information_source: If uninstallation fails, the installer may end up in an
@@ -418,13 +415,11 @@ msiexec /package contrib\win-installer\en-US\podman.msi /l*v podman-msi.log
```
To run it in quiet, non-interactive mode, open the terminal **as an
administrator**, add the `/quiet` option, and set the MSI properties
`MACHINE_PROVIDER` (`wsl` or `hyperv`), `WITH_WSL` (`1` to install WSL as part
of the installation, `0` otherwise) and `WITH_HYPERV` (`1` to install Hyper-V as
part of the installation, `0` otherwise):
administrator**, add the `/quiet` option, and set the MSI property
`MACHINE_PROVIDER` (`wsl` or `hyperv`):
```pwsh
msiexec /package contrib\win-installer\en-US\podman.msi /l*v podman-msi.log /quiet MACHINE_PROVIDER=wsl WITH_WSL=0 WITH_HYPERV=0
msiexec /package contrib\win-installer\en-US\podman.msi /l*v podman-msi.log /quiet MACHINE_PROVIDER=wsl
```
:information_source: `podman.msi` GUI dialogs, defined in the file

View File

@@ -9,8 +9,6 @@
<Variable Name="InstallFolder" Type="formatted" Value="[ProgramFiles64Folder]RedHat\Podman" bal:Overridable="yes" />
<Variable Name="VERSION" Value="$(var.VERSION)" />
<Variable Name="MachineProvider" Type="string" Value="wsl" bal:Overridable="yes" />
<Variable Name="WSLCheckbox" Type="numeric" Value="0" bal:Overridable="yes" />
<Variable Name="HyperVCheckbox" Type="numeric" Value="0" bal:Overridable="yes" />
<Variable Name="AllowOldWin" Type="numeric" Value="0" bal:Overridable="yes" />
<Variable Name="LaunchTarget" Value="explorer.exe" />
<Variable Name="LaunchArguments" Value="&quot;[InstallFolder]\podman-for-windows.html&quot;" />
@@ -31,11 +29,8 @@
<MsiPackage Id="Setup" SourceFile="en-US\podman.msi" Vital="yes">
<MsiProperty Name="INSTALLDIR" Value="[InstallFolder]" />
<MsiProperty Name="MACHINE_PROVIDER" Value="[MachineProvider]" />
<MsiProperty Name="WITH_WSL" Value="[WSLCheckbox]" />
<MsiProperty Name="WITH_HYPERV" Value="[HyperVCheckbox]" />
<MsiProperty Name="SKIP_CONFIG_FILE_CREATION" Value="[SkipConfigFileCreation]" />
</MsiPackage>
<ExePackage DisplayName="WSL Kernel Install" InstallCondition="(MachineProvider = &quot;wsl&quot;) AND (WSLCheckbox = 1) AND (NOT PreviousInstallFolder)" SourceFile="artifacts\podman-wslkerninst.exe" DetectCondition="" Permanent="true" />
</Chain>
<OptionalUpdateRegistration />
</Bundle>

View File

@@ -9,7 +9,7 @@
<String Id="InstallMessage" Value="Welcome to the [WixBundleName] [VERSION] setup wizard. This will install [WixBundleName] on your computer." />
<String Id="ProvidersMessage" Value="Additionally, you have the option to select the virtualization provider required by Podman: WSLv2 or Hyper-V.
You can choose to also install the virtualization provider if it is not already enabled. This operation requires a reboot during the installation process. Alternatively, you can deselect the checkbox, and install the virtualization provider manually.
If it's not already installed, you will have to install the virtualization provider manually.
Finally, click install to continue, or Close to abort the installation." />
<String Id="InstallVersion" Value="Version [WixBundleVersion]" />
@@ -27,8 +27,6 @@ Finally, click install to continue, or Close to abort the installation." />
<String Id="HelpCloseButton" Value="&amp;Close" />
<String Id="InstallLicenseLinkText" Value='[WixBundleName] &lt;a href="#"&gt;license terms&lt;/a&gt;.' />
<String Id="InstallAcceptCheckbox" Value="I &amp;agree to the license terms and conditions" />
<String Id="InstallWSLCheckbox" Value="&amp;Install WSLv2 if not present" />
<String Id="InstallHypervCheckbox" Value="&amp;Install Hyper-V if not present" />
<String Id="InstallInstallButton" Value="&amp;Install" />
<String Id="InstallCancelButton" Value="&amp;Close" />
<String Id="OptionsHeader" Value="Setup Options" />

View File

@@ -39,8 +39,6 @@
</RadioButtons>
<Hypertext Name="EulaHyperlink" X="185" Y="-111" Width="-11" Height="17" TabStop="yes" FontId="3" HideWhenDisabled="yes">#(loc.InstallLicenseLinkText)</Hypertext>
<Label Name="InstallVersion" X="510" Y="-50" Width="-11" Height="17" FontId="3" DisablePrefix="yes" VisibleCondition="WixStdBAShowVersion">#(loc.InstallVersion)</Label>
<Checkbox Name="WSLCheckbox" VisibleCondition="(MachineProvider = &quot;wsl&quot;) AND (NOT PreviousInstallFolder)" X="185" Y="320" Width="-11" Height="17" TabStop="yes" FontId="6" HideWhenDisabled="yes">#(loc.InstallWSLCheckbox)</Checkbox>
<Checkbox Name="HyperVCheckbox" VisibleCondition="(MachineProvider = &quot;hyperv&quot;) AND (NOT PreviousInstallFolder)" X="185" Y="320" Width="-11" Height="17" TabStop="yes" FontId="6" HideWhenDisabled="yes">#(loc.InstallHypervCheckbox)</Checkbox>
<Button Name="OptionsButton" X="-171" Y="-11" Width="75" Height="23" TabStop="yes" FontId="0" VisibleCondition="NOT WixStdBASuppressOptionsUI">
<Text>#(loc.InstallOptionsButton)</Text>
<ChangePageAction Page="Options" />

View File

@@ -34,22 +34,6 @@
</DirectorySearch>
</Property>
<!--
Property WSL_INSTALL is set at runtime and used as the condition to run the `WSLFeatureComponent` Component:
WSL is installed only if all these conditions are met:
- WSL isn't already installed
- The user has set property `MACHINE_PROVIDER` to "wsl"
- The user hasn't set property `WITH_WSL` to 0
-->
<SetProperty Id="WSL_INSTALL" Before="AppSearch" Value="1" Sequence="first" Condition="(HAS_WSLFEATURE = 0) AND (MACHINE_PROVIDER = &quot;wsl&quot;) AND (NOT (WITH_WSL = 0))" />
<!--
Property HYPERV_INSTALL is set at runtime and used as the condition to run the `HyperVFeatureComponent` Component:
HyperV is installed only if all these conditions are met:
- HyperV isn't already installed
- The user has set property `MACHINE_PROVIDER` to "hyperv"
- The user hasn't set property `WITH_HYPERV` to 0
-->
<SetProperty Id="HYPERV_INSTALL" Before="AppSearch" Value="1" Sequence="first" Condition="(HAS_HYPERVFEATURE = 0) AND (MACHINE_PROVIDER = &quot;hyperv&quot;) AND (NOT (WITH_HYPERV = 0))" />
<!--
Property CREATE_MACHINE_PROVIDER_CONFIG_FILE is set at runtime and used as the condition to run the `MachineProviderConfigFile` Component:
The machine provider config file is created (or is not deleted if it already exist) if these conditions are met:
@@ -71,19 +55,6 @@
<CustomAction Id="CheckWSL" Execute="firstSequence" DllEntry="CheckWSL" BinaryRef="PodmanHooks" />
<CustomAction Id="CheckHyperV" Execute="firstSequence" DllEntry="CheckHyperV" BinaryRef="PodmanHooks" />
<util:BroadcastEnvironmentChange />
<ComponentGroup Id="WSLFeature" Directory="INSTALLDIR">
<Component Id="WSLFeatureComponent" Guid="F6A693BC-186C-4E64-8015-C3073013B3A8" Condition="(NOT Installed) AND (WSL_INSTALL = 1)">
<CreateFolder />
<PanelSW:Dism EnableFeature="VirtualMachinePlatform" ErrorHandling="prompt" />
<PanelSW:Dism EnableFeature="Microsoft-Windows-Subsystem-Linux" ErrorHandling="prompt" />
</Component>
</ComponentGroup>
<ComponentGroup Id="HyperVFeature" Directory="INSTALLDIR">
<Component Id="HyperVFeatureComponent" Guid="F7B2D4C9-6C89-46BB-B4EA-FF39424972F3" Condition="(NOT Installed) AND (HYPERV_INSTALL = 1)">
<CreateFolder />
<PanelSW:Dism EnableFeature="Microsoft-Hyper-V" ErrorHandling="prompt" />
</Component>
</ComponentGroup>
<Feature Id="Complete" Level="1">
<ComponentRef Id="INSTALLDIR_Component" />
<ComponentRef Id="EnvEntriesComponent" />
@@ -94,8 +65,6 @@
<?endif?>
<ComponentRef Id="GuideHTMLComponent" />
<ComponentGroupRef Id="ManFiles" />
<ComponentGroupRef Id="WSLFeature" />
<ComponentGroupRef Id="HyperVFeature" />
</Feature>
<Feature Id="MachineProviderConfig" Level="1">
<ComponentRef Id="MachineProviderConfigFile" />
@@ -114,9 +83,8 @@
</UI>
<InstallExecuteSequence>
<Custom Action="CheckWSL" Before="SetWSL_INSTALL" />
<Custom Action="CheckHyperV" Before="SetHYPERV_INSTALL" />
<ForceReboot After="DismX86" Condition="(NOT Installed) AND (NOT UpdateStarted) AND (NOT BURNMSIUNINSTALL) AND ((WSL_INSTALL = 1) OR (HYPERV_INSTALL = 1)) AND (NOT AFTERREBOOT)" />
<Custom Action="CheckWSL" Before="InstallFiles" />
<Custom Action="CheckHyperV" Before="InstallFiles" />
</InstallExecuteSequence>
<Binary Id="PodmanHooks" SourceFile="artifacts/podman-msihooks.dll" />

View File

@@ -9,7 +9,6 @@
# .\winmake.ps1 installer 9.9.9 &&
# .\contrib\win-installer\test-installer.ps1 `
# -scenario all `
# -previousSetupExePath ".\contrib\win-installer\podman-5.3.0-dev-setup.exe" `
# -setupExePath ".\contrib\win-installer\podman-5.4.0-dev-setup.exe" `
# -nextSetupExePath ".\contrib\win-installer\podman-9.9.9-dev-setup.exe" `
# -provider hyperv
@@ -32,8 +31,6 @@ param (
[string]$nextSetupExePath,
[ValidateSet("wsl", "hyperv")]
[string]$provider="wsl",
[switch]$installWSL=$false,
[switch]$installHyperV=$false,
[switch]$skipWinVersionCheck=$false,
[switch]$skipConfigFileCreation=$false
)
@@ -53,19 +50,15 @@ function Install-Podman {
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$setupExePath
)
if ($installWSL) {$wslCheckboxVar = "1"} else {$wslCheckboxVar = "0"}
if ($installHyperV) {$hypervCheckboxVar = "1"} else {$hypervCheckboxVar = "0"}
if ($skipWinVersionCheck) {$allowOldWinVar = "1"} else {$allowOldWinVar = "0"}
if ($skipConfigFileCreation) {$skipConfigFileCreationVar = "1"} else {$skipConfigFileCreationVar = "0"}
Write-Host "Running the installer ($setupExePath)..."
Write-Host "(provider=`"$provider`", WSLCheckbox=`"$wslCheckboxVar`", HyperVCheckbox=`"$hypervCheckboxVar`", AllowOldWin=`"$allowOldWinVar`", SkipConfigFileCreation=`"$skipConfigFileCreationVar`")"
Write-Host "(provider=`"$provider`", AllowOldWin=`"$allowOldWinVar`", SkipConfigFileCreation=`"$skipConfigFileCreationVar`")"
$ret = Start-Process -Wait `
-PassThru "$setupExePath" `
-ArgumentList "/install /quiet `
MachineProvider=${provider} `
WSLCheckbox=${wslCheckboxVar} `
HyperVCheckbox=${hypervCheckboxVar} `
AllowOldWin=${allowOldWinVar} `
SkipConfigFileCreation=${skipConfigFileCreationVar} `
/log $PSScriptRoot\podman-setup.log"

View File

@@ -12,10 +12,7 @@
<RadioButton Text="Windows Linux Subsystem (WSLv2)" Height="15" Value="wsl" Width="226" X="10" Y="0" />
<RadioButton Text="Windows Hyper-V" Height="15" Value="hyperv" Width="226" X="10" Y="15" />
</RadioButtonGroup>
</Control>
<Control Id="WSLInstallCheckbox" Type="CheckBox" X="135" Y="190" Width="226" Height="18" CheckBoxValue="1" Property="WSL_INSTALL" Default="no" Text="Install WSL if needed (requires reboot)" ShowCondition="MACHINE_PROVIDER = &quot;wsl&quot;" HideCondition="(MACHINE_PROVIDER = &quot;hyperv&quot; OR HIDE_PROVIDER_CHOICE) OR (HAS_WSLFEATURE = 1)" />
<Control Id="HyperVInstallCheckbox" Type="CheckBox" X="135" Y="190" Width="226" Height="18" CheckBoxValue="1" Property="HYPERV_INSTALL" Default="no" Text="Install Hyper-V if needed (requires reboot)" ShowCondition="MACHINE_PROVIDER = &quot;hyperv&quot;" HideCondition="(MACHINE_PROVIDER = &quot;wsl&quot; OR HIDE_PROVIDER_CHOICE) OR (HAS_HYPERVFEATURE = 1)" />
<Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Disabled="yes" Text="!(loc.WixUIBack)" />
<Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes" Text="!(loc.WelcomeEulaDlgInstall)">
<Publish Event="SpawnWaitDialog" Value="WaitForCostingDlg" Condition="!(wix.WixUICostingPopupOptOut) OR CostingComplete = 1" />