Skip to content

qvm-start-daemon receiving xid -1 on_domain_start #10313

@andre-aktivconsultancy

Description

@andre-aktivconsultancy

Qubes OS release

Qubes OS 4.3-rc2

Brief summary

I had troubles getting my audio-vm to work reliably. After debugging it turned out that the on_domain_start handler of qvm-start-daemon may receive a (invalid) xid of -1. As a result the audio connection is not setup properly when a qube starts after sys-audio. This seems only to be the case for non-disposables. Dispobable qubes work fine.

Both the disposable as the regular qube I used to test audio are based on the same template.

Steps to reproduce

  1. Have an audio-vm setup.
  2. Start a qube with the audio-vm configured.
  3. Start a disposable qube with the audio-vm configured.
  4. Try play some audio in both qubes.

Expected behavior

Audio from both qubes should be working

Actual behavior

Only audio from the disposable qube is working.

Additional information

When running qvm-start-daemon --watch --all manually in sys-audio this output is shown:

/usr/bin/pacat-simple-vchan: invalid option -- '1'
usage: /usr/bin/pacat-simple-vchan [options] [--] domid domname
  -l - low-latency mode (higher CPU usage)
  -n - never block on vchan I/O (overrides previous -b option)
  -b - always block on vchan I/O (default, overrides previous -n option)
  -v - verbose logging (a lot of output, may affect performance)
  -t size - target playback buffer fill, implies -l, default 4096
  -h - print this message

I was able to workaround the issue by patching the EventDispatcher like so:

diff --git a/qubesadmin/events/__init__.py b/qubesadmin/events/__init__.py
index 353cc18..144c3d0 100644
--- a/qubesadmin/events/__init__.py
+++ b/qubesadmin/events/__init__.py
@@ -216,12 +216,20 @@ class EventsDispatcher(object):
     def handle(self, subject, event, **kwargs):
         """Call handlers for given event"""
         # pylint: disable=protected-access
+        print("eventDispatcher::handle: {}, {}".format(subject, event))
         if subject:
             if event in ['property-set:name']:
                 self.app.domains.clear_cache()
             try:
                 subject = self.app.domains.get_blind(subject)
+                print("--> {} {} {}".format(subject, type(subject), subject.xid))
+                if subject.xid == -1:
+                    print("No xid, refreshing cache")
+                    self.app.domains.clear_cache(invalidate_name=str(subject))
+                    self.app.domains.refresh_cache()
+                    subject = self.app.domains.get_blind(str(subject))
             except KeyError:
+                print("key error")
                 return
         else:
             # handle cache refreshing on best-effort basis

This makes my sys-audio behave as expected, however this does not seem to be the proper fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: audioThis issue pertains to audio in Qubes OS.C: coreThis issue pertains to a Qubes core component.P: defaultPriority: default. Default priority for new issues, to be replaced given sufficient information.affects-4.3This issue affects Qubes OS 4.3.needs diagnosisRequires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions