Running x86_64-based containers on Mac computers with an Apple silicon (M1) processor
Hello, For the purpose of the Subject: there is a tutorial at IBM.com: https://developer.ibm.com/tutorials/running-x86-64-containers-mac-silicon-m1... I've followed this tutorial, with a small exception, see below. The first step is to 'init' the machine with: $ podman machine init --image-path ~/yourFedoraImageFolder/fedora-coreos-39.20231204.3.3-qemu.x86_64.qcow2.xz intel Extracting compressed file: intel_fedora-coreos-39.20231204.3.3-qemu.x86_64.qco… Image resized. Machine init complete To start your machine run: podman machine start intel Which worked fine. Now, before starting the machine, the tutorial asks to remove the following lines from the config file ~/.config/containers/podman/machine/qemu/intel.json: "-machine", "q35,accel=hvf:tcg", "-cpu", "host", These line are not there 1:1 and I removed these lines: $ diff .config/containers/podman/machine/qemu/intel.json .config/containers/podman/machine/qemu/intel.json.saved2 6a7,12
"-accel", "hvf", "-accel", "tcg", "-cpu", "host",
which seems to me correct to remove the HVF QEMU accelerator which only is supported on x86 chips. Starting the machine now with: $ podman machine start intel Di 16 Jan 2024 12:23:33 CET Starting machine "intel" Waiting for VM ... hangs for ever and the QEMU process has 100% CPU utilization: top PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP 10802 qemu-system- 99.6 23:09.43 8/1 0 27 163M 0B 0B 10800 Any ideas? Thanks matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub I am not at war with Russia. Я не воюю с Россией. Ich bin nicht im Krieg mit Russland.
On 1/16/24 06:49, Matthias Apitz wrote:
Hello,
For the purpose of the Subject: there is a tutorial at IBM.com:
https://developer.ibm.com/tutorials/running-x86-64-containers-mac-silicon-m1...
I've followed this tutorial, with a small exception, see below.
The first step is to 'init' the machine with:
$ podman machine init --image-path ~/yourFedoraImageFolder/fedora-coreos-39.20231204.3.3-qemu.x86_64.qcow2.xz intel Extracting compressed file: intel_fedora-coreos-39.20231204.3.3-qemu.x86_64.qco… Image resized. Machine init complete To start your machine run:
podman machine start intel
Which worked fine. Now, before starting the machine, the tutorial asks to remove the following lines from the config file ~/.config/containers/podman/machine/qemu/intel.json:
"-machine", "q35,accel=hvf:tcg", "-cpu", "host",
These line are not there 1:1 and I removed these lines:
$ diff .config/containers/podman/machine/qemu/intel.json .config/containers/podman/machine/qemu/intel.json.saved2 6a7,12
"-accel", "hvf", "-accel", "tcg", "-cpu", "host", which seems to me correct to remove the HVF QEMU accelerator which only is supported on x86 chips.
Starting the machine now with:
$ podman machine start intel Di 16 Jan 2024 12:23:33 CET Starting machine "intel" Waiting for VM ...
hangs for ever and the QEMU process has 100% CPU utilization:
top PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP 10802 qemu-system- 99.6 23:09.43 8/1 0 27 163M 0B 0B 10800
Any ideas? Thanks
matthias
Sergio any ideas?
El día martes, enero 16, 2024 a las 07:25:33a. m. -0500, Daniel Walsh escribió:
On 1/16/24 06:49, Matthias Apitz wrote:
Hello,
For the purpose of the Subject: there is a tutorial at IBM.com:
https://developer.ibm.com/tutorials/running-x86-64-containers-mac-silicon-m1...
I've followed this tutorial, with a small exception, see below.
The first step is to 'init' the machine with:
$ podman machine init --image-path ~/yourFedoraImageFolder/fedora-coreos-39.20231204.3.3-qemu.x86_64.qcow2.xz intel Extracting compressed file: intel_fedora-coreos-39.20231204.3.3-qemu.x86_64.qco… Image resized. Machine init complete To start your machine run:
podman machine start intel
Which worked fine. Now, before starting the machine, the tutorial asks to remove the following lines from the config file ~/.config/containers/podman/machine/qemu/intel.json:
"-machine", "q35,accel=hvf:tcg", "-cpu", "host",
These line are not there 1:1 and I removed these lines:
$ diff .config/containers/podman/machine/qemu/intel.json .config/containers/podman/machine/qemu/intel.json.saved2 6a7,12
"-accel", "hvf", "-accel", "tcg", "-cpu", "host", which seems to me correct to remove the HVF QEMU accelerator which only is supported on x86 chips.
Starting the machine now with:
$ podman machine start intel Di 16 Jan 2024 12:23:33 CET Starting machine "intel" Waiting for VM ...
hangs for ever and the QEMU process has 100% CPU utilization:
top PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP 10802 qemu-system- 99.6 23:09.43 8/1 0 27 163M 0B 0B 10800
Any ideas? Thanks
matthias
Sergio any ideas?
Only for the records: I used podman and qemu as installed with $ brew install podman $ podman --version podman version 4.8.3 $ /opt/homebrew/bin/qemu-system-aarch64 -version QEMU emulator version 8.2.0 Copyright (c) 2003-2023 Fabrice Bellard and the QEMU Project developers Later I tried the oficial MacOS version of podman and qemu which was not even able to start the qemu. -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub I am not at war with Russia. Я не воюю с Россией. Ich bin nicht im Krieg mit Russland.
On Tue, Jan 16, 2024 at 1:25 PM Daniel Walsh <dwalsh@redhat.com> wrote:
On 1/16/24 06:49, Matthias Apitz wrote:
Hello,
For the purpose of the Subject: there is a tutorial at IBM.com:
https://developer.ibm.com/tutorials/running-x86-64-containers-mac-silicon-m1...
I've followed this tutorial, with a small exception, see below.
The first step is to 'init' the machine with:
$ podman machine init --image-path
~/yourFedoraImageFolder/fedora-coreos-39.20231204.3.3-qemu.x86_64.qcow2.xz intel
Extracting compressed file: intel_fedora-coreos-39.20231204.3.3-qemu.x86_64.qco… Image resized. Machine init complete To start your machine run:
podman machine start intel
Which worked fine. Now, before starting the machine, the tutorial asks to remove the following lines from the config file ~/.config/containers/podman/machine/qemu/intel.json:
"-machine", "q35,accel=hvf:tcg", "-cpu", "host",
These line are not there 1:1 and I removed these lines:
$ diff .config/containers/podman/machine/qemu/intel.json .config/containers/podman/machine/qemu/intel.json.saved2 6a7,12
"-accel", "hvf", "-accel", "tcg", "-cpu", "host", which seems to me correct to remove the HVF QEMU accelerator which only is supported on x86 chips.
Starting the machine now with:
$ podman machine start intel Di 16 Jan 2024 12:23:33 CET Starting machine "intel" Waiting for VM ...
hangs for ever and the QEMU process has 100% CPU utilization:
top PID COMMAND %CPU TIME #TH #WQ #PORT MEM PURG CMPRS PGRP 10802 qemu-system- 99.6 23:09.43 8/1 0 27 163M 0B 0B 10800
Any ideas? Thanks
matthias
Sergio any ideas?
It's definitely not enough to change the lines indicated in the guide. You'd need to makes, at least, these changes: "CmdLine": [ - "/opt/homebrew/bin/qemu-system-aarch64", - "-accel", - "hvf", + "/opt/homebrew/bin/qemu-system-x86_64", "-accel", "tcg", - "-cpu", - "host", "-M", - "virt,highmem=on", - "-drive", - "file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on", - "-drive", - "file=/Users/slp/.local/share/containers/podman/machine/qemu/intel_ovmf_vars.fd,if=pflash,format=raw", + "q35", With this, after a looooooong time (5-10 minutes), I get a running x86_64 linux machine, and I can run x86_64 containers on it. That said, I'm not a big fan of this way of running x86_64 VMs on aarch64, as this is full system emulation and the performance it's going to be quite poor. Instead, a better option would be using an aarch64 VM with a distro extended have to binfmt_misc and qemu-user-static, so can rely on usermode emulation instead, which would yield significantly better results (specially if we eventually support other userspace emulators, such as fex-emu or box64). Sergio.
El día miércoles, enero 17, 2024 a las 10:58:13 +0100, Sergio Lopez escribió:
It's definitely not enough to change the lines indicated in the guide. You'd need to makes, at least, these changes:
"CmdLine": [ - "/opt/homebrew/bin/qemu-system-aarch64", - "-accel", - "hvf", + "/opt/homebrew/bin/qemu-system-x86_64", "-accel", "tcg", - "-cpu", - "host", "-M", - "virt,highmem=on", - "-drive", - "file=/opt/homebrew/share/qemu/edk2-aarch64-code.fd,if=pflash,format=raw,readonly=on", - "-drive", - "file=/Users/slp/.local/share/containers/podman/machine/qemu/intel_ovmf_vars.fd,if=pflash,format=raw", + "q35",
With this, after a looooooong time (5-10 minutes), I get a running x86_64 linux machine, and I can run x86_64 containers on it.
I started from scratch, applied your suggested changes and the machine starts in 3 minutes: $ date ; podman machine start intel ; date Do 18 Jan 2024 12:34:44 CET Starting machine "intel" Waiting for VM ... Mounting volume... /Users:/Users Mounting volume... /private:/private Mounting volume... /var/folders:/var/folders ... Machine "intel" started successfully Do 18 Jan 2024 12:37:50 CET Currently I'm building the container with: $ podman build -t suse suse This will take some time because one of our application packages is 500 MB in size, some 30.000 files which must be copied into places, chowned, etc. Thanks for your help matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub I am not at war with Russia. Я не воюю с Россией. Ich bin nicht im Krieg mit Russland.
El día miércoles, enero 17, 2024 a las 10:58:13 +0100, Sergio Lopez escribió:
...
That said, I'm not a big fan of this way of running x86_64 VMs on aarch64, as this is full system emulation and the performance it's going to be quite poor. Instead, a better option would be using an aarch64 VM with a distro extended have to binfmt_misc and qemu-user-static, so can rely on usermode emulation instead, which would yield significantly better results (specially if we eventually support other userspace emulators, such as fex-emu or box64).
I've built the podman container, which runs SuSE SLES, PostgreSQL server and our application server fine and fast enough: 85c48763d727:~ # ps ax PID TTY STAT TIME COMMAND 1 pts/0 Ss+ 0:00 /bin/sh -c /usr/local/bin/start.sh 25 ? S 0:01 /usr/local/sisis-pap/pgsql-15.1/bin/postmaster -D / 28 ? Ss 0:00 postgres: logger 29 ? Ss 0:02 postgres: checkpointer 30 ? Ss 0:03 postgres: background writer 32 ? Ss 0:09 postgres: walwriter 33 ? Ss 0:00 postgres: autovacuum launcher 34 ? Ss 0:00 postgres: logical replication launcher 41 pts/0 S+ 0:00 sshd: /usr/sbin/sshd -D [listener] 0 of 10-100 star 49 ? Rs 0:00 sshd: root@pts/1 51 pts/1 Ss 0:00 -bash 458 pts/1 S 0:00 /opt/lib/sisis/avserver/bin/AVServer -p 8076 518 pts/1 R+ 0:00 ps ax matthias -- Matthias Apitz, ✉ guru@unixarea.de, http://www.unixarea.de/ +49-176-38902045 Public GnuPG key: http://www.unixarea.de/key.pub I am not at war with Russia. Я не воюю с Россией. Ich bin nicht im Krieg mit Russland.
participants (3)
-
Daniel Walsh -
Matthias Apitz -
Sergio Lopez