Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Podman relies in config on specific qemu version to start a machine #18111

Closed
hmt opened this issue Apr 8, 2023 · 15 comments · Fixed by #18322
Closed

Podman relies in config on specific qemu version to start a machine #18111

hmt opened this issue Apr 8, 2023 · 15 comments · Fixed by #18322
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine

Comments

@hmt
Copy link

hmt commented Apr 8, 2023

Issue Description

The config that is set up has this line:

"file=/opt/homebrew/Cellar/qemu/7.2.0/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on",

However, my quemu has been updated to 7.2.1 and is therefore not available anymore. I manually updated the path, otherwise I wouldn't be able to start the machine.

Steps to reproduce the issue

Steps to reproduce the issue

  1. install podman and init a new machine
  2. update quemu to a different version
  3. be unable to start machine because of different quemu versions

Describe the results you received

Can't start machine

Describe the results you expected

machine starts

podman info output

~ 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/7.2.0/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on: Could not open '/opt/homebrew/Cellar/qemu/7.2.0/share/qemu/edk2-aarch64-code.fd': No such file or directory


### Podman in a container

No

### Privileged Or Rootless

None

### Upstream Latest Release

Yes

### Additional environment details

M2 MacBook Air

### Additional information

_No response_
@hmt hmt added the kind/bug Categorizes issue or PR as related to a bug. label Apr 8, 2023
@septemhill
Copy link

septemhill commented Apr 10, 2023

M1 Macbook Pro has the same issue.

edit:

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/7.2.0/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on: Could not open '/opt/homebrew/Cellar/qemu/7.2.0/share/qemu/edk2-aarch64-code.fd': No such file or directory

@Luap99
Copy link
Member

Luap99 commented Apr 11, 2023

What podman version is this?
Maybe caused by: #17027

@Luap99 Luap99 added the machine label Apr 11, 2023
@paganellif
Copy link

Same problem with MacBook Pro M1 running Podman version 4.4.4 after updating qemu to version 7.2.1.

I was only able to start a Podman Machine by deleting the old one and creating a new one.

@snejokeee
Copy link

Same problem with MacBook M1 Air.
symlink works for me as a crutch ln -s /opt/homebrew/Cellar/qemu/7.2.1 /opt/homebrew/Cellar/qemu/7.2.0

@tmoschou
Copy link

I'm on latest version 4.5.0 (Though can't be sure what version created the config file)

If a fully qualified path is required, can Podman just use this path, without fully resolving all symlinks along the path - it will point to the current version of qemu installed

$ echo "$(brew --prefix qemu)/share/qemu/edk2-aarch64-code.fd"
/opt/homebrew/opt/qemu/share/qemu/edk2-aarch64-code.fd

@acidghost
Copy link

As a workaround you don't have to delete te VM. You can just update the machine configuration file.

The file can be found by podman machine inspect | jq -r '.[].ConfigPath.Path'.
Then just replace /opt/homebrew/Cellar/qemu/<version> with /opt/homebrew/qemu.

@baude
Copy link
Member

baude commented Apr 23, 2023

oh my, thats no good ... lets fix this up ok @ashley-cui ?

@Luap99
Copy link
Member

Luap99 commented Apr 24, 2023

@baude I think #17027 caused this, I suggest we just revert that?
cc @n8henrie

@n8henrie
Copy link
Contributor

n8henrie commented Apr 24, 2023

Thanks for the cc and sorry for the trouble. I can probably test later today, but it would make sense for my PR to cause this change -- in one case (nix users) not resolving the symlink was the cause of the trouble, in another case (homebrew users) resolving it probably is. Homebrew users likely much more plentiful than nix users so reasonable to optimize for that case, though it sure would be nice to solve for both.

@n8henrie
Copy link
Contributor

Installed qemu from homebrew and using this as a little test script:

#!/usr/bin/env bash

set -Eeuf -o pipefail
shopt -s inherit_errexit
set -x

main() {
  (
    podman machine stop
    podman machine rm -f
    rm -r ~/.config/containers/
    make clean
  ) || true
  make podman-remote
  mv bin/darwin/podman bin/podman
  export CONTAINERS_HELPER_BINARY_DIR=$(dirname "$(type -p gvproxy)")
  bin/podman machine init
  bin/podman machine start
  grep edk2-aarch64-code.fd ~/.config/containers/podman/machine/qemu/podman-machine-default.json
}
main "$@"

Current main I get:

"file=/opt/homebrew/Cellar/qemu/8.0.0/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on"

after git revert --no-commit 6b6458916eaa51f0dbbcfeccd740706697697ad3, I get:

"file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on",

So as suspected reverting that commit should fix this issue.

I suspect it may re-break:

Could we revert #17027, re-open #17026, and I'll try to look for a solution there?

@ashley-cui
Copy link
Member

Thanks for looking into it, @n8henrie! Feel free to open a PR to revert #17027, and I'll re-open #17026

n8henrie added a commit to n8henrie/podman that referenced this issue Apr 24, 2023
This reverts commit 6b64589 (Resolve
symlink path for qemu directory if possible).

Fully resolving the symlink to qemu solves some issues for
aarch64-darwin nix with regards to finding `edk2-aarch64-code.fd`, but
unfortunately the fully resolved path includes the version number,
making it so that even patch updates break the path to
homebrew-installed qemu files.

Fixes containers#18111

[NO NEW TESTS NEEDED]

Signed-off-by: Nathan Henrie <[email protected]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/podman that referenced this issue May 24, 2023
This reverts commit 6b64589 (Resolve
symlink path for qemu directory if possible).

Fully resolving the symlink to qemu solves some issues for
aarch64-darwin nix with regards to finding `edk2-aarch64-code.fd`, but
unfortunately the fully resolved path includes the version number,
making it so that even patch updates break the path to
homebrew-installed qemu files.

Fixes containers#18111

[NO NEW TESTS NEEDED]

Signed-off-by: Nathan Henrie <[email protected]>
@Advantechnica
Copy link

Advantechnica commented Jun 16, 2023

I had this same error and managed to resolve by performing the following:

  1. podman machine list
  2. podman machine rm podman-machine-default
  3. podman init

Now my issue is resolved.

@sroecker
Copy link

3. podman init

podman machine init

@DrunkenBeetle
Copy link

Do we still need to drop and re-create the podman machine? I'm on version 4.6.1 and the qemu path in the config file for my default machine still points to a versioned path 8.0.0, but when removing and re-creating the machine the qemu path now points to the proper symlink /opt/homebrew/share/qemu/edk2-aarch64-code.fd

@tmoschou
Copy link

Do we still need to drop and re-create the podman machine?

If you have updated qemu via brew to a newer version, you will either need to drop and re-create the machine or edit the config file. You can check the installed version with

$ readlink -f $(brew --prefix qemu)
/opt/homebrew/Cellar/qemu/8.0.4

I've been using the following command to patch the config file without having to drop and recreate the machine.

/usr/bin/sed -E -i ".$(date +'%F@%T')~" 's,/Cellar/qemu/[^/]+,/opt/qemu,' \
  "$(podman machine inspect --format '{{ .ConfigPath.Path }}')"

@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Nov 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. machine
Projects
None yet
Development

Successfully merging a pull request may close this issue.