Skip to content

Cannot start machine with podman version 4.1.0 in M1 Mac #14303

Closed

Description

@Charizard

/kind bug

Description

In a M1 Mac, Downloaded the VM via podman machine init and then when trying to start it via podman machine start I get thew following error:

Starting machine "podman-machine-default"
Waiting for VM ...
Error: dial unix /var/folders/kk/vvrx0k6x2b54wnnhc0zt6rv00000gr/T/podman/podman-machine-default_ready.sock: connect: connection refused

Tried to download the arch specific VM via podman machine init --image-path=https://builds.coreos.fedoraproject.org/prod/streams/stable/builds/35.20220424.3.0/aarch64/fedora-coreos-35.20220424.3.0-qemu.aarch64.qcow2.xz and starting it again with the same error.

Steps to reproduce the issue:

  1. podman machine init

  2. podman machine start

Describe the results you received:

Error when trying to start the machine.

Describe the results you expected:

Expected the machine to start successfully.

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman. failed to create sshClient: connection to bastion host (ssh://core@localhost:56180/run/user/504/podman/podman.sock) failed: dial tcp [::1]:56180: connect: connection refused

Output of podman info --debug:

Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
Error: unable to connect to Podman. failed to create sshClient: connection to bastion host (ssh://core@localhost:56180/run/user/504/podman/podman.sock) failed: dial tcp [::1]:56180: connect: connection refused

Package info (e.g. output of rpm -q podman or apt list podman):

podman: stable 4.1.0 (bottled), HEAD
Tool for managing OCI containers and pods
https://podman.io/
/usr/local/Cellar/podman/4.1.0 (174 files, 48.2MB) *
  Poured from bottle on 2022-05-19 at 17:51:55
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/podman.rb
License: Apache-2.0
==> Dependencies
Build: go ✘, go-md2man ✘
Required: qemu ✔
==> Options
--HEAD
        Install HEAD version
==> Caveats
zsh completions have been installed to:
  /usr/local/share/zsh/site-functions
==> Analytics
install: 20,290 (30 days), 55,705 (90 days), 143,980 (365 days)
install-on-request: 20,245 (30 days), 55,655 (90 days), 143,917 (365 days)
build-error: 0 (30 days)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/main/troubleshooting.md)

Yes

Additional environment details (AWS, VirtualBox, physical, etc.):

Activity

  1. phenri00 commented on May 20, 2022

    @phenri00

    Experiencing similar(?) issue. M1 Mac.

    a@M1-Air ~ $ podman machine start
    Starting machine "podman-machine-default"
    Waiting for VM ...
    Error: dial unix /var/folders/1d/ts5cfq0d5sqfx5h9k7vkh2000000gn/T/podman/podman-machine-default_ready.sock: connect: connection refused
    
    a@M1-Air ~ $ podman info --debug
    Cannot connect to Podman....
    
    a@M1-Air ~ $ brew info podman
    podman: stable 4.1.0 (bottled), HEAD
    Tool for managing OCI containers and pods
    https://podman.io/
    /usr/local/Cellar/podman/HEAD-948c5e9 (174 files, 47.8MB) *
      Built from source on 2022-05-19 at 14:15:13
    From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/podman.rb
    License: Apache-2.0
    ==> Dependencies
    Build: go ✔, go-md2man ✔
    Required: qemu ✔
    ==> Options
    --HEAD
    	Install HEAD version
    
  2. nycnewman commented on May 22, 2022

    @nycnewman

    Getting same issue. If I run in debug mode the following command is run which produces the error if run standalone:

    /opt/homebrew/bin/qemu-system-aarch64 -m 27000 -smp 10 -fw_cfg name=opt/com.coreos/config,file=/Users/edwardnewman/.config/containers/podman/machine/qemu/podman-machine-default.ign -qmp unix://var/folders/tz/4n8rgr6n6wj5cgqzjx1dh0_80000gq/T/podman/qmp_podman-machine-default.sock,server=on,wait=off -netdev socket,id=vlan,fd=3 -device virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee -device virtio-serial -chardev socket,path=/var/folders/tz/4n8rgr6n6wj5cgqzjx1dh0_80000gq/T/podman/podman-machine-default_ready.sock,server=on,wait=off,id=podman-machine-default_ready -device virtserialport,chardev=podman-machine-default_ready,name=org.fedoraproject.port.0 -accel hvf -accel tcg -cpu cortex-a57 -M virt,highmem=off -drive file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on -drive file=/Users/edwardnewman/.local/share/containers/podman/machine/qemu/podman-machine-default_ovmf_vars.fd,if=pflash,format=raw -virtfs local,path=/Users/edwardnewman,mount_tag=vol0,security_model=mapped-xattr -drive if=virtio,file=/Users/edwardnewman/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-36.20220511.dev.0-qemu.aarch64.qcow2
    qemu-system-aarch64: -netdev socket,id=vlan,fd=3: can't get socket option SO_TYPE

  3. nycnewman commented on May 23, 2022

    @nycnewman

    Note that it is not possible on MacOS to downgrade to previous podman version as the tap appears to only understand 4.1.0. Was proposing to test to see if that still works as issue appears to be with qemu.

  4. mheon commented on May 23, 2022

    @mheon
    Contributor
  5. ktram commented on May 25, 2022

    @ktram

    Also running into this, and I saw the same qemu-system-aarch64: -netdev socket,id=vlan,fd=3: can't get socket option SO_TYPE error message as @nycnewman. After downgrading qemu, I was able to run podman.

  6. lukas-vlcek commented on May 25, 2022

    @lukas-vlcek

    I am running into the same issue.
    @ktram Would you mind sharing your steps to downgrade qemu? I installed it using brew and it seems that downgrading packages in brew is full of magic.

  7. ashley-cui commented on May 25, 2022

    @ashley-cui
    Contributor

    Hmm, maybe it looks like something changed in qemu 7.0? Taking a look...

  8. lukas-vlcek commented on May 25, 2022

    @lukas-vlcek

    I can confirm that after downgrading the qemu to 6.2.0 I was able to start the machine and connect to it.

    # =========================
    # Versions
    
    % podman --version
    podman version 4.1.0
    
    % qemu-system-aarch64 --version
    QEMU emulator version 6.2.0
    
    # =========================
    # My VMs
    
    % podman machine list           
    NAME                     VM TYPE     CREATED      LAST UP      CPUS        MEMORY      DISK SIZE
    opensearch               qemu        3 hours ago  3 hours ago  4           34.36GB     107.4GB
    podman-machine-default*  qemu        3 hours ago  3 hours ago  1           2.147GB     10.74GB
    
    # =========================
    # Starting the machine
    
    % podman machine start opensearch
    Starting machine "opensearch"
    Waiting for VM ...
    Mounting volume... /Users/lukas.vlcek:/Users/lukas.vlcek
    
    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 opensearch
    
    API forwarding listening on: /Users/lukas.vlcek/.local/share/containers/podman/machine/opensearch/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 /opt/homebrew/Cellar/podman/4.1.0/bin/podman-mac-helper install
    	podman machine stop opensearch; podman machine start opensearch
    
    You can still connect Docker API clients by setting DOCKER_HOST using the
    following command in your terminal session:
    
    	export DOCKER_HOST='unix:///Users/lukas.vlcek/.local/share/containers/podman/machine/opensearch/podman.sock'
    
    Machine "opensearch" started successfully
    
    # =========================
    # And finally, SSH into the machine
    
    % podman machine ssh opensearch
    Connecting to vm opensearch. To close connection, use `~.` or `exit`
    Warning: Permanently added '[localhost]:56046' (ED25519) to the list of known hosts.
    Fedora CoreOS 36.20220511.dev.0
    Tracker: https://github.com/coreos/fedora-coreos-tracker
    Discuss: https://discussion.fedoraproject.org/tag/coreos
    

    Note: But this is not to say that podman 4.1.0 will work correctly with qemu 6.2.0 !!!

    Now, just a quick notes about how I downgraded the qemu.
    A great help was this article by @sandipb

    # At this point I already have podman 4.1.0 installed with qemu 7.0.0
    
    % brew tap-new lukas/local-qemu
    % brew extract --version=6.2.0 qemu lukas/local-qemu
    % brew uninstall --ignore-dependencies qemu
    % brew install lukas/local-qemu/[email protected]
    
    # Done.
    # Notice that I did not use the HOMEBREW_NO_AUTO_UPDATE=1 parameter (see the article)
    # so the qemu will probably be updated with the next `brew update` command...
  9. ktram commented on May 25, 2022

    @ktram

    @lukas-vlcek I followed the same steps to downgrade (used this article). I think your qemu will not update on the next brew update, because you have [email protected] installed instead of qemu.

  10. shanesmith commented on May 25, 2022

    @shanesmith
    Contributor

    In case it's of any use, I'm finding that the max memory I'm able to set on a machine is 3072, otherwise I see the connection refused error.

    ✔️ The following works:

    podman machine init # default memory is 2048
    podman machine start
    
    podman machine init -m 3072
    podman machine start
    
    podman machine init
    podman machine set -m 3072
    podman machine start
    

    ✖️ The following results in the connection refused error:

    podman machine init -m 3073
    podman machine start
    
    podman machine init -m 4096
    podman machine start
    
    podman machine init
    podman machine set -m 4096
    podman machine start
    
  11. justin-f-perez commented on May 25, 2022

    @justin-f-perez

    I am also experiencing this issue on an M1 mac running MacOS 12.4 (21F79) with podman 4.1.0 and qemu 7.0.0 (with qemu being installed automatically by homebrew as a dependency of podman). The comment from @shanesmith allowed me to initialize and start a podman machine but I still receive connection failures if I attempt to actually run anything.

    🔧 pm-clean util function

    I ran this before each of the below tests

    pm-clean() { podman machine ls -q | sed 's/\*$//' | xargs -L1 podman machine rm --force 2>/dev/null; podman machine ls --noheading; }

    ❌ podman machine init --cpus=4 --disk-size=20 --memory=3072 --timezone=local --rootful=false --now

    Confirming @shanesmith comment, rootless works with memory <= 3072

    I can initialize and start the machine, but can't actually connect to it.

    $ podman machine init \
                    --cpus=4 \
                    --disk-size=20 \
                    --memory=3072 \
                    --timezone=local \
                    --rootful=false \
                    --now
    
    Extracting compressed file
    Image resized.
    Machine init complete
    Waiting for VM ...
    Mounting volume... /Users/podman-rootless-user:/Users/podman-rootless-user
    Error: exit status 255
    
    $ podman machine ls
    NAME                     VM TYPE     CREATED        LAST UP            CPUS        MEMORY      DISK SIZE
    podman-machine-default*  qemu        3 minutes ago  Currently running  4           3.221GB     21.47GB
    
    $ podman run ubuntu /bin/bash
    Cannot connect to Podman. Please verify your connection to the Linux system using `podman system connection list`, or try `podman machine init` and `podman machine start` to manage a new Linux VM
    Error: unable to connect to Podman. failed to create sshClient: connection to bastion host (ssh://core@localhost:64227/run/user/1117123858/podman/podman.sock) failed: ssh: handshake failed: ssh: disconnect, reason 2: Too many authentication failures
    
    $ ll ~/.ssh/podman-machine-default 
    Permissions Size User    Date Modified Name
    .rw-------   411 podman-rootless-user 25 May 17:34  /Users/podman-rootless-user/.ssh/podman-machine-default
    
    $ podman machine ssh
    Connecting to vm podman-machine-default. To close connection, use `~.` or `exit`
    Warning: Permanently added '[localhost]:64227' (ED25519) to the list of known hosts.
    Received disconnect from ::1 port 64227:2: Too many authentication failures
    Disconnected from ::1 port 64227
    Error: exit status 255

    ❌ podman machine init --cpus=4 --disk-size=20 --memory=3072 --timezone=local --rootful=true --now --log-level=trace

    So does rootful (but only with memory <= 3072)

    Same result as attempting rootless above

    ❌ podman machine init --cpus=4 --disk-size=20 --memory=4096 --timezone=local --rootful=true --now --log-level=trace

    time="2022-05-25T15:12:10-05:00" level=info msg="podman filtering at log level trace"
    Extracting compressed file
    time="2022-05-25T15:12:28-05:00" level=trace msg="Reading configuration file \"/Users/podman-rootful-user/.config/containers/containers.conf\""
    time="2022-05-25T15:12:28-05:00" level=trace msg="Reading configuration file \"/Users/podman-rootful-user/.config/containers/containers.conf\""
    Image resized.
    Machine init complete
    time="2022-05-25T15:12:28-05:00" level=debug msg="[/opt/homebrew/bin/qemu-system-aarch64 -m 4096 -smp 4 -fw_cfg name=opt/com.coreos/config,file=/Users/podman-rootful-user/.config/containers/podman/machine/qemu/podman-machine-default.ign -qmp unix://var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/qmp_podman-machine-default.sock,server=on,wait=off -netdev socket,id=vlan,fd=3 -device virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee -device virtio-serial -chardev socket,path=/var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/podman-machine-default_ready.sock,server=on,wait=off,id=podman-machine-default_ready -device virtserialport,chardev=podman-machine-default_ready,name=org.fedoraproject.port.0 -accel hvf -accel tcg -cpu cortex-a57 -M virt,highmem=off -drive file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on -drive file=/Users/podman-rootful-user/.local/share/containers/podman/machine/qemu/podman-machine-default_ovmf_vars.fd,if=pflash,format=raw -virtfs local,path=/Users/podman-rootful-user,mount_tag=vol0,security_model=mapped-xattr -drive if=virtio,file=/Users/podman-rootful-user/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-36.20220511.dev.0-qemu.aarch64.qcow2]"
    Waiting for VM ...
    Error: dial unix /var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/podman-machine-default_ready.sock: connect: connection refused
    

    ❌ podman machine init --cpus=4 --disk-size=20 --memory=4096 --timezone=local --rootful=false --now --log-level=trace

    time="2022-05-25T15:01:24-05:00" level=info msg="podman filtering at log level trace"
    Extracting compressed file
    time="2022-05-25T15:01:42-05:00" level=trace msg="Reading configuration file \"/Users/podman-rootless-user/.config/containers/containers.conf\""
    time="2022-05-25T15:01:42-05:00" level=trace msg="Reading configuration file \"/Users/podman-rootless-user/.config/containers/containers.conf\""
    Image resized.
    Machine init complete
    time="2022-05-25T15:01:42-05:00" level=debug msg="[/opt/homebrew/bin/qemu-system-aarch64 -m 4096 -smp 4 -fw_cfg name=opt/com.coreos/config,file=/Users/podman-rootless-user/.config/containers/podman/machine/qemu/podman-machine-default.ign -qmp unix://var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/qmp_podman-machine-default.sock,server=on,wait=off -netdev socket,id=vlan,fd=3 -device virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee -device virtio-serial -chardev socket,path=/var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/podman-machine-default_ready.sock,server=on,wait=off,id=podman-machine-default_ready -device virtserialport,chardev=podman-machine-default_ready,name=org.fedoraproject.port.0 -accel hvf -accel tcg -cpu cortex-a57 -M virt,highmem=off -drive file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on -drive file=/Users/podman-rootless-user/.local/share/containers/podman/machine/qemu/podman-machine-default_ovmf_vars.fd,if=pflash,format=raw -virtfs local,path=/Users/podman-rootless-user,mount_tag=vol0,security_model=mapped-xattr -drive if=virtio,file=/Users/podman-rootless-user/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-36.20220511.dev.0-qemu.aarch64.qcow2]"
    Waiting for VM ...
    Error: dial unix /var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/podman-machine-default_ready.sock: connect: connection refused
    
  12. shanesmith commented on May 26, 2022

    @shanesmith
    Contributor

    @justin-f-perez It's probably a different issue, but I've found that the --now flag for podman machine init can be unreliable. If I can't connect to a machine after using --now I can fix it however by stopping it then starting it again.

    For this issue, perhaps you could avoid --now and instead manually run a start after the init?

  13. justin-f-perez commented on May 26, 2022

    @justin-f-perez

    @shanesmith Thanks for the suggestion! It doesn't seem to matter how I initialize the machine, I get the same meaningless error 😮‍💨

    $ podman machine stop && podman machine rm --force && podman machine init && podman machine start --log-level=trace
    INFO[0000] podman filtering at log level trace
    DEBU[0000] [/opt/homebrew/bin/qemu-system-aarch64 -m 2048 -smp 1 -fw_cfg name=opt/com.coreos/config,file=/Users/podman-is-so-broken/.config/containers/podman/machine/qemu/podman-machine-default.ign -qmp unix://var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/qmp_podman-machine-default.sock,server=on,wait=off -netdev socket,id=vlan,fd=3 -device virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee -device virtio-serial -chardev socket,path=/var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/podman-machine-default_ready.sock,server=on,wait=off,id=podman-machine-default_ready -device virtserialport,chardev=podman-machine-default_ready,name=org.fedoraproject.port.0 -accel hvf -accel tcg -cpu cortex-a57 -M virt,highmem=off -drive file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on -drive file=/Users/podman-is-so-broken/.local/share/containers/podman/machine/qemu/podman-machine-default_ovmf_vars.fd,if=pflash,format=raw -virtfs local,path=/Users/podman-is-so-broken,mount_tag=vol0,security_model=mapped-xattr -drive if=virtio,file=/Users/podman-is-so-broken/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-36.20220511.dev.0-qemu.aarch64.qcow2]
    Starting machine "podman-machine-default"
    DEBU[0000] [/opt/homebrew/bin/qemu-system-aarch64 -m 2048 -smp 1 -fw_cfg name=opt/com.coreos/config,file=/Users/podman-is-so-broken/.config/containers/podman/machine/qemu/podman-machine-default.ign -qmp unix://var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/qmp_podman-machine-default.sock,server=on,wait=off -netdev socket,id=vlan,fd=3 -device virtio-net-pci,netdev=vlan,mac=5a:94:ef:e4:0c:ee -device virtio-serial -chardev socket,path=/var/folders/8_/_z_4l9jx6214q4ztktdvhg3d19bx8k/T/podman/podman-machine-default_ready.sock,server=on,wait=off,id=podman-machine-default_ready -device virtserialport,chardev=podman-machine-default_ready,name=org.fedoraproject.port.0 -accel hvf -accel tcg -cpu cortex-a57 -M virt,highmem=off -drive file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on -drive file=/Users/podman-is-so-broken/.local/share/containers/podman/machine/qemu/podman-machine-default_ovmf_vars.fd,if=pflash,format=raw -virtfs local,path=/Users/podman-is-so-broken,mount_tag=vol0,security_model=mapped-xattr -drive if=virtio,file=/Users/podman-is-so-broken/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-36.20220511.dev.0-qemu.aarch64.qcow2]
    Waiting for VM ...
    Mounting volume... /Users/podman-is-so-broken:/Users/podman-is-so-broken
    DEBU[0013] Executing: ssh [-i /Users/podman-is-so-broken/.ssh/podman-machine-default -p 62930 core@localhost -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -q -- sudo chattr -i / ; sudo mkdir -p /Users/podman-is-so-broken ; sudo chattr +i / ;]
    Error: exit status 255
    
    $ echo $?
    125
  14. 35 remaining items

  15. carlosgorges commented on Jun 21, 2022

    @carlosgorges

    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
    

    I hope help.
    Carlos Eduardo Gorges.

  16. mixpix3ls commented on Jun 25, 2022

    @mixpix3ls

    Please upgrade your podman to 4.1.1 and make sure your macos version is 12.4

    👋🏽 @ashley-cui and all, thanks for looking into this. I'm able to start the machine (albeit after a long time given I used 2 vCPUs, 2GB of memory and 20GB disk specs for the VM).

  17. cpolizzi commented on Jun 25, 2022

    @cpolizzi

    @mixpix3ls With your host upgraded to macOS 12.4 and using Podman 4.1.1 and ensuring that the linked fix #14563 is applied to your Podman configuration file for the QEMU CmdLine flags as described here and fixed in #14563 then you can run with more than your current VM sizing. Yesterday I confirmed with several folks that have M1 Pro Max SoC's that once they did these things they could size the VM to as the maximum number of performance cores available (8 in their case) and more than 3GB of memory without issue.

  18. momrak commented on Jul 11, 2022

    @momrak

    I still have problems getting this to work. First, since I am on Podman v4.1.1 should not -cpu be host and highmem=on be that by default now? I still have to make that change manually here. And also after doing that I am unable to get it running.

    What am I missing?

    I am using nix as package manager if that is of any help

    image

  19. baude commented on Jul 11, 2022

    @baude
    Contributor

    we are cutting an 4.2 rc1 today. Any chance you couild build that and try?

  20. momrak commented on Jul 11, 2022

    @momrak

    Unfortunately I don't know how to override and specify this with Nix, but I'll keep an eye out for the new version and see if I get it working when it is out

  21. waikontse commented on Jul 14, 2022

    @waikontse

    Here is a snippet from my m1 pro on 4.2 rc1. I hope it is useful. Also, I've use podman machine set --rootful
    before starting the machine. Removed the old machine with the old settings set up by podman 4.1.1
    `
    podman --version
    podman version 4.2.0-rc1

    ➜ podman-4.2.0-rc1 podman machine start
    Starting machine "podman-machine-default"

    Waiting for VM ...
    Error: qemu exited unexpectedly with exit code 1, stderr: qemu-system-aarch64: -fw_cfg name=opt/com.coreos/environment,string=bm9fcHJveHk9Ii5pbnRyYW5ldCwuaW5nLm5ldCwxMjcuMC4wLjEsbG9jYWxob3N0LCouZGV2LmF6dXJlLmNvbSx3ZWIud2hhdHNhcHAuY29tInxodHRwX3Byb3h5PSJodHRwOi8vbG9jYWxob3N0OjMxMjgifGh0dHBzX3Byb3h5PSJodHRwOi8vbG9jYWxob3N0OjMxMjgifA==: duplicate fw_cfg file name: opt/com.coreos/environment
    `

  22. JonasJonny commented on Jul 18, 2022

    @JonasJonny

    Today I had:
    podman/podman-machine-default_ready.sock: connect: connection refused

    What worked for me:

    1. podman machine stop
    2. podman machine rm
    3. podman machine init
    4. podman machine start
    
  23. ericcurtin commented on Aug 3, 2022

    @ericcurtin
    Contributor

    My workaround is to delete the VM and start from scratch

    $ podman machine stop
    $ podman machine rm --force
    $ podman machine init --cpus 2 --memory 2048 --disk-size 20
    $ podman machine start
    

    version

    $ podman --version
    podman version 4.1.0
    $ qemu-system-aarch64 --version 
    QEMU emulator version 7.0.0
    

    Highly recommend this solution if you are happy to throw away everything by the way... Although I do tend to do "--cpus $(sysctl -n hw.ncpu)", to get all my CPUs in

  24. mkenigs commented on Sep 23, 2022

    @mkenigs

    I still have problems getting this to work. First, since I am on Podman v4.1.1 should not -cpu be host and highmem=on be that by default now? I still have to make that change manually here. And also after doing that I am unable to get it running.

    I am using nix as package manager if that is of any help

    Also using nix, and for some reason I was still running into this until 4.2

  25. paulatwork commented on Feb 23, 2023

    @paulatwork

    EXCELLENT fix from Carlos Eduardo Gorges, on stackoverflow.
    Caused due to qemu 7.0.0 startup latency (3-5s).
    To fix .. execute qemu, to initialize, before call "podman machine start".
    Works for me ..
    https://stackoverflow.com/questions/72404926/cant-get-podman-to-run-on-an-mac-m1-monterey

  26. justkash commented on Apr 17, 2023

    @justkash

    This is a problem with virtualizing memory in newer versions of Qemu (7.0+) on aarch64 machines. I resolved the issue by updating the ~/.config/containers/podman/machine/qemu/podman-machine-default.json file before starting the podman machine VM. Here are the steps that worked for me:

    1. Create machine VM with podman machine init ( with -v $HOME:$HOME if you want to be able to mount volumes)
    2. Update -M entry to virt,highmem=off in ~/.config/containers/podman/machine/qemu/podman-machine-default.json
    3. Save file and run podman machine start
  27. johnhamelink commented on Jul 11, 2023

    @johnhamelink

    Hi folks,

    I'm also attempting to use podman from within a Nix shell on aarch64-darwin (M1 Max).

    {
      description = "Example Nix Environment";
    
      inputs = {
        nixpkgs = { url = "github:NixOS/nixpkgs/nixpkgs-unstable"; };
        flake-utils = { url = "github:numtide/flake-utils"; };
      };
    
      outputs = { self, nixpkgs, flake-utils }:
        flake-utils.lib.eachDefaultSystem (system:
          let
            pkgs = import nixpkgs {
              inherit system;
            };
    
            # Configure podman
            podmanSetupScript = let
              registriesConf = pkgs.writeText "registries.conf " ''
              unqualified-search-registries = ["docker.io"]
              [registries.search]
              registries = ['docker.io']
    
              [registries.block]
              registries = []
              '';
            in pkgs.writeScript "podman-setup" ''
            #!${pkgs.runtimeShell}
    
            if ! test -f ~/.config/containers/registries.conf; then
               install -Dm555 ${registriesConf} ~/.config/containers/registries.conf
            fi
            '';
          in
            {
              # See: https://gist.github.com/adisbladis/187204cb772800489ee3dac4acdd9947
              packages.default = pkgs.mkShell {
                buildInputs = with pkgs; [
                  podman
                  podman-compose
                ];
    
                shellHook = ''
                # Install required configuration
                ${podmanSetupScript}
    
                # Start the podman machine. We change the default name to
                # VM so we can avoid:
                # TODO: This is only necessary in Darwin
                # https://github.com/containers/podman/issues/13609#issuecomment-1076366318
    
                podman machine init \
                  --timezone=local \
                  --rootful=false \
                  --log-level=trace \
                  -v $HOME:$HOME \
                  vm
                '';
              };
            });
    }

    After entering the shell, and allowing podman to initialise, when I run podman machine start vm, the qmp_<machine-name>.sock file isn't found:

    johnhamelink@jh-mbp example % podman --log-level=trace machine start vm                                           ~/code/example
    INFO[0000] /nix/store/mfqwvsv33rbvbz7gpljb56rdf0vi41b4-podman-4.5.1/bin/podman filtering at log level trace 
    Starting machine "vm"
    Error: dial unix /var/folders/9b/_c6ry1bx4yz4w5v61wygygl80000gp/T/nix-shell.jG7OwJ/podman/qmp_vm.sock: connect: no such file or directory
    DEBU[0003] Shutting down engines 
    johnhamelink@jh-mbp example % podman machine ls                                                                   ~/code/example
    NAME        VM TYPE     CREATED        LAST UP        CPUS        MEMORY      DISK SIZE
    vm*         qemu        2 minutes ago  2 minutes ago  1           2.147GB     107.4GB
    johnhamelink@jh-mbp example % podman machine inspect vm                                                           ~/code/example
    [
         {
              "ConfigPath": {
                   "Path": "/Users/johnhamelink/.config/containers/podman/machine/qemu/vm.json"
              },
              "ConnectionInfo": {
                   "PodmanSocket": {
                        "Path": "/Users/johnhamelink/.local/share/containers/podman/machine/qemu/podman.sock"
                   },
                   "PodmanPipe": null
              },
              "Created": "2023-07-11T14:05:36.313897+01:00",
              "Image": {
                   "IgnitionFilePath": {
                        "Path": "/Users/johnhamelink/.config/containers/podman/machine/qemu/vm.ign"
                   },
                   "ImageStream": "testing",
                   "ImagePath": {
                        "Path": "/Users/johnhamelink/.local/share/containers/podman/machine/qemu/vm_fedora-coreos-38.20230625.2.0-qemu.aarch64.qcow2"
                   }
              },
              "LastUp": "2023-07-11T14:05:36.313897+01:00",
              "Name": "vm",
              "Resources": {
                   "CPUs": 1,
                   "DiskSize": 100,
                   "Memory": 2048
              },
              "SSHConfig": {
                   "IdentityPath": "/Users/johnhamelink/.ssh/vm",
                   "Port": 50070,
                   "RemoteUsername": "core"
              },
              "State": ""
         }
    ]
    

    I've tried adjusting the memory as mentioned by @justkash above, reducing the length of the machine name (down to 'vm'). I've also ensured -cpu=host and highmem=on are set by default as @momrak suggests.

  28. locked as resolved and limited conversation to collaborators on Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.locked - please file new issue/PRAssist humans wanting to comment on an old issue or PR with locked comments.machine

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions