mirror of
https://github.com/podman-container-tools/podman.git
synced 2026-10-11 00:17:41 +00:00
Fix the regression on WSL v3: force using cgroufs
Fixes #29749 It's the same fix as podman-container-tools/podman-machine-os#319 but this PR fixes existing machines, the ones that have been created with an older podman-machine-os image. The podman-machine-os PR makes still sense for users that are creating a new podman machine with a podman client with version <= v6.1.3. Signed-off-by: Mario Loriedo <mario.loriedo@gmail.com>
This commit is contained in:
parent
3704166a5e
commit
b420cc6ca7
2 changed files with 17 additions and 2 deletions
|
|
@ -8,6 +8,10 @@ const (
|
|||
currentMachineVersion = 3
|
||||
)
|
||||
|
||||
const cgroupManager = `[engine]
|
||||
cgroup_manager="cgroupfs"
|
||||
`
|
||||
|
||||
const appendPort = `grep -q Port\ %d /etc/ssh/sshd_config || echo Port %d >> /etc/ssh/sshd_config`
|
||||
|
||||
const changePort = `sed -E -i 's/^Port[[:space:]]+[0-9]+/Port %d/' /etc/ssh/sshd_config`
|
||||
|
|
|
|||
|
|
@ -215,14 +215,25 @@ func (w WSLStubber) StartVM(mc *vmconfigs.MachineConfig) (func() error, func() e
|
|||
|
||||
err := wslInvoke(dist, "/root/bootstrap")
|
||||
if err != nil {
|
||||
err = fmt.Errorf("the WSL bootstrap script failed: %w", err)
|
||||
return nil, nil, fmt.Errorf("the WSL bootstrap script failed: %w", err)
|
||||
}
|
||||
|
||||
// We need to set cgroup_manager="cgroupfs" in the [engine] section
|
||||
// of containers.conf until we use the WSL supported systemd.
|
||||
// The details are in this GitHub issue:
|
||||
// https://github.com/podman-container-tools/podman/issues/29749
|
||||
// The issue about using the WSL supported systemd:
|
||||
// https://github.com/podman-container-tools/podman/issues/15967
|
||||
err = wslPipe(cgroupManager, dist, "sh", "-c", "cat > /usr/share/containers/containers.conf.d/999-podman-machine-wsl-cgroupfs.conf")
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("failed creating the cgroupfs config file: %w", err)
|
||||
}
|
||||
|
||||
readyFunc := func() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
return nil, readyFunc, err
|
||||
return nil, readyFunc, nil
|
||||
}
|
||||
|
||||
func (w WSLStubber) State(mc *vmconfigs.MachineConfig, _ bool) (define.Status, error) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue