Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

untrusted_qdb invoked before qubesdb fully started #9514

Open
qubest opened this issue Oct 17, 2024 · 0 comments
Open

untrusted_qdb invoked before qubesdb fully started #9514

qubest opened this issue Oct 17, 2024 · 0 comments
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: core needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.

Comments

@qubest
Copy link

qubest commented Oct 17, 2024

How to file a helpful issue

Qubes OS release

Qubes OS 4.2.0 (R4.2)

Brief summary

During vm start sys-gui-gpu failed to start. After checking journalctl the following error found:

vm.sys-gui-gpu: Failed to list usb devices
Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/qubes/devices.py", line 349, in assignments
    devices = self._vm.fire_event('device-list-attached:' + self._bus,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qubes/events.py", line 195, in fire_event
    sync_effects, async_effects = self._fire_event(event, kwargs,
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qubes/events.py", line 168, in _fire_event
    effects.extend(effect)
  File "/usr/lib/python3.11/site-packages/qubesusbproxy/core3ext.py", line 298, in on_device_list_attached
    for dev in self.get_all_devices(vm.app):
  File "/usr/lib/python3.11/site-packages/qubesusbproxy/core3ext.py", line 287, in get_all_devices
    for dev in vm.devices['usb']:
  File "/usr/lib/python3.11/site-packages/qubes/devices.py", line 377, in __iter__
    return iter(self.available())
                ^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qubes/devices.py", line 373, in available
    devices = self._vm.fire_event('device-list:' + self._bus)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qubes/events.py", line 195, in fire_event
    sync_effects, async_effects = self._fire_event(event, kwargs,
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qubes/events.py", line 168, in _fire_event
    effects.extend(effect)
  File "/usr/lib/python3.11/site-packages/qubesusbproxy/core3ext.py", line 252, in on_device_list_usb
    if not vm.is_running() or not hasattr(vm, 'untrusted_qdb'):
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/qubes/vm/qubesvm.py", line 851, in untrusted_qdb
    self._qdb_connection = qubesdb.QubesDB(self.name)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^
qubesdb.Error: (2, 'No such file or directory')

The error causes sys-gui-gpu to restart and get new xid. Some vms might start before sys-gui-gpu and uses the old qubes-gui-domain-xid. As a result, qubes-gui-agent run with unsynced qubes-gui-domain-xid.

After tracing the error untrusted_qdb is used at core3ext. which might be invoked before starting qubesdb

I tried to add a check at untrusted_qdb for the sock file /var/run/qubes/qubesdb.sys-gui-gpu.sock created by qubesdb to make sure it started before anyone tries to invoke it. After adding the check the error didn't appear again.

Steps to reproduce

Occurs randomly

Expected behavior

sys-gui-gpu starts normally and gui-agent in appvms run with correct xid

Actual behavior

sys-gui-gpu restart once which causes gui-agents in appvm to run with wrong gui-domain-xid

@qubest qubest added P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists. labels Oct 17, 2024
@andrewdavidwong andrewdavidwong added C: core needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. affects-4.2 This issue affects Qubes OS 4.2. labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-4.2 This issue affects Qubes OS 4.2. C: core needs diagnosis Requires technical diagnosis from developer. Replace with "diagnosed" or remove if otherwise closed. P: default Priority: default. Default priority for new issues, to be replaced given sufficient information. T: bug Type: bug report. A problem or defect resulting in unintended behavior in something that exists.
Projects
None yet
Development

No branches or pull requests

2 participants