KVM Windows No Sound? – Let’s fix it.


When you install a VM on the KVM hypervisor, especially windows VM, you will end up not having a sound on the guest os. For me, I am okay with not having sound on the guest operating system. However, there are times you might require to have sound on your machine and when you try to fix it, nothing seems to work. As a result,  you will end up wasting so much time trying to fix the problem.

In my previous blogs, I have covered how you can install a windows operating system in KVM, and in this one, we are going to fix the sound issue on the windows operating system on a KVM hypervisor.

This is tested with KVM running on Ubuntu and verified it is working, and it should work fine on all the Linux distributions running KVM.

1. Get the numeric ID of the user.

If your machine has only a single user it will most likely be 1000.

Type id -u

You can even confirm with the username at the end by typing id -u usernameas you can see below.

[email protected]:/$ id -u
1000
[email protected]:/$


[email protected]:/$ id -u saif
1000
[email protected]:/$

The numeric value is 1000.

2. Add the below variables in /etc/libvirt/qemu.conf file.

In your KVM host, open the file /etc/libvirt/qemu.conf file and add the below variables. Use your favorite editor, I am using nano editor for this. You may type below to edit the file.

sudo nano /etc/libvirt/qemu.conf

Scroll a little down, you should see something like # vnc_allow_host_audio = 0, change 0 to 1 and uncomment the line, as below.

vnc_allow_host_audio = 1

From this 

Kvm no sound

To this.

Kvm no sound

3. Make the KVM run with a normal user.

Scroll all the way down, you should see a line start with user. Change the value as below. The second value is the ID of the user, which we found in step 1.

User =”saif”
User =”+1000” 
enable kvm run with a normal user.

Save the /etc/libvirt/qemu.conf file. To save the file in nano editor press CTRL+O and hit enter.

4. Make the KVM use an ALSA driver.

Take the backup of the current KVM configuration.

sudo cp /usr/bin/kvm /usr/bin/kvm.bak

Open the KVM config.

sudo nano /usr/bin/kvm 

remove the existing values and replace them with the below values.

#!/bin/sh
QEMU_AUDIO_DRV=alsa /usr/bin/kvm.bin [email protected]

5. Restart the libvirt services.

service libvirtd restart

Or 

systemctl restart libvirtd

6. Restart the Windows operating system.

In order for the windows machine to start using the audio, you will have to reboot the windows machine once. After it is rebooted you should be good to go.

Saifudheen Sidheeq

Saifudheen is in the Computer networking and technology field for about a decade now. He loves technology and new ideas, and in his spare time, he loves to write about them.

Recent Posts