Can't get Podman to run on an Mac M1 Monterey
Asked Answered
D

2

9

I have done the following so far:

  1. brew install qemu (apparently needed for podman, but want to use it for VMs anyway)
  2. brew install podman
  3. modify ~/.config/containers/containers.conf and add following line to [engine] section:

helper_binaries_dir = ["/Users/user/dev/homebrew/Cellar/podman/4.1.0/bin","/Users/user/dev/homebrew/Cellar/podman/4.1.0/libexec"]

  1. podman machine init
  2. podman machine start

Initially, machine start complained it could not dial up a unix socket at var/folders/v0/xqf571mj5sg5x7k4j1dpb1_w0000gn/T/podman/podman-machine-default_ready.sock. That file existed, so don't know what the problem was.

I rebooted to see if that would help, and now that socket file no longer exists, but podman machine start still wants to use it. Rerunning podman machine init just gives this error:

Error: podman-machine-default: VM already exists

That error always occurs once it successfully inits, so doesn't seem to be related to my issue.

That's as far as I can get from various web pages I read. Hopefully someone can provide further help :)

I've been away from using a Mac for over a decade, so really have no idea how stuff like podman is supposed to work, beyond it apparently needs QEMU to run a VM for each container.

Am I better off using Docker Desktop for Mac instead of fighting with podman? If so, I'll just use that. Podman was butt easy on my Linux desktop, but maybe it's not worth the trouble on a Mac, or at least on an M1 since it's an arm.

Demagoguery answered 27/5, 2022 at 11:43 Comment(1)
It looks like a number of others are having a similar issue (myself included), perhaps related to recent changes in qemu 7.0.0. The relevant issue: github.com/containers/podman/issues/14303Mccluskey
D
4

After some time debugging, I found the cause of this problem.

This problem is caused due to qemu 7.0.0 startup latency (3-5s) that occour in every first qemu execution after Mac Machine machine boots.

Podman has some bug that doesn't expect that the creation of socks files, done by the qemu call, can be delayed some seconds, and when podman tries to access the socks files, the qemu is not created them yet, showing the error "Error: dial unix /podman/podman-machine-default_ready.sock: connect: connection refused".

To avoid this problem, just execute qemu, even with invalid options (just to initialize), before call "podman machine start".

echo "* Podman VM machine for MACOSX is stoped, starting..."

# workaround - initialize qemu before machine start to avoid socket error
/usr/local/bin/qemu-system-x86_64 -machine q35,accel=hvf:tcg -cpu host -display none INVALID_OPTION >> /dev/null 2>&1

podman machine start podman-machine-default
ECODE=$?;if [ $ECODE -ne 0 ];then echo "* Error starting podman linux vm machine: $ECODE";exit $ECODE;fi
Dhaulagiri answered 21/6, 2022 at 21:39 Comment(0)
M
1

I had a similar issue yesterday, as have others. The solution comes from the issue thread linked in the comment above. The problem was resolved by downgrading the version of QEMU from the one currently available as default on homebrew.

You can downgrade to QEMU 6.2.0 on Monterrey with the following:

curl -L -H "Authorization: Bearer QQ==" -o qemu-6.2.0_1.monterey.bottle.tar.gz https://ghcr.io/v2/homebrew/core/qemu/blobs/sha256:fcc3b1a8139f70dae57f5449f3856f9b3b67448ee0623e64da1e47dc255b46f6
brew install -f qemu-6.2.0_1.monterey.bottle.tar.gz
Mccluskey answered 30/5, 2022 at 10:44 Comment(1)
Yeah, I'll watch that thread, it looks promising. The issue will probably get resolved.Demagoguery

© 2022 - 2024 — McMap. All rights reserved.