libvirt has some problems to use qemu on MacOS
Software environment
- Operating system: Mac OS Ventura 13.4.1
- Architecture: arm64 (Apple M1 Max)
- kernel version: 22.5.0
- libvirt version: 9.6.0
- Hypervisor and version: qemu 8.0.3
Description of problem
It seams like there is a problem on my mac with libvirt using qemu, when i resize a image, create a new qcow2 image or run a qemu machine. It worked the last days and stopped working today, but I don't know why and how to solve it. Seems like sysconf(_SC_OPEN_MAX)
has something to do with it, but I don't know what exactly it does and how it causes this problem or even how I could solve it.
Here is the log:
libvirt: Fehler : sysconf(_SC_OPEN_MAX) gescheitert: Invalid argument
2023-08-09 14:55:19.381+0000: 6130118656: error : virCommandWait:2754 : Interner Fehler: Untergeordneter Prozess (/opt/homebrew/bin/qemu-img resize /opt/homebrew/var/lib/libvirt/images/test-image 10000000000) unerwartet Ende Status 125
libvirt: Fehler : sysconf(_SC_OPEN_MAX) gescheitert: Invalid argument
2023-08-09 14:55:37.727+0000: 6131265536: error : qemuProcessQMPLaunch:9420 : Interner Fehler: Failed to start QEMU binary /opt/homebrew/bin/qemu-system-aarch64 for probing:
2023-08-09 14:55:37.727+0000: 6131265536: warning : virQEMUCapsLogProbeFailure:5669 : Failed to probe capabilities for /opt/homebrew/bin/qemu-system-aarch64: Interner Fehler: Failed to start QEMU binary /opt/homebrew/bin/qemu-system-aarch64 for probing:
Steps to reproduce
brew install qemu libvirt
-
sudo brew service start libvirt
(or to see the logs:sudo /opt/homebrew/opt/libvirt/sbin/libvirtd -f /opt/homebrew/etc/libvirt/libvirtd.conf
) - `sudo virsh pool-define-as --name default --type dir --target /opt/homebrew/var/lib/libvirt/images/
-
sudo virsh vol-create-as --pool default --name test-volume --capacity 10GB --format qcow2
=> first Error (btw. sudo virsh vol-create-as --pool default --name test-volume2 --capacity 10 --format raw -
sudo /opt/homebrew/bin/qemu-img resize /opt/homebrew/var/lib/libvirt/images/test-image 10000000000
=> works without a problem -
sudo virsh define --file domain.xml
=> second Error
Additional information
ulimit -a -t: cpu time (seconds) unlimited -f: file size (blocks) unlimited -d: data seg size (kbytes) unlimited -s: stack size (kbytes) 8176 -c: core file size (blocks) 0 -v: address space (kbytes) unlimited -l: locked-in-memory size (kbytes) unlimited -u: processes 5333 -n: file descriptors 256
sudo ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited file size (blocks, -f) unlimited max locked memory (kbytes, -l) unlimited max memory size (kbytes, -m) unlimited open files (-n) 256 pipe size (512 bytes, -p) 1 stack size (kbytes, -s) 8176 cpu time (seconds, -t) unlimited max user processes (-u) 5333 virtual memory (kbytes, -v) unlimited
ulimit -n 1024 # did not change anything (executed before libvirtd -f ...)