错误:qemu 意外退出,无法打开 edk2-aarch64-code:没有该文件或目录

错误:qemu 意外退出,无法打开 edk2-aarch64-code:没有该文件或目录

brew 升级后,podman 机器不再工作。

podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-aarch64: -drive file=/opt/homebrew/Cellar/qemu/8.0.2/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on: Could not open '/opt/homebrew/Cellar/qemu/8.0.2/share/qemu/edk2-aarch64-code.fd': No such file or directory

我该如何修复这个错误?

答案1

问题在于,所使用的路径对于配置的机器来说不正确。

ls /opt/homebrew/Cellar/qemu/8.0.2/
ls: /opt/homebrew/Cellar/qemu/8.0.2/: No such file or directory

ls /opt/homebrew/Cellar/qemu/
8.0.3/

如果你编辑机器的配置,你可以更新磁盘映像的路径

podman machine inspect podman-machine-default | jq .[].ConfigPath
{
"Path": "/Users/aaron/.config/containers/podman/machine/qemu/podman-machine-default.json"
}

找出不正确的配置。

jq .CmdLine ~/.config/containers/podman/machine/qemu/podman-machine-default.json | grep qemu\/8
"file=/opt/homebrew/Cellar/qemu/8.0.2/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on",

编辑配置文件

nvim ~/.config/containers/podman/machine/qemu/podman-machine-default.json

将路径更新为新的正确版本号。从8.0.2->8.0.3

jq .CmdLine ~/.config/containers/podman/machine/qemu/podman-machine-default.json | grep qemu\/8
"file=/opt/homebrew/Cellar/qemu/8.0.3/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on",

就我而言,我必须开始、停止并重新开始,才能使一切正常运行。

❯ podman machine set --rootful

❯ podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users/aaron:/Users/aaron
Error: exit status 255

❯ podman machine list
NAME                    VM TYPE     CREATED      LAST UP            CPUS        MEMORY      DISK SIZE
podman-machine-default  qemu        4 weeks ago  Currently running  3           3.221GB     107.4GB

❯ podman machine stop
Waiting for VM to exit...
Machine "podman-machine-default" stopped successfully

❯ podman machine set --rootful

❯ podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users/aaron:/Users/aaron
Mounting volume... /private/tmp:/private/tmp
Mounting volume... /var/folders/:/var/folders/
API forwarding listening on: /var/run/docker.sock
Docker API clients default to this address. You do not need to set DOCKER_HOST.

Machine "podman-machine-default" started successfully

相关内容