Enable audio in LXD Virtual Machine

Hello all guys!
I have a vm instance with windows 10 and I am trying to configure the audio.
I am very satisfied with the performance of LXD on virtual machines, an excellent job from the development team.
I imagine that the variable to mount intel HD audio is equal to -soundhw hda in the yaml file of the profile of my vm instance.
I don’t know the correct syntax to mount -soundhw hda in my virtual machine, I hope you can help me.

My settings

Cita

config:
raw.apparmor: /home/** rwk,
raw.qemu: -drive file=/home/dennis/VMLXD/win10.iso,index=0,media=cdrom,if=ide -drive file=/home/dennis/VMLXD/virtio-win-0.1.185.iso,index=1,media=cdrom,if=ide
description: “”
devices:
eth0:
name: eth0
nictype: bridged
parent: lxd0
type: nic
name: win10
used_by:

  • /1.0/instances/win10

Cita

Adding -soundhw hda to raw.qemu should work.

try to use that variable, but it reports the following error

Cita
Error: Failed to run: forklimits limit=memlock:unlimited:unlimited – /usr/bin/qemu-system-x86_64 -S -name win10 -uuid 2bad982f-b0ea-4683-bdea-7f66552b0290 -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-reboot -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/log/lxd/win10/qemu.conf -pidfile /var/log/lxd/win10/qemu.pid -D /var/log/lxd/win10/qemu.log -chroot /var/lib/lxd/virtual-machines/win10 -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas nobody -drive file=/home/dennis/VMLXD/win10.iso,index=0,media=cdrom,if=ide -drive file=/home/dennis/VMLXD/virtio-win-0.1.185.iso,index=1,media=cdrom,if=ide,soundhw=hda: char device redirected to /dev/pts/7 (label console)
: Process exited with a non-zero value

Looks like you attached the soundhw=hda option to the virtual CD drive. I believe it should be separate.

I tried all options.
raw.qemu: soundhw=hda,
raw.qemu: -soundhw=hda
raw.qemu: -soundhw hda,
raw.qemu: soundhw hda

where will i be failing?

Your existing raw.qemu has two -drive directives, separated by spaces. You would need to add a new directive, separated with spaces.

raw.qemu: -drive file=/home/dennis/VMLXD/win10.iso,index=0,media=cdrom,if=ide -drive file=/home/dennis/VMLXD/virtio-win-0.1.185.iso,index=1,media=cdrom,if=ide -soundhw hda

which of all these variables is correct?
raw.qemu: -device soundhw=hda
raw.qemu: soundhw=hda
raw.qemu: -device intel-hda
I have removed the options they have from the Live CD, I only have the audio montage
My setup
config:
raw.apparmor: /home/** rwk,
raw.qemu: -device soundhw=hda
description: “”
devices:
eth0:
name: eth0
nictype: bridged
parent: lxd0
type: nic
name: win10
used_by:

  • /1.0/instances/win10
stgraber@castiana:~$ lxc config set win10 raw.qemu -- "-device intel-hda -device hda-duplex"
stgraber@castiana:~$ lxc start win10
1 Like

Thank you very much for your patience and it is already solved and enjoy

Hi, Thank you for the solution. It does solve the problem. However getting the below error frequently and the audio stops playing in the VM.

dev/shm/jack_db-0/__db.001: No such file or directory
(remote-viewer:20659): GSpice-WARNING **: 23:11:29.077: playback: ignoring volume change on audiosink
(remote-viewer:20659): GSpice-WARNING **: 23:11:29.077: playback: ignoring mute change on audiosink

Any assistance would be appreciated! Thank you!