-
-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
nixpkgs podman and qemu on darwin don't play well together #169118
Comments
This is sort of a bug and sort of not. podman is still useable if you manage the qemu machines yourself on darwin or connect to remote machines. However, I think most podman users will expect the |
Also see #163015. |
Interesting. It would be nice if there was a way for us to tell podman where qemu stuff was so it didn't try to guess from a few hard coded paths but I'm not confident that upstream will be doing so anytime soon. I guess I'll have to get something done via an overlay but that kind of sucks. |
You've probably seen it, just to link it: containers/podman#12379 (comment). |
By following the containers/podman#12379 (comment), add more details about the workaround here:
[engine]
helper_binaries_dir = ["/Users/ethinx/.nix-profile/bin"]
change the
to abspath in
Now you could start the machine
|
I just corrected the path for: |
That is a manual workaround yes. But it sort of defeats the purpose of the
using nix if you have to do this and you'll have to update the path if you
ever upgrade qemu so it's only a temporary fix.
…On Tue, May 10, 2022 at 9:11 AM Ivan Kovnatsky ***@***.***> wrote:
I just corrected the path for: edk2-aarch64-core.fd, nothing else.
—
Reply to this email directly, view it on GitHub
<#169118 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAJ5N2RB22VHLWO6OLOLNTVJJOATANCNFSM5TUPLN6Q>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
--
Jeremy Wall
http://jeremy.marzhillstudios.com
***@***.***
|
You can also make the path be I've found podman to not be a good experience though and would highly recommend giving colima a shot. |
Fixes containers#17026 Fixes NixOS/nixpkgs#169118 [NO NEW TESTS NEEDED] Related: NixOS/nixpkgs#163015 Signed-off-by: Nathan Henrie <[email protected]>
Fixes containers#17026 Fixes NixOS/nixpkgs#169118 [NO NEW TESTS NEEDED] Related: NixOS/nixpkgs#163015 Signed-off-by: Nathan Henrie <[email protected]>
It seem that this is fixed? Just tried newest version of podman and it correctly created and started VM. |
I think this will be fixed by containers/podman#17027 in podman 4.5.0 and may have been cherry-picked back to 4.4 in containers/podman@a1cc373 Currently I'm getting podman 4.3 in unstable, it looks like 4.4 is in master: 03d50d8 That said, it seems? to be working on 4.3 right now, so maybe my PR wasn't needed in the first place? M1 Mac, 13.3 $ nix shell -i -k HOME nixpkgs#bash nixpkgs#podman nixpkgs#qemu --command bash -c 'export PATH=/usr/bin:$PATH; podman machine init && podman machine start'
Downloading VM image: fedora-coreos-37.20230401.2.0-qemu.aarch64.qcow2.xz: done
Extracting compressed file
Image resized.
Machine init complete
To start your machine run:
podman machine start
Starting machine "podman-machine-default"
Waiting for VM ...
Mounting volume... /Users/n8henrie:/Users/n8henrie
This machine is currently configured in rootless mode. If your containers
require root permissions (e.g. ports < 1024), or if you run into compatibility
issues with non-podman clients, you can switch using the following command:
podman machine set --rootful
API forwarding listening on: /Users/n8henrie/.local/share/containers/podman/machine/podman-machine-default/podman.sock
The system helper service is not installed; the default Docker API socket
address can't be used by podman. If you would like to install it run the
following commands:
sudo /nix/store/rw74mlcsgf6bq31i0mhvbdgvfhz81cmw-podman-4.3.1/bin/podman-mac-helper install
podman machine stop; podman machine start
You can still connect Docker API clients by setting DOCKER_HOST using the
following command in your terminal session:
export DOCKER_HOST='unix:///Users/n8henrie/.local/share/containers/podman/machine/podman-machine-default/podman.sock'
Machine "podman-machine-default" started successfully |
This issue has been mentioned on NixOS Discourse. There might be relevant details there: https://discourse.nixos.org/t/out-share-linked-with-nix-profile-install-but-not-otherwise/27561/1 |
See related issue for needed workarounds on Mac: NixOS/nixpkgs#169118
* Add support for Darwin (aarch64) * Fix home directory for MacOS * Edit gitconfig path * Add podman See related issue for needed workarounds on Mac: NixOS/nixpkgs#169118 * Add mac to wireguard config
I just did a recent installation of My script + invocations used to stand up the VM and use it, in case it matters:
#!/usr/bin/env bash
set -euo pipefail
container_name="nix-run"
script="$@"
podman machine init --cpus 12 --memory 8192 --disk-size 50 \
--volume $HOME:$HOME || true
podman machine start || true
podman container ls -a | grep $container_name > /dev/null || \
podman create -t --name $container_name -w /workdir \
-v $PWD:/workdir nixos/nix
container_id=$(podman start $container_name)
echo "$container_id"
podman exec $container_id $script
podman stop $container_name || true
podman machine stop And an example run: $ ./with-podman.sh ls -al
Error: podman-machine-default: VM already exists
Error: cannot start VM podman-machine-default: VM already running or starting
nix-run
total 12
drwxr-xr-x 11 root nobody 352 Dec 24 13:17 .
dr-xr-xr-x 1 root root 77 Dec 24 13:26 ..
drwxr-xr-x 10 root nobody 320 Dec 24 13:41 .git
-rw-r--r-- 1 root nobody 283 Dec 22 00:50 README.org
-rw-r--r-- 1 root nobody 3809 Dec 24 00:29 flake.nix
drwxr-xr-x 3 root nobody 96 Dec 24 00:30 hosts
drwxr-xr-x 4 root nobody 128 Dec 24 00:40 modules
drwxr-xr-x 3 root nobody 96 Dec 24 00:42 pkgs
drwxr-xr-x 3 root nobody 96 Dec 24 00:52 profiles
drwxr-xr-x 4 root nobody 128 Dec 24 00:41 shell
-rwxr-xr-x 1 root nobody 523 Dec 24 13:40 with-podman.sh
nix-run
Waiting for VM to exit...
Machine "podman-machine-default" stopped successfully |
why didn't i know about colima sooner? I've actively searched for docker alternatives. |
I retract my previous claim that this ticket should be closed. I don't know why one of my machines was spared this issue. Another machine using a more recent |
Added these two: home.packages = with pkgs; [
colima
docker
] Ran: $ colima start
$ docker run hello-world
Hello from Docker! Wow, that is indeed a much better experience than what I've been banging my head against so far just to get a container running on macOS. Just wanted to say hi and thank you @Atemu. I'm learning Nix through home-manager and as I'm scavenging through various GitHub issues this is not the first time I've come across your name providing valuable comments turning my showstoppers into elegant solutions. Much appreciated! |
Just need to run `colima start` once on boot. Better than the behemoth that is Docker Desktop. I'm not using Podman on macOS due to: NixOS/nixpkgs#169118
I believe that Podman 5.0.0 might fix this by allowing Podman to use the builtin virtualization technology on darwin. I've started a PR to upgrade it here: #299302 |
Apparently Podman 5.0.x requires I opened the following issue to report this information separately: #305868 |
I also did this using the homebrew support in nix darwin: ...
homebrew = {
enable = true;
onActivation.upgrade = true;
taps = [
# https://github.com/crc-org/vfkit
"cfergeau/crc"
];
brews = [ "vfkit" ];
... |
That's cool that you can do that! But I'm trying to replace Homebrew with Nix... |
Should I open an issue to request a |
Done: #306179 |
Describe the bug
On darwin
podman machine
requires qemu to be installed. It also assumes that qemu has either been installed from source or via brew. This results in error messages where podman can't find the edk2 file.Steps To Reproduce
Steps to reproduce the behavior:
podman machine init test
podman machine start test
Expected behavior
To see a successfully started virtual machine. Instead you will see the following:
Additional context
For context the issue in podman appears to be this: https://github.com/containers/podman/blob/main/pkg/machine/qemu/options_darwin_arm64.go#L47 . It would be possible to work around this by modifying by modifying the appropriate machine configuration in
~/.config/containers/podman/machine/qemu/${name}.json
but that would require there to be a known good location for the edk2 file to live and right now it's only in the store path for qemu and that can change over time. Ideally the quemushare
path would be put in the profile and podman would be patched to search the current nixos profile path for qemu instead.As it is if you want to use podman and qemu on darwin then qemu can't be installed via nix it would have to installed via brew intead.
Notify maintainers
@zowoq @marsam
Metadata
The text was updated successfully, but these errors were encountered: