Unable to get sys-audio qube to auto start on boot

I have followed neowutran’s sys-audio guide
my audio works fine but I am having issue with auto starting the sys-audio qube on boot.
The points below are what I have observed. I am trying to figure out the conflicts as whenever I implement neowutran’s HVM workaround sys-usb, sys-net wont run at all (i believe due to stubdom changes combined with pci/usb conflicts) and I have to add qubes.skip_autostart to the grub menu to get qubes to load (I only have usb keyboard and mouse). So I have done a fresh install of Qubes OS and before implimenting the HVM workaround makign sure everything is in order.

  • If I configure 00:1f.3 Audio device: Intel Corporation WITH the “no strict reset” option then sys-audio qube can’t start automatically but will run if I start manually after boot.
  • If I configure 00:1f.3 Audio device: Intel Corporation WITHOUT the “no strict reset” option I get a “Can’t reset” error and it will not start automatically and I can’t start it manually.
  • If I try to attach device 01:00.1 (NVIDIA Audio device) WITHOUT the “no strict reset” option sys-audio won’t start automaticlly or manually because 01:00.0 (NVIDIA VGA Controller/GPU) is on the same bus.
  • If I try to attach device 01:00.1 (NVIDIA Audio device) WITH the “no strict reset” option sys-audio won’t start automaticlly but will start manually after booting (I’m guessing) because 01:00.0 (NVIDIA VGA Controller/GPU) is hidden from dom0 for GPU passthrough.

sys-audio actually works without these devices but it seems like as they are audio devices I should attach them? I also saw neowutran had both of these devices attached in their screenshot.

Also as a side note sys-usb is logging an error for not being able to reset 00:14.0 (USB Controller) but still starts automaticlly.

/var/log/libvirt/libxl/libxl-driver.log

qvm-pci output

If you only add 00:1f.3 PCI device to sys-audio with no-strict-reset and set it to autostart then what will be the error in dom0 journalctl when it’ll try to start at boot?

Here is the results of

journalctl BEFORE
and…
journalctl AFTER

I am not sure if its normal for them all to have the same date and time down to the second?

journalctl is a tool to view the docs, you can scroll the log using PgDown/PgUp or arrows.

You can dump the previous boot log in file using this command:

journalctl -b -1 > journalctl.log

Thank you for that information I have never used it before. I am very new to Linux.

Here is the journalctl.log

Can you upload it here?

Error, this is a private paste or is pending moderation. If this paste belongs to you, please login to Pastebin to view it.

Yes sorry

journalctl.log (488.0 KB)

Apr 20 13:42:37 dom0 libvirtd[3953]: internal error: Unable to reset PCI device 0000:00:14.0: no FLR, PM reset or bus reset available

That is my

00:14.0 USB Controller: Intel Corporation

But the sys-usb starts fine.

vm.sys-audio: Start failed: usb device sys-usb:2-5.3 not available

Did you persistently attached the USB device to your sys-audio?
It will fail if the USB device is not available at the time when sys-audio starts.
You can configure it like this:

That’s strange. I never noticed that before but it still boots. I guess it eventually acquires it but everything else dependent on it can’t run?

I wanted to try to get it working without the work around so I entered qubes.skip_autostart to the grub menu on boot. Then I detached and reattached the USB controller persistently with strict reset but then sys-usb devices wouldn’t start up on next boot.

So in order to implement the work around you suggested I went back in via qubes.skip_autostart and detached the USB controller then reattached persistently with no-strict-reset

I have implemented the workaround you suggested. I am not sure which variable(s) I need to change in the bash script and what value(s) to put there.

It’s not a problem with PCI USB controller attached to sys-usb.
It’s a problem with USB device that you’ve persistently attached from sys-usb to sys-audio using:

qvm-usb attach --persistent sys-audio sys-usb:2-5.3

Since sys-usb is not started yet and it didn’t initialize the USB device sys-usb:2-5.3 to make it available for attachment before sys-audio is attempting to start then sys-audio start fails.

You need to change these:

guest_to_start_on_usb=myvmname
guest_usb_dev_name="my-usb-device-name-or-id"

myvmname = sys-audio
guest_usb_dev_name = your device name or id that you see in qvm-usb output

Thank you for the explanation that makes sense. I didn’t understand why sys-usb was giving an error related to the USB controller.

I implemented the work around and it didnt seem to work with the USB device ID or description. I tried with and without quotes around the VM Name and making the USB device persistent and not persistent on sys-audio

journalctl.log (421.1 KB)

journalctl2.log (435.5 KB)

Below are my current settings

In /etc/'libvirt/hooks/libxl
guest_to_start_on_usb=sys-audio
gues_usb_dev_name=“sys-usb:2-5.3”

In sys-audio
dom0:00_1f.3 (no-strict-reset=True)
sys-usb:2-4
sys-usb:2-5.3

In sys-usb
dom0:00_14.0 (no-strict-reset=True)

Did you uncheck “Start qube automatically on boot” for sys-audio in its Settings?
Do you have two USB devices attached persistently to sys-audio? Then it’s better to fix the script to add the check for second USB device availability.
And did you reboot the Qubes OS after making these changes (adding the hook script /etc/libvirt/hooks/libxl)?

Yes autostart is checked. Here are my current settings

Uncheck it.
The /etc/libvirt/hooks/libxl script will start the sys-audio qube when sys-usb will start and your USB devices will be available.

I am sorry I have taken so much of your time on this. I have unchecked auto start for sys-audio.

The USB devices show in the device manager and they are attached to sys-audio but sys-audio isn’t started. It does work when I start it.

Here is the latest log (463.2 KB)

Change the /etc/libvirt/hooks/libxl script to:

#!/bin/bash
guest_name="$1"
libvirt_operation="$2"
timeout=60
guest_to_start_on_usb=sys-audio
guest_usb_dev1_id="sys-usb:2-4"
guest_usb_dev2_id="sys-usb:2-5.3"

if [ "$guest_name" = "sys-usb" ] && [ "$libvirt_operation" = "started" ]; then
    (
        exec 0</dev/null
        exec 1>/dev/null
        exec 2>/dev/null
        for i in $(seq 1 $timeout);
        do
            if qvm-ls --running $guest_name | grep -q Running; then
                usb_list=$(qvm-usb list -q $guest_to_start_on_usb | awk '{ print $1 }')
                if  echo "$usb_list" | grep -Fxq "$guest_usb_dev1_id" && echo "$usb_list" | grep -Fxq "$guest_usb_dev2_id"; then
                    qvm-start --skip-if-running -q $guest_to_start_on_usb
                    break
                fi
            fi
            sleep 1
        done
    ) & disown
fi

Then reboot Qubes OS.

You can get the log for the current boot using this command:

journalctl -b > journalctl.log

It didn’t start.

It doesn’t matter that sys-usb is throwing errors regarding the USB Controller?

Apr 20 20:39:34 dom0 libvirtd[4221]: internal error: Unable to reset PCI device 0000:00:14.0: no FLR, PM reset or bus reset available

journal2var.log (339.4 KB)

vm.sys-audio: Start failed: usb device sys-usb:2-4 not available

It’s failing to attach sys-usb:2-4 USB device.
What’s the output of this command in dom0?

qvm-usb list sys-audio

Are you able to start sys-audio manually after the Qubes OS start?

Try to autostart sys-audio without sys-usb:2-4.
Detach sys-usb:2-4 USB device from sys-audio and leave sys-usb:2-5.3 attached, then change the guest_usb_dev1_id="sys-usb:2-4" to guest_usb_dev1_id="sys-usb:2-5.3" in the script and reboot Qubes OS.

The output of that command Did show both USB devices 2–4 and 2-5.3 Before I detached 2–4.

After detaching 2–4 I tried changing dev usb id 1 to 2-5.3. So then I had two entries for 2–5.3 But now sys-usb won’t start.

I thought maybe you meant to invert the two so I tried switching that the 2-4 entry to the second dev usb is and 2–5.3 to the first dev usb I’d but sys-usb wouldn’t load. So I need to enter cubes period skip underscore auto start in the boot grub menu. And then try and reattach 2–4 I get the error message

qvm-usb: error: backend vm’sys-usb’ doesn’t expose device ‘2-4’

I want to confirm that these devices are only attached to sys-audio and not to some other autostarting qube as well.

I meant like this:

#!/bin/bash
guest_name="$1"
libvirt_operation="$2"
timeout=60
guest_to_start_on_usb=sys-audio
guest_usb_dev1_id="sys-usb:2-5.3"
guest_usb_dev2_id="sys-usb:2-5.3"

if [ "$guest_name" = "sys-usb" ] && [ "$libvirt_operation" = "started" ]; then
    (
        exec 0</dev/null
        exec 1>/dev/null
        exec 2>/dev/null
        for i in $(seq 1 $timeout);
        do
            if qvm-ls --running $guest_name | grep -q Running; then
                usb_list=$(qvm-usb list -q $guest_to_start_on_usb | awk '{ print $1 }')
                if  echo "$usb_list" | grep -Fxq "$guest_usb_dev1_id" && echo "$usb_list" | grep -Fxq "$guest_usb_dev2_id"; then
                    qvm-start --skip-if-running -q $guest_to_start_on_usb
                    break
                fi
            fi
            sleep 1
        done
    ) & disown
fi

Detaching USB device from sys-audio or editing the script shouldn’t have affected sys-usb start.

Can you once again edit the script to be the one in this post, detach sys-usb:2-4 from sys-audio, make sure that it’s detached in qvm-usb list and then reboot. If something fails to start then provife the dom0 journalctl log.