可以让Podman在Mac M1 Monterey上奔跑

发布于 2025-02-01 19:03:00 字数 979 浏览 4 评论 0原文

到目前为止,我已经完成了以下操作:

  1. brew install qemu(显然是Podman需要的,但还是想将其用于VMS)
  2. brew install install podman
  3. 修改〜/.config/contains/contains.conf,并将以下行添加到[Engine]部分:

[“/users/user/dev/homebrew/cellar/cellar/podman/4.1.0/bin","/bin"/users/user/user/dev/dev/homebrew/homebrew/cellar/cellar/podman/podman/4.1.0/libexec

  1. ,,
  2. helper_binaries_dir = 首先

,机器启动抱怨它无法在VAR/文件夹/V0/XQF571MJ5SG5X7K4J1DPB1_W0000GN/T/T/PODMAN/PODMAN/PODMAN/PODMAN/PODMAN/PODMAN-MACHINE-MACHINE-MACHINE-DEFAULT_REAKE.SOCK上拨打UNIX插座。该文件存在,因此不知道问题是什么。

我重新启动以查看是否会有所帮助,现在该套接字不再存在,但是Podman Machine Start仍然希望使用它。重新设计Podman Machine Init只会给出此错误:

错误:Podman-Machine-Default:VM

一旦成功地进入,VM就会总是发生错误,因此似乎与我的问题无关。

据我从阅读的各个网页中获得的胜利。希望有人可以提供进一步的帮助:)

我已经离开Mac已有十多年了,所以真的不知道Podman之类的东西应该如何工作,显然它需要QEMU来为每个容器运行VM。

我最好使用Docker Desktop作为Mac而不是与Podman战斗?如果是这样,我将使用它。 Podman在我的Linux桌面上很容易,但也许在Mac上或至少在M1上不值得,因为它是手臂。

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

徒留西风 2025-02-08 19:03:00

经过一段时间的调试,我发现了这个问题的原因。

此问题是由于QEMU 7.0.0启动延迟(3-5s)引起的,该潜伏期(3-5s)在Mac Machine启动后的每个QEMU执行中都出现。

Podman有一些错误,这些错误不希望通过QEMU调用完成的袜子文件的创建可以延迟几秒钟,并且当Podman试图访问袜子文件时,QEMU尚未创建它们,显示错误”错误:Dialunix /podman/podman-machine-default_ready.sock:连接:连接拒绝”。

为了避免此问题,即使使用无效的选项(仅是初始化),在调用“ Podman Machine启动”之前,只需执行QEMU即可。

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

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
此生挚爱伱 2025-02-08 19:03:00

昨天我也有一个类似的问题,与其他人一样。该解决方案来自

您可以在蒙特雷(Monterrey)上降级到QEMU 6.2.0:

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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文