Run qemu in the chroot with audio
Copied the relevant parts over from !1797 (merged)
$ pmb qemu --arch arm
[22:11:54] Running postmarketOS in QEMU VM (arm)
[22:11:56] WARNING: Qemu is not using KVM and will run slower!
[22:11:56] NOTE: Run 'pmbootstrap qemu --image-size 2G' to set the rootfs size when you run out of space!
[22:11:56] Connect to the VM (telnet requires 'pmbootstrap initfs hook_add debug-shell'):
[22:11:56] * (ssh) ssh -p 2222 user@localhost
[22:11:56] * (telnet) telnet localhost 2223
WARNING: Image format was not specified for '/home/luca/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs/qemu-vexpress.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
Failed to open module: Error relocating /usr/lib/qemu/audio-alsa.so: audio_buffer_frames: symbol not found
Failed to open module: Error relocating /usr/lib/qemu/audio-sdl.so: audio_buffer_samples: symbol not found
^C[22:11:58] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[22:11:58] Done
Just a theory, maybe QEMU tries to load the audio-alsa.so module, but as it doesn't find it in the
QEMU_MODULE_DIR
, it looks it up outside of that. And as far as I understand, qemu is run outside of the chroot as the normal user? That would also explain the symbol issue as it's a different version compiled against different libs.
After running
apk add qemu-audio-alsa qemu-audio-sdl
in the native chroot, the qemu output is different:
[22:55:19] Running postmarketOS in QEMU VM (arm)
[22:55:21] WARNING: QEMU is not using KVM and will run slower!
[22:55:21] NOTE: Run 'pmbootstrap qemu --image-size 2G' to set the rootfs size when you run out of space!
[22:55:21] Connect to the VM (telnet requires 'pmbootstrap initfs hook_add debug-shell'):
[22:55:21] * (ssh) ssh -p 2222 user@localhost
[22:55:21] * (telnet) telnet localhost 2223
WARNING: Image format was not specified for '/home/luca/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs/qemu-vexpress.img' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
ALSA lib dlmisc.c:287:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error relocating /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: __snprintf_chk: symbol not found)
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such device or address
ALSA lib dlmisc.c:287:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/alsa-lib/libasound_module_pcm_pulse.so ((null): Error relocating /usr/lib/alsa-lib/libasound_module_pcm_pulse.so: __snprintf_chk: symbol not found)
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such device or address
audio: Failed to create voice `lm4549.out'
^C[22:55:26] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[22:55:26] Done
so it sounds like my theory is correct...
I'm wondering if we could simply copy the xauthority file inside the chroot, then run the qemu UI directly from inside the chroot (like we do it with spice now, or with the graphical kconfig UIs). It would be great if you could try this out and if it works, submit a patch MR :)