Debian-minimal template for sys-audio

Hi, I would like to configure a minimal template for sys-audio instead of the default fedora-34-xfce.

I installed qubes-core-agent-usb , qubes-core-admin-client , and pulseaudio-gui-daemon-qubes,alsa-utils,pavucontrol in deb11-audio, which was a clone of debian-11-mimnimal, and changed the pre-configured sys-audio’s template to deb11-audio. I’m happy to see audio streams coming from other qubes in pavucontrol .

However, I couldn’t use any physical audio device, including my soundcard (Realtek ALC257) and USB headset. They simply didn’t appear in “Output Devices” section in pavucontrol. Also, in alsamixer, there’s no soundcard available except the dummy output.

I thought there might be a driver problem, so I installed firmware-linux. Sadly, it didn’t help.

I compared dmesg output of sys-audio based on fedora-34-xfce and deb11-audio, only to find there’s hardly any difference in the audio part. My soundcard is most likely initialized correctly.

I want to know how to fix this issue. Thank you.

2 Likes

I managed to configure a deb11-min-audio template, as the template of sys-audio.

Name one copy of debian-11-minimal deb11-min-audio.Run these commands in it:

  1. apt install qubes-usb-proxy qubes-input-proxy-sender gnome-keyring alsa-utils alsa-oss alsa-ucm-conf alsa-firmware-loaders
  2. apt install pavucontrol pulseaudio qubes-core-admin-client qubes-gui-daemon-pulseaudio pulseaudio-qubes —no-install-recommends

Then, create sys-audio based on deb11-min-audio.

Edit 50-sys-audio.policy in dom0 at /etc/qubes/policy.d/, enter these lines:

admin.Events * sys-audio sys-audio allow target=dom0
admin.Events * sys-audio @adminvm allow target=dom0
admin.Events * sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.CurrentState * sys-audio sys-audio allow target=dom0
admin.vm.CurrentState * sys-audio @adminvm allow target=dom0
admin.vm.CurrentState * sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.List * sys-audio sys-audio allow target=dom0
admin.vm.List * sys-audio @adminvm allow target=dom0
admin.vm.List * sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.property.Get +audiovm sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.property.Get +xid sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.property.Get +stubdom_xid sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.feature.CheckWithTemplate +audio sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.feature.CheckWithTemplate +audio-model sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.property.Get +keyboard_layout sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.property.GetAll * sys-audio sys-audio allow target=dom0
admin.vm.property.GetAll * sys-audio @tag:audiovm-sys-audio allow target=dom0
admin.vm.property.GetAll * sys-audio @adminvm allow target=dom0
admin.vm.property.Set +keyboard_layout sys-audio * allow target=dom0

Note that perhaps not all of these lines are needed. But these are sufficient.

Then run qubes-prefs default_audiovm sys-audio in dom0.
In Qubes-Settings of sys-audio, turn to “Services” page, “Add” a “(custom…)” service called “audiovm”.

Start sys-audio, make pulseaudio autostart in it.
Also add qvm-start-daemon --all --watch to autostart.
(These two actions may or may not be necessary.)

Then it works like magic.

If you encounter problem with your soundcard, try these:
sudo alsactl init in sys-audio.
Make a file called “snd.conf” in deb11-min-audio at /etc/modprobe.d/, add the line
options snd_hda_intel power_save=0

5 Likes

Does it works? I also planning to build sys-audio based on debian minimal.

Yes, it works. I’m currently using it,. This template is only approximately 2GB in size, which is smaller than fedora-34-xfce.

If you plan to use a bluetooth headset with it, remember to install blueman. To start managing bluetooth devices, start blueman-manager in cmd.

2 Likes

Is the sys-audio able to use as disposable vm/ If yes, is there any difference in 50-sys-audiio.policy?
Also, how much memory did you put on sys-audio? Did you modify your sound card PCI device int sys-audio?

1 Like

Personally I haven’t tried to use it as disposable, however I don’t think it’s impossible to do so.
You just need to make a sys-usb-like qube. Since there’s no VM name changes in this process, perhaps you don’t need to care about policies.
Remeber to make those autostart config persistent.

I put 500MB on it, just arbitrary.

I didn’t modify my soundcard in sys-audio. Just a conf in modprobe.d to avoid the scratchy sound issue.

Ref: Setting up an audio VM - #23 by alte and Setting up an audio VM - #15 by kef

1 Like

I think I express my problem wrongly. I mean, did you make pci passthrough to sys-audio? Just like you have to make your NIC passthrough to your sys-net. btw thanks for your information.

No problem. Certainly I need to passthrough my sound card to sys-audio. On my PC, I assigned those devices whose names start with “Audio:”. I also need to disable pci strict reset for those. All in Qube-settings GUI tool.

1 Like

I’ve followed your work: install packages, create sys-audio, edit policy, add pci device, and run qubes-prefs. I haven’t add qvm-start-daemon --all --watch as I don’t know how to “add”.

however suffer in this situation:

I try to play music(download) and videos(websites) in different disps with different templates but not successful. Both of the video and music’s progress time bar are stuck.

For example, when I start a downloaded music on music player, it will not have any progress, stuck in 0:00, when I move the “point” to 1;27, then it will stuck in 1:27. In website, it is in same situation.

I’ve ran sudo alsactl init in sys-audio and it shows:

alsa-lib parsor.c:260:(error_node) UCM is not supported for this HDA model (HDA Intel PCH at 0xf2110000 irq 67)
alsa- lib main.c:1014:(snd_use_case_mgr_open) error: failed to import hw:0 use case configuration -6
Found hardware: "HDA-Intel" "Realtek ALC256" "HDA:10ec0256,10ec1200,00100002" "0x10ec" "0x1200"
Hardware is initialized using generic method

I haven’t make snd.conf yet as I don’t know should it be consider as soundcard problem. Sorry for disturbing.

Do you see streams coming from other qubes in sysaudio?
To check this simply take a look at the “Playback” section of pavucontrol in sys-audio.
My problem (the first post of this thread) was nearly the same to yours. Maybe my solutions are suitable for your problems.

You can try to install alsa-firmware-loaders and reboot, rerun
alsactl init
alsactl restore
as root.

Also, install alsa-ucm-conf and see.
To have a working setup, you need to see “Output Devices” in pavucontrol.
As long as it’s something dummy or mono, it’s your soundcard problem. Make that conf.

Regarding qvm-start-daemon --all --watch, you can see those Ref links.

No, in sys-audio’s “Playback” section, only shows “System Sounds”.
I’ve installed alsa-fimware-loaders and run alsactl restore but shows the same error.
The alsa-ucm-conf was already installed. And now I made the snd.conf on template. But still, the dom0’s pavucontrol shows “Dummy Output”.

Ok, the “Playback” problem can be that your daemon is not running.
Manually run qvm-start-daemon --all --watch in sys-audio.
Dummy output in dom0 is expected as your soundcard has been assigned to your sys-audio from dom0. See if in sys-audio is also dummy output.

BTW, only domains that are started “after” your sys-audio startup can connect to it.

After some trying, I find that although the sys-audio does detect my device (when I plug in my earphones), still the music and videos will not play.

As you said, I also think that the problem is that I don’t have run daemon. However when I tried to run qvm-start-daemon --all --watch, it seems that doesn’t works normally, because it only shows what qvm-start-daemon --help also shows.

root@sys-audio:~$ sudo qvm-start-daemon --all --watch
usage: qvm-start-daemon [--verbose] [--quiet] [--help] [--all]
       [--exclude EXCLUDE] [--watch] ...

start GUI for qube(s)

positional arguments:
...

that’s what it shows after qvm-start-daemon --all --watch in sys-audio.

In Settings:sys-audio, you can switch to “Services” page, “Add” a “custom” sevice named “audiovm”. I haven’t thought that might be the trick.

i just wonder why you would isolate your audio? for what purpose?

1 Like

Apologize for disturb, but still doesn’t work after add “audiovm” service on settings, the situation doesn’t change.

Here’s the things I’ve done:

  1. Install packages on template and create sys-audio:
apt install qubes-usb-proxy qubes-input-proxy-sender gnome-keyring alsa-utils alsa-oss alsa-ucm-conf alsa-firmware-loaders bluman
apt install pavucontrol pulseaudio qubes-core-admin-client qubes-gui-daemon-pulseaudio  pulseaudio-qubes —no-install-recommends
  1. Touch and edit 50-sys-audio.policy

  2. ran sudo alsactl ... and made snd.conf on template

  3. Passthrough audio PCI device with “no strict reset”

  4. ran qvm-start-daemon --all --watch in both sys-audio and dom0 (It is unnecessary to ran on dom0, right?)

  5. “Add” a “custom” sevice named “audiovm” in “Settings: sys-audio”

Here’s my situation:

  1. All of the vm’s music and video stopped running

I try to play music(download) and videos(websites) in different disps with different templates but not successful. Both of the video and music’s progress time bar are stuck.
For example, when I start a downloaded music on music player, it will not have any progress, stuck in 0:00, when I move the “point” to 1;27, then it will stuck in 1:27. In website, it is in same situation.

  1. I notice that my headphones does passthrough to sys-audio, as the pavucontrol of sys-audio can “sense” my headphones plugged in or not.

  2. when I tried to run qvm-start-daemon --all --watch in sys-audio, it shows: Segmentation fault (core dumped), when run in root in sys-audio, shows

free(): invalid pointer 
Aborted (core dumped)

Have you set default_audiovm to sys-audio? I’ll try to reproduce your error.

Yes, but the situation doesn’t change