Setting up an audio VM

Hi,

I am trying to create an audio VM for my bluetooth headphone. I know it should be possible in 4.1, but I can’t find any documentation on how to do it. Can anyone shed some light into it?

Many thanks :slight_smile:

1 Like

No official documentation AFAIK, but advice here may be of help:
https://linuxadministration.us/bluetooth-headset-with-qubes/

1 Like

There is indeed no documentation about that yet. But there is salt formula to set it up: qubes-mgmt-salt-dom0-virtual-machines/sys-audio.sls at master · QubesOS/qubes-mgmt-salt-dom0-virtual-machines · GitHub (not tested too much…)

3 Likes

@fepitre can you provide commands to set it up?

Thanks for the reply. I managed to set sys-audio up using the salt formula provided, however it just broke all audio and now I can’t hear anything :frowning: I will keep trying to fix it and will post any updates here.

1 Like

Still no luck in setting it up, can you provide some instructions @fepitre? This is the only thing missing so I can make Qubes my main OS.

I would like to point out that there seems to be a bug with the default audio vm salt files. If I install it, it will not let me shutdown sys-audio if it is being used as an audio qube for other vms. While this is expected behavior, what is not expected is that it considers sys-audio to be the audio VM for itself, so sys-audio can not be shutdown unless sys-audio is already shutdown :smile:

But why is this expected? I expect that I can shut it down and have no sound.

It’s the same behavior that is implemented with network vms, that’s why I would expect this.

I can provide instructions later in the next week.

4 Likes

Any news on this topic?

Unfortunately no, I’m currently busy with prior tasks.

For those that might stumble upon this thread in search for a solution for using bluetooth headphones with Qubes, I solved this temporarily by purchasing a bluetooth adapter into 3.5mm audio jack. Just make sure to get one that supports TX mode, like this one

So I got myself an audio-vm using

qubesctl state.sls qvm.sys-audio

removed pci-devices, set it’s audiovm to None (because the system would freeze on starting sys-audio and I think that was because of circular audiovm definitions?)
I installed qubes-audio-daemon from qubes-vm-*-current-testing

When I start a Qube which has audiovm set to sys-audio and run

pactl-simple-vchan [xl-id] [name]

I get an audio-stream which is visible in pavucontrol and, as pci-devices where still connected, audible.

My main usecase is using usb-audio and bluetooth without any touching dom0. When I connect my usb-headset to sys-audio, it is correctly detected and shows up in pavucontrol. However, when I use pactl-simple-vchan, I hear nothing. pavucontrol shows audio playback via the headset (the sound-bar jumps back and forth).

Even weirder, starting playback inside sys-audio works perfectly fine and keeps on working if I start pavucontrol while playback is audible.

Am I missing some pulseaudio/alsa/modprobe setup?

Just got this working.

Roughly the steps that I can recall now were to download the template vm that the sys-audio salt state uses - the salt states can be found here btw:

and fedora-33-xfce is the template vm it uses.

Once the state is run and the sys-audio vm created the template vm needs to have the qubes-core-admin-client rpm installed - this provides the qvm-start-daemon python script that is used to start the pacat processes for each vm audio client.

Next, startup the sys-audio vm and create ~/.config/autostart entries for qvm-start-daemon and pulseaudio:

eg. ~user/.config/pulseaudio.desktop
[Desktop Entry]
Name=Pulseaudio
Comment=Starts Pulseaudio
Icon=qubes
Exec=pulseaudio
Terminal=False
Type=Application
NotShowIn=KDE;

eg. ~user/.config/qvm-start-daemon.desktop
[Desktop Entry]
Name=Qubes Guid/Pacat
Comment=Starts GUI/AUDIO daemon for Qubes VMs
Icon=qubes
Exec=qvm-start-daemon --all --watch
Terminal=False
Type=Application
NotShowIn=KDE;

Next there are some problems with the policy that the salt state creates. It’s a bit of a pain to work though but the popup notifications are helpful - the policy is defined in /etc/qubes/policy.d/50-sys-audio.policy on dom0

I’d paste it here but tbh I’m a bit lazy and it’s on dom0 :stuck_out_tongue:

Finally, each vm needs to have the audiovm adjusted w/

eg. qvm-prefs audiovm sys-audio

2 Likes

Oh yeah, and I went into services on sys-audio and added the audiovm services.

Oh, and those .desktop files are in ~user/.config/autostart

Thanks for the instructions, I will try and post my results here.

Edit: I got a working audioVM, after a lot of troubleshooting and banging my head against a wall.
I will try to optimize the process and will post clearer instructions here when I have the time.