Audio qube

Hello, thanks for the instructions. I am new to qubes os and tried to follow all steps. Everything works and looks the same until i want to start sys-audio for testing sound. My sys-audio qube is just not starting. Under qubes domains it shows sys-audio in red colour, like other qubes when starting, but it never get started.
do you have an idea what could be the issue?
i also don´t know which kind of log would be helpful for the solution

1 Like

What devices did you attach to your sys-audio?
You can run this command in dom0 terminal:

journalctl -f -n0

Then start sys-audio and check the command output in dom0 terminal to see the errors.
You can copy from dom0 to other qubes like this:
How to copy from dom0 | Qubes OS

If anyone for any reason has decided to avoid a dedicated template for sys-audio and installed pasystray or volumeicon in the template, you will end up with multiple volume controls in systray per each VM based on that template. Something similar to the bug Marek reported 2 days ago:

image

Only the one which belongs to sys-audio is useful and the rest are useless. These systray volume controls are automatically launched via:
for pasystray: /etc/xdg/autostart/pasystray.desktop
for volumecontrol: /etc/xdg/autostart/volumeicon.desktop

There are multiple workarounds to solve the issue. One would be adding a Hidden=true to those .desktop files in /etc/xdg/autostart and copy the original desktop files without hidden tag to /home/user/.config/autostart of sys-audio. The disadvantage of this method is that it is going to be overwritten in template whenever pasystray (or volumeicon) receives and update.

The other workaround would be to have the .desktop with Hidden=true tag in /home/user/.config/autiostart of all AppVMs based on template (and the template itself so the new AppVMs would inherite it). But not inside sys-audio.

3 Likes

You still can shut down audio qube via audio qube’s terminal. Also @cumpsd.

1 Like

My sys-audio also doesn’t boot on start. Have you found a solution?

Solved

Do you have USB devices attached persistently to it?

If you are replying to me than yes I do.

1 Like

This issue is going to be solved forever very soon:

1 Like

I’ve updated the script, since it was error-prone and with updated script you don’t need to specify the attached USB devices:

Disable sys-audio autostart.
Run these commands in dom0:

sudo mkdir /etc/libvirt/hooks/
cat << 'EOF' | sudo tee /etc/libvirt/hooks/libxl >/dev/null
#!/bin/bash
guest_name="$1"
libvirt_operation="$2"
timeout=60
guest_to_start_on_usb="sys-audio"

if [ "$guest_name" = "sys-usb" ] && [ "$libvirt_operation" = "started" ]; then
    (
        exec 0</dev/null
        exec 1>/dev/null
        exec 2>/dev/null
        guest_attached_usb_list=$(qvm-usb list "$guest_to_start_on_usb" | awk '{ print $1 }')
        for i in $(seq 1 $timeout);
        do
            if qvm-ls --running $guest_name | grep -q Running; then
                present_usb_list=$(qvm-usb list | grep -w "$guest_to_start_on_usb" | awk '{ print $1 }')
                if  [ "$guest_attached_usb_list" = "$present_usb_list" ]; then
                    qvm-start --skip-if-running -q $guest_to_start_on_usb
                    break
                fi
            fi
            sleep 1
        done
    ) & disown
fi
EOF
sudo chmod +x /etc/libvirt/hooks/libxl

Reboot.

Related issue:
Require sys-usb to start before starting qubes with persistently attached USB devices · Issue #7498 · QubesOS/qubes-issues · GitHub

I attached the only device, which i think is related to audio.
It is the device which produces an error.
Here is output of the command:

Apr 30 14:32:19 dom0 qubesd[2333]: vm.sys-audio: Starting sys-audio
Apr 30 14:32:19 dom0 systemd[1]: Stopped target sound.target - Sound Card.
Apr 30 14:32:20 dom0 rtkit-daemon[4184]: Successfully made thread 5771 of process 4172 (/usr/bin/pulseaudio) owned by ‘1000’ RT at priority 5.
Apr 30 14:32:20 dom0 kernel: pciback 0000:00:1f.3: xen_pciback: seizing device
Apr 30 14:32:20 dom0 kernel: xen: registering gsi 22 triggering 0 polarity 1
Apr 30 14:32:20 dom0 kernel: Already setup the GSI :22
Apr 30 14:32:20 dom0 lvm[1640]: No longer monitoring thin pool qubes_dom0-vm–pool-tpool.
Apr 30 14:32:20 dom0 lvm[1640]: Monitoring thin pool qubes_dom0-vm–pool-tpool.
Apr 30 14:32:21 dom0 lvm[1640]: No longer monitoring thin pool qubes_dom0-vm–pool-tpool.
Apr 30 14:32:21 dom0 lvm[1640]: Monitoring thin pool qubes_dom0-vm–pool-tpool.
Apr 30 14:32:21 dom0 libvirtd[2003]: Interner Fehler: PCI-Gerät 0000:00:1f.3 kann nicht zurückgesetzt werden: Kein FLR, PM Reset oder Bus-Reset verfügbar
Apr 30 14:32:21 dom0 libvirtd[2003]: Zurücksetzen von PCI-Gerät fehlgeschlagen: Interner Fehler: PCI-Gerät 0000:00:1f.3 kann nicht zurückgesetzt werden: Kein FLR, PM Reset oder Bus-Reset verfügbar
Apr 30 14:32:21 dom0 qubesd[2333]: vm.sys-audio: Start failed: Interner Fehler: PCI-Gerät 0000:00:1f.3 kann nicht zurückgesetzt werden: Kein FLR, PM Reset oder Bus-Reset verfügbar
Apr 30 14:32:21 dom0 qubesd[2333]: unhandled exception while calling src=b’dom0’ meth=b’admin.vm.Start’ dest=b’sys-audio’ arg=b’’ len(untrusted_payload)=0
Apr 30 14:32:21 dom0 qubesd[2333]: Traceback (most recent call last):
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/vm/qubesvm.py”, line 1205, in start
Apr 30 14:32:21 dom0 qubesd[2333]: self.libvirt_domain.createWithFlags(
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/app.py”, line 103, in wrapper
Apr 30 14:32:21 dom0 qubesd[2333]: return attr(*args, **kwargs)
Apr 30 14:32:21 dom0 qubesd[2333]: ^^^^^^^^^^^^^^^^^^^^^
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib64/python3.11/site-packages/libvirt.py”, line 1409, in createWithFlags
Apr 30 14:32:21 dom0 qubesd[2333]: raise libvirtError(‘virDomainCreateWithFlags() failed’)
Apr 30 14:32:21 dom0 qubesd[2333]: libvirt.libvirtError: Interner Fehler: PCI-Gerät 0000:00:1f.3 kann nicht zurückgesetzt werden: Kein FLR, PM Reset oder Bus-Reset verfügbar
Apr 30 14:32:21 dom0 qubesd[2333]: During handling of the above exception, another exception occurred:
Apr 30 14:32:21 dom0 qubesd[2333]: Traceback (most recent call last):
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/api/init.py”, line 297, in respond
Apr 30 14:32:21 dom0 qubesd[2333]: response = await self.mgmt.execute(
Apr 30 14:32:21 dom0 qubesd[2333]: ^^^^^^^^^^^^^^^^^^^^^^^^
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/api/admin.py”, line 864, in vm_start
Apr 30 14:32:21 dom0 qubesd[2333]: await self.dest.start()
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/vm/dispvm.py”, line 253, in start
Apr 30 14:32:21 dom0 qubesd[2333]: await super().start(**kwargs)
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/vm/qubesvm.py”, line 1222, in start
Apr 30 14:32:21 dom0 qubesd[2333]: await self.fire_event_async(‘domain-start-failed’,
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/events.py”, line 227, in fire_event_async
Apr 30 14:32:21 dom0 qubesd[2333]: sync_effects, async_effects = self._fire_event(event,
Apr 30 14:32:21 dom0 qubesd[2333]: ^^^^^^^^^^^^^^^^^^^^^^^
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/events.py”, line 164, in _fire_event
Apr 30 14:32:21 dom0 qubesd[2333]: effect = func(self, event, **kwargs)
Apr 30 14:32:21 dom0 qubesd[2333]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/api/admin.py”, line 70, in vm_handler
Apr 30 14:32:21 dom0 qubesd[2333]: self.send_event(subject, event, **kwargs)
Apr 30 14:32:21 dom0 qubesd[2333]: File “/usr/lib/python3.11/site-packages/qubes/api/init.py”, line 374, in send_event
Apr 30 14:32:21 dom0 qubesd[2333]: self.transport.write(‘{}\0{}\0’.format(k, str(v)).encode(‘ascii’))
Apr 30 14:32:21 dom0 qubesd[2333]: ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Apr 30 14:32:21 dom0 qubesd[2333]: UnicodeEncodeError: ‘ascii’ codec can’t encode character ‘\xe4’ in position 31: ordinal not in range(128)
Apr 30 14:32:21 dom0 qubes-app-menu[5759]: Got empty response from qubesd. See journalctl in dom0 for details.
Apr 30 14:32:28 dom0 qrexec-policy-daemon[2337]: qrexec: qubes.NotifyUpdates+: mail → @adminvm: allowed to dom0
Apr 30 14:32:28 dom0 audit: BPF prog-id=63 op=LOAD
Apr 30 14:32:28 dom0 audit: BPF prog-id=64 op=LOAD
Apr 30 14:32:28 dom0 kernel: audit: type=1334 audit(1714480348.948:376): prog-id=63 op=LOAD
Apr 30 14:32:28 dom0 kernel: audit: type=1334 audit(1714480348.948:377): prog-id=64 op=LOAD
Apr 30 14:32:28 dom0 kernel: audit: type=1334 audit(1714480348.949:378): prog-id=65 op=LOAD
Apr 30 14:32:28 dom0 audit: BPF prog-id=65 op=LOAD
Apr 30 14:32:28 dom0 systemd[1]: Starting systemd-hostnamed.service - Hostname Service…
Apr 30 14:32:29 dom0 systemd[1]: Started systemd-hostnamed.service - Hostname Service.
Apr 30 14:32:29 dom0 audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=systemd-hostnamed comm=“systemd” exe=“/usr/lib/systemd/systemd” hostname=? addr=? terminal=? res=success’
Apr 30 14:32:29 dom0 kernel: audit: type=1130 audit(1714480349.000:379): pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=systemd-hostnamed comm=“systemd” exe=“/usr/lib/systemd/systemd” hostname=? addr=? terminal=? res=success’
Apr 30 14:32:59 dom0 systemd[1]: systemd-hostnamed.service: Deactivated successfully.
Apr 30 14:32:59 dom0 audit[1]: SERVICE_STOP pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=systemd-hostnamed comm=“systemd” exe=“/usr/lib/systemd/systemd” hostname=? addr=? terminal=? res=success’
Apr 30 14:32:59 dom0 kernel: audit: type=1131 audit(1714480379.007:380): pid=1 uid=0 auid=4294967295 ses=4294967295 msg=‘unit=systemd-hostnamed comm=“systemd” exe=“/usr/lib/systemd/systemd” hostname=? addr=? terminal=? res=success’
Apr 30 14:32:59 dom0 audit: BPF prog-id=65 op=UNLOAD
Apr 30 14:32:59 dom0 audit: BPF prog-id=64 op=UNLOAD
Apr 30 14:32:59 dom0 audit: BPF prog-id=63 op=UNLOAD
Apr 30 14:32:59 dom0 kernel: audit: type=1334 audit(1714480379.068:381): prog-id=65 op=UNLOAD
Apr 30 14:32:59 dom0 kernel: audit: type=1334 audit(1714480379.068:382): prog-id=64 op=UNLOAD
Apr 30 14:32:59 dom0 kernel: audit: type=1334 audit(1714480379.068:383): prog-id=63 op=UNLOAD

Try to use no-strict-reset for your PCI device:

@neowutran Is there any way to make this solution compatible with switching keyboard layouts on 4.2? If audiovm enabled I need to press switch shortcut multiple times for the layout to switch. Imagine the frustration during writing something when you need to switch layouts multiple time or sometimes it takes a huge delay to switch.

Layout switches in dom0 just fine, but I guess something is wrong with RPC policies because audiovm just suppresses some layout change events for some reason.

Sorry I am not familiar with that part, I never need to switch keyboard layout so I didn’t tested it.

check with the RPC policy file, I have not allowed the layout change event in my proposed policy configuration

I understand, but could you please consider testing it on your end and seeing if it works? That is not really a niche case and your guide is the best I could find.

I also tried to allow property get and set on +keyboard_layout, but the issue still persists making using a keyboard on qubes with audiovm enabled almost unbearable.

The only solution for me after multiple hours of tinkering was to return to dom0 hdmi audio and ask for help.

Can you give me the exact command / gui / shortcut / … you use to change the keyboard layout and that trigger the issue you are having.

I will test that when I have some free time, but want to be sure to test the correct thing

Do you use USB keyboard with sys-usb?
And when you start sys-audio qube then layout switching is being unreliable?

Sorry I missed part of the directions. Please ignore.

I see this patch is still pending, was it ever sent as a PR? Or is there something blocking it being added officially? This guide has been helping many people for a long time so it would be nice to make it easier for more people to use.

I did sent a pull request last year.

Currently, there is quite a lot of activities on this subject by the QubesOS team: Dynamic audiovm switching · Issue #8975 · QubesOS/qubes-issues · GitHub

I did not sent a pull request for the the last ~5 lines of modification still currently required. Will do maybe later.

This guide has been helping many people for a long time so it would be nice to make it easier for more people to use.

Most of this guide could be automated with a bash script / Salt script. But currently, I don’t really want to try to understand how Salt work