View previous topic :: View next topic |
Author |
Message |
Da51d n00b

Joined: 27 Mar 2024 Posts: 73
|
Posted: Wed Feb 19, 2025 4:33 pm Post subject: qemu linux guest no sound |
|
|
Does anyone know how to get sound working with qemu. I have installed Kali, using virt-manager, and it is excellent, but I cannot make the sound work. The host has pulseaudio as the sound-server, but the only output shown in the guest pavucontrol says "dummy output".
Code: | # emerge --info qemu
Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/23.0/desktop, gcc-14, glibc-2.40-r8, 6.6.74-gentoo-dist x86_64)
=================================================================
System Settings
=================================================================
System uname: Linux-6.6.74-gentoo-dist-x86_64-11th_Gen_Intel-R-_Core-TM-_i5-11300H_@_3.10GHz-with-glibc2.40
KiB Mem: 7913596 total, 187084 free
KiB Swap: 16777212 total, 16754684 free
Timestamp of repository gentoo: Fri, 14 Feb 2025 00:45:00 +0000
Head commit of repository gentoo: 92902b3fe2484202009860f28cc364ae4b8fd162
sh bash 5.2_p37
ld GNU ld (Gentoo 2.43 p3) 2.43.1
app-misc/pax-utils: 1.3.8::gentoo
app-shells/bash: 5.2_p37::gentoo
dev-build/autoconf: 2.13-r8::gentoo, 2.72-r1::gentoo
dev-build/automake: 1.16.5-r2::gentoo
dev-build/cmake: 3.30.6::gentoo
dev-build/libtool: 2.5.4::gentoo
dev-build/make: 4.4.1-r100::gentoo
dev-build/meson: 1.6.1::gentoo
dev-lang/perl: 5.40.0-r1::gentoo
dev-lang/python: 3.10.16_p1::gentoo, 3.12.8_p1::gentoo, 3.13.1_p1::gentoo
dev-lang/rust-bin: 1.81.0-r102::gentoo, 1.83.0-r1::gentoo
llvm-core/clang: 18.1.8-r6::gentoo, 19.1.7::gentoo
llvm-core/lld: 19.1.7::gentoo
llvm-core/llvm: 18.1.8-r6::gentoo, 19.1.7::gentoo
sys-apps/baselayout: 2.17::gentoo
sys-apps/openrc: 0.55.1::gentoo
sys-apps/sandbox: 2.39::gentoo
sys-devel/binutils: 2.43-r2::gentoo
sys-devel/binutils-config: 5.5.2::gentoo
sys-devel/gcc: 14.2.1_p20241221::gentoo
sys-devel/gcc-config: 2.12.1::gentoo
sys-kernel/linux-headers: 6.6-r1::gentoo (virtual/os-headers)
sys-libs/glibc: 2.40-r8::gentoo
Repositories:
gentoo
location: /var/db/repos/gentoo
sync-type: rsync
sync-uri: rsync://rsync.gentoo.org/gentoo-portage
priority: -1000
volatile: False
sync-rsync-verify-max-age: 3
sync-rsync-extra-opts:
sync-rsync-verify-metamanifest: yes
sync-rsync-verify-jobs: 1
Binary Repositories:
gentoobinhost
priority: 1
sync-uri: https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="@FREE @BINARY-REDISTRIBUTABLE BSD"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=native -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/lib64/libreoffice/program/sofficerc /usr/share/config /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/dconf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=native -O2 -pipe"
DISTDIR="/var/cache/distfiles"
ENV_UNSET="CARGO_HOME DBUS_SESSION_BUS_ADDRESS DISPLAY GDK_PIXBUF_MODULE_FILE GOBIN GOPATH PERL5LIB PERL5OPT PERLPREFIX PERL_CORE PERL_MB_OPT PERL_MM_OPT XAUTHORITY XDG_CACHE_HOME XDG_CONFIG_HOME XDG_DATA_HOME XDG_RUNTIME_DIR XDG_STATE_HOME"
FCFLAGS="-march=native -O2 -pipe"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync merge-wait multilib-strict network-sandbox news parallel-fetch pid-sandbox pkgdir-index-trusted preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
FFLAGS="-march=native -O2 -pipe"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
LANG="en_GB.utf8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs"
LEX="flex"
MAKEOPTS="-j4 -l4"
PKGDIR="/var/cache/binpkgs"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --omit-dir-times --compress --force --whole-file --delete --stats --human-readable --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages --exclude=/.git"
PORTAGE_TMPDIR="/var/tmp"
SHELL="/bin/bash"
USE="X a52 aac acl acpi alsa amd64 apparmor audit bluetooth branding bzip2 cairo cdda cdr cet crypt cups dbus dist-kernel dri dts dvd dvdr elogind encode exif flac gdbm gif gpm gtk gui iconv icu ipv6 jpeg kf6compat lcms libnotify libtirpc mad mng mp3 mp4 mpeg multilib ncurses nls ogg opengl openmp pam pango pcre pdf png policykit postscript ppds pulseaudio qml qt5 qt6 readline sdl seccomp sound spell ssl startup-notification svg test-rust tiff truetype udev udisks unicode upower usb vorbis vulkan wayland wxwidgets x264 xattr xcb xft xml xv xvid zlib" ABI_X86="64" ADA_TARGET="gcc_13" APACHE2_MODULES="authn_core authz_core socache_shmcb unixd actions alias auth_basic authn_anon authn_dbm authn_file authz_dbm authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir env expires ext_filter file_cache filter headers include info log_config logio mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CALLIGRA_FEATURES="karbon sheets words" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" CPU_FLAGS_X86="mmx mmxext sse sse2 aes avx avx2 avx512_bitalg avx512_vbmi2 avx512_vnni avx512_vp2intersect avx512_vpopcntdq avx512bw avx512cd avx512dq avx512f avx512ifma avx512vbmi avx512vl f16c fma3 pclmul popcnt rdrand sha sse3 sse4_1 sse4_2 ssse3 vpclmulqdq" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock greis isync itrax navcom oceanserver oncore rtcm104v2 rtcm104v3 sirf skytraq superstar2 tsip tripmate tnt ublox" GRUB_PLATFORMS="efi-64" GUILE_SINGLE_TARGET="3-0" GUILE_TARGETS="3-0" INPUT_DEVICES="libinput synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz glk hd44780 lb216 lcdm001 mtxorb text" LUA_SINGLE_TARGET="lua5-1" LUA_TARGETS="lua5-1" OFFICE_IMPLEMENTATION="libreoffice" PHP_TARGETS="php8-2" POSTGRES_TARGETS="postgres16" PYTHON_SINGLE_TARGET="python3_12" PYTHON_TARGETS="python3_12" RUBY_TARGETS="ruby32" VIDEO_CARDS="intel" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipp2p iface geoip fuzzy condition tarpit sysrq proto logmark ipmark dhcpmac delude chaos account"
Unset: ADDR2LINE, AR, ARFLAGS, AS, ASFLAGS, CC, CCLD, CONFIG_SHELL, CPP, CPPFLAGS, CTARGET, CXX, CXXFILT, ELFEDIT, EMERGE_DEFAULT_OPTS, EXTRA_ECONF, F77FLAGS, FC, GCOV, GPROF, INSTALL_MASK, LC_ALL, LD, LFLAGS, LIBTOOL, LINGUAS, MAKE, MAKEFLAGS, NM, OBJCOPY, OBJDUMP, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS, PYTHONPATH, RANLIB, READELF, RUSTFLAGS, SIZE, STRINGS, STRIP, YACC, YFLAGS
=================================================================
Package Settings
=================================================================
app-emulation/qemu-9.1.2::gentoo was built with the following:
USE="aio alsa bzip2 curl fdt filecaps gnutls gtk jpeg ncurses nls opengl oss pam pin-upstream-blobs pipewire png pulseaudio sdl seccomp slirp udev usb vhost-net vnc xattr -accessibility -bpf -capstone -debug -doc -fuse -glusterfs -infiniband -io-uring -iscsi -jack -jemalloc -keyutils -lzo -multipath -nfs -numa -plugins -python -rbd -sasl -sdl-image (-selinux) -smartcard -snappy -spice -ssh -static-user -systemtap -test -usbredir -vde -virgl -virtfs -vte -xdp -xen -zstd" ABI_X86="(64)" PYTHON_TARGETS="python3_12 -python3_10 -python3_11 -python3_13" QEMU_SOFTMMU_TARGETS="x86_64 -aarch64 -alpha -arm -avr -cris -hppa -i386 -loongarch64 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -or1k -ppc -ppc64 -riscv32 -riscv64 -rx -s390x -sh4 -sh4eb -sparc -sparc64 -tricore -xtensa -xtensaeb" QEMU_USER_TARGETS="-aarch64 -aarch64_be -alpha -arm -armeb -cris -hexagon -hppa -i386 -loongarch64 -m68k -microblaze -microblazeel -mips -mips64 -mips64el -mipsel -mipsn32 -mipsn32el -or1k -ppc -ppc64 -ppc64le -riscv32 -riscv64 -s390x -sh4 -sh4eb -sparc -sparc32plus -sparc64 -x86_64 -xtensa -xtensaeb"
>>> Attempting to run pkg_info() for 'app-emulation/qemu-9.1.2'
Using:
app-emulation/spice-protocol-0.14.4
sys-firmware/edk2-bin-202202
sys-firmware/seabios-bin-1.16.3
sys-firmware/ipxe-1.21.1
sys-firmware/sgabios-0.1_pre10 |
_________________ What can be said at all can be said clearly and what we cannot talk about we must pass over in silence. |
|
Back to top |
|
 |
Ralphred l33t

Joined: 31 Dec 2013 Posts: 729
|
Posted: Wed Feb 19, 2025 6:06 pm Post subject: |
|
|
I has this issue when doing GPU passthrough (audio comes through the VNC link IIRC).
I had to add a usb sound card to the VM. It doesn't have usb as a default option in VMM, so I just added any other and edited the xml Code: | <sound model="usb" multichannel="yes">
<audio id="1"/>
<address type="usb" bus="0" port="1"/>
</sound> | I don't have that gfx card fitted anymore, so I can't boot the VM and check if I had to do anything funky in windows too, sorry. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3514
|
Posted: Wed Feb 19, 2025 7:28 pm Post subject: |
|
|
Quote: | Does anyone know how to get sound working with qemu. I have installed Kali, using virt-manager, and it is excellent, but I cannot make the sound work. The host has pulseaudio as the sound-server, but the only output shown in the guest pavucontrol says "dummy output". |
First things first, does your VM even have an audio device?
The guest does not seem to see it, so make sure it's actually added when you run your vm. After that, it should just work.
How do you start your VMs? Calling qemu manually? Or do you use some manager? _________________ Make Computing Fun Again |
|
Back to top |
|
 |
Da51d n00b

Joined: 27 Mar 2024 Posts: 73
|
Posted: Thu Feb 20, 2025 9:14 am Post subject: |
|
|
Thanks both for your help. The process is this (I am using my laptop as the host machine and not connecting remotely or anything like that):
I open virt-manager from the apps menu, click on file...new virtual machine...select the iso...and run through the "wizard", selecting "Generic Linux 2022" as the operating system I am installing, select RAM size and number of cpus, size of virtual machine disk etc, and and then hit "finish".
After that, it is much like a standard installation of any Linux distribution...essentially the same process as installing,say Debian.
I am pursuing several lines of enquiry, but I must confess I don't really understand much of what I am reading yet. My guess is the vm does not have an audio device, and I must find a way to make it use the laptop's sound card. _________________ What can be said at all can be said clearly and what we cannot talk about we must pass over in silence. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3514
|
Posted: Thu Feb 20, 2025 12:42 pm Post subject: |
|
|
Ok, if you use virt-manager, double click your VM, go to virtual hardware details (there's an icon in the corner, next to virtual console), and check what is actually exposed to the guest.
If sound device is missing, just add it. There is no need to complicate your life with pass-through. With an emulated audio device your vm should be able to play sounds through the console as long as you're connected to it (including over the network, if you ever wanted to work remotely). _________________ Make Computing Fun Again |
|
Back to top |
|
 |
Da51d n00b

Joined: 27 Mar 2024 Posts: 73
|
Posted: Thu Feb 20, 2025 3:17 pm Post subject: |
|
|
Thanks again for your response. I have tried this, but still no sound. There are 3 options: HDA(ICH9), HDA(ICH6) and AC97, and I have tried each in turn, but to no avail. _________________ What can be said at all can be said clearly and what we cannot talk about we must pass over in silence. |
|
Back to top |
|
 |
Ralphred l33t

Joined: 31 Dec 2013 Posts: 729
|
Posted: Thu Feb 20, 2025 4:25 pm Post subject: |
|
|
Da51d wrote: | Thanks again for your response. I have tried this, but still no sound. There are 3 options: HDA(ICH9), HDA(ICH6) and AC97, and I have tried each in turn, but to no avail. |
The fact you are seeing a "dummy" card makes me think the drivers for the virtual card are missing from the VM, or it's not being detected properly.
Considering how quick it is to install, throw a debian image at a new VM and see if you are dealing with a host or VM problem. I just tested this iso in VMM and it works with all 3 in-built sound card types. |
|
Back to top |
|
 |
Anon-E-moose Watchman


Joined: 23 May 2008 Posts: 6227 Location: Dallas area
|
Posted: Thu Feb 20, 2025 4:44 pm Post subject: |
|
|
What does "qemu-system-x86_64 --audiodev help" return?
Edit to add: I don't do pulseaudio, but with pipewire you need something similar to this (qemu cmd line)
Code: | -audiodev pipewire,id=vm0 -device intel-hda -device hda-duplex,audiodev=vm0 |
Not sure what the libvirt equivalent is though.
ETA2: https://stackoverflow.com/questions/64560389/setting-up-pulseaudio-in-qemu _________________ UM780, 6.12 zen kernel, gcc 13, openrc, wayland |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3514
|
Posted: Thu Feb 20, 2025 5:19 pm Post subject: |
|
|
Quote: | I have tried this, but still no sound. | What "this" have you tried?
Quote: | There are 3 options: HDA(ICH9), HDA(ICH6) and AC97, | Yes 3 options, I can count that far too, but good job, I guess?
Quote: | and I have tried each in turn, but to no avail. | You tried each. So I suppose you enabled them in the VM config. What have you done after enabling them in virt-manager to verify whether they work or not?
From the point where qemu definitely provides _an_audio_device_ the procedure is basically the same as bare metal installation. Have you inspected your virtual hardware from the inside? Can your guest see it? Does it show in the output from lspci? What about aplay -l?
Does lsmod show any modules with snd_ in their names?
Going in the opposite direction, does alsamixer show your audio controls muted? _________________ Make Computing Fun Again |
|
Back to top |
|
 |
Da51d n00b

Joined: 27 Mar 2024 Posts: 73
|
Posted: Fri Feb 21, 2025 9:28 am Post subject: |
|
|
Apologies szatox if I was unclear.
Quote: | Ok, if you use virt-manager, double click your VM, go to virtual hardware details (there's an icon in the corner, next to virtual console), and check what is actually exposed to the guest.
If sound device is missing, just add it. There is no need to complicate your life with pass-through. With an emulated audio device your vm should be able to play sounds through the console as long as you're connected to it (including over the network, if you ever wanted to work remotely). |
That was what I tried. In the guest machine lspci shows the line
Code: | 00:1b.0 Audio device: Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 03) |
and the guest machine's pavucontrol lists the output device "Built-in Audio Analog Stereo", but it is muted and cannot be unmuted.
Code: | $ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: Generic Analog [Generic Analog]
Subdevices: 0/1
Subdevice #0: subdevice #0 |
On the host
Code: | # qemu-system-x86_64 --audiodev help
Available audio drivers:
none
alsa
dbus
oss
pa
pipewire
sdl
wav |
I have tried installing a Debian 12 VM, but no sound in that either. _________________ What can be said at all can be said clearly and what we cannot talk about we must pass over in silence. |
|
Back to top |
|
 |
szatox Advocate

Joined: 27 Aug 2013 Posts: 3514
|
Posted: Fri Feb 21, 2025 10:19 am Post subject: |
|
|
Ok, so you now have a single analog audio device. Looks good.
What do you mean by "can't be unmuted in pavucontrol"?
Does aplay -L list sensible output options? Check alsamixer too, I don't use pulseaudio, but all sound servers depend on alsa, so you surely can access its controls directly. It would be good to confirm it's a problem with guest's pulseaudio. Speaking of which, maybe it's not started for whatever reason?
What OS do you run inside that VM anyway? Can you try running some kind of "just works" LiveCD inside your VM to test your setup?
BTW, audio editing software like audacity is good for testing outputs too, since it allows selecting playback device manually; Particularly useful when defaults don't match your system. _________________ Make Computing Fun Again |
|
Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|