containers / podman

Podman: A tool for managing OCI containers and pods.
https://podman.io
Apache License 2.0
23.79k stars 2.42k forks source link

[macOS] `podman machine start` fails with the error message "qemu-system-x86_64: CPU model 'host' requires KVM" #10555

Closed tnk4on closed 3 years ago

tnk4on commented 3 years ago

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

On macOS, when I run podman machine init and then podman machine start, I get an error message "qemu-system-x86_64: CPU model 'host' requires KVM" and the VM fails to start.

Steps to reproduce the issue:

On the Mac client:

  1. Run "podman machine init".
$ ./podman machine init test
Extracting compressed file
  1. Run "podman machine start", it will stop with an error.
$ ./podman machine start test
Waiting for VM ...
qemu-system-x86_64: CPU model 'host' requires KVM
Error: dial unix /var/folders/df/vy1htn753fd_w4420rltfg0w0000gn/T/podman/test_ready.sock: connect: connection refused

Describe the results you received:

$ ./podman machine start test
Waiting for VM ...
qemu-system-x86_64: CPU model 'host' requires KVM
Error: dial unix /var/folders/df/vy1htn753fd_w4420rltfg0w0000gn/T/podman/test_ready.sock: connect: connection refused

Describe the results you expected:

The VM will be successfully started.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

$ ./podman --version
podman version 3.2.0

Package info (e.g. output of rpm -q podman or apt list podman):

podman

https://github.com/containers/podman/releases/download/v3.2.0/podman-remote-release-darwin.zip

qemu

$ qemu-system-x86_64 --version
QEMU emulator version 6.0.0
Copyright (c) 2003-2021 Fabrice Bellard and the QEMU Project developers
$ brew info qemu
qemu: stable 6.0.0 (bottled), HEAD
Emulator for x86 and PowerPC
https://www.qemu.org/
/usr/local/Cellar/qemu/6.0.0 (161 files, 573MB) *
  Poured from bottle on 2021-06-04 at 11:21:31
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/qemu.rb
License: GPL-2.0-only

VM image

$ ls ~/.local/share/containers/podman/machine/qemu/*.qcow2.xz |xargs basename
fedora-coreos-34.20210529.1.0-qemu.x86_64.qcow2.xz

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

tnk4on commented 3 years ago

I was able to start the VM by adding the QEMU option.

$ vi ~/.config/containers/podman/machine/qemu/test.json`

  "-accel",
  "hvf",
$ ./podman machine start test
Waiting for VM ...
$ ./podman machine list
NAME        VM TYPE     CREATED         LAST UP
test        qemu        33 seconds ago  Currently running

Hypervisor.framework is supported on macOS

$ sysctl -a | grep kern.hv_support
kern.hv_support: 1
afbjorklund commented 3 years ago

For some reason it is only added on arm64, but not on amd64: pkg/machine/qemu/options_darwin_arm64.go: "-accel", "hvf", pkg/machine/qemu/options_linux_amd64.go: "-accel", "kvm", pkg/machine/qemu/options_linux_arm64.go: "-accel", "kvm",

Note: this was in v3.2.0

mheon commented 3 years ago

@baude PTAL

rhatdan commented 3 years ago

@ashley-cui PTAL also.

baude commented 3 years ago

distribution information and qemu version ?

tnk4on commented 3 years ago

I've added the information to the top comments.

baude commented 3 years ago

Ok, thank you. We were testing with version 5.0. I will try v6.0 and report back.

ashley-cui commented 3 years ago

closed via https://github.com/containers/podman/pull/10605

tnk4on commented 3 years ago

I've got v3.2.1 working fine. Also, #10578 seems to have been fixed. Thanks!