Logo von Thomas Waldecker Software Engineering
Veröffentlichungsdatum

WSL podman rootful machine

Autoren
  • avatar
    Name
    Thomas Waldecker

Um eine Podman rootful machine zu erzeugen wird folgender Befehl benutzt. Unter WSL muss einiges noch eingestellt werden, damit es funktioniert.

Das ist die Fehlermeldung. Podman kann nicht auf KVM zugreifen.

❯ podman machine init --rootful --now
Looking up Podman Machine image at quay.io/podman/machine-os:5.4 to create VM
Extracting compressed file: podman-machine-default-amd64.qcow2: done
Image resized.
Machine init complete
Starting machine "podman-machine-default"
Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-x86_64: -accel kvm: Could not access KVM kernel module: Permission denied
qemu-system-x86_64: -accel kvm: failed to initialize kvm: Permission denied

Zuerst nested Virtualization aktivieren in der Datei %USERPROFILE\.wslconfig im Windows User Ordner:

[wsl2]
nestedVirtualization=true

Dann User zur KVM Gruppe Hinzufügen:

❯ sudo usermod -a -G kvm $(whoami)

WSL neu starten:

wsl --shutdown

Danach gehts:

❯ podman machine init --rootful --now
Looking up Podman Machine image at quay.io/podman/machine-os:5.4 to create VM
Extracting compressed file: podman-machine-default-amd64.qcow2: done
Image resized.
Machine init complete
Starting machine "podman-machine-default"
Mounting volume... /home/thomas:/home/thomas
API forwarding listening on: /run/user/1000/podman/podman-machine-default-api.sock
You can connect Docker API clients by setting DOCKER_HOST using the
following command in your terminal session:

        export DOCKER_HOST='unix:///run/user/1000/podman/podman-machine-default-api.sock'

Machine "podman-machine-default" started successfully