qubes-issues icon indicating copy to clipboard operation
qubes-issues copied to clipboard

keyerror: sys-usb

Open Rudd-O opened this issue 3 years ago • 1 comments

Qubes OS release

4.1 latest

Brief summary

When shutting down or starting a VM that is the target of a persistent USB attachment (with qvm-usb attach --persistent), qubesd blurts a KeyError. Additionally, starting the VM after shutting it off is impossible. The only fix is to restart qubesd prior to starting the VM again.

I don't have a traceback with me at this point in time, sadly -- I am abroad.

Steps to reproduce

Persistently attach USB device to VM X.

Power off VM X.

Power on VM X.

See that VM X never starts.

Expected behavior

VM starts, device is "plugged" into it.

Actual behavior

VM never starts.

Rudd-O avatar Aug 26 '22 00:08 Rudd-O

Sep 06 01:12:36 dom0 qubesd[2660757]: unhandled exception while calling src=b'dom0' meth=b'admin.vm.Start' dest=b'assistant' arg=b'' len(untrusted_payload)=0
Sep 06 01:12:36 dom0 qubesd[2660757]: Traceback (most recent call last):
Sep 06 01:12:36 dom0 qubesd[2660757]:   File "/usr/lib/python3.8/site-packages/qubes/api/__init__.py", line 288, in respond
Sep 06 01:12:36 dom0 qubesd[2660757]:     response = await self.mgmt.execute(
Sep 06 01:12:36 dom0 qubesd[2660757]:   File "/usr/lib/python3.8/site-packages/qubes/api/admin.py", line 883, in vm_start
Sep 06 01:12:36 dom0 qubesd[2660757]:     await self.dest.start()
Sep 06 01:12:36 dom0 qubesd[2660757]:   File "/usr/lib/python3.8/site-packages/qubes/vm/qubesvm.py", line 1240, in start
Sep 06 01:12:36 dom0 qubesd[2660757]:     await self.fire_event_async('domain-start',
Sep 06 01:12:36 dom0 qubesd[2660757]:   File "/usr/lib/python3.8/site-packages/qubes/events.py", line 233, in fire_event_async
Sep 06 01:12:36 dom0 qubesd[2660757]:     effect = task.result()
Sep 06 01:12:36 dom0 qubesd[2660757]:   File "/usr/lib/python3.8/site-packages/qubesusbproxy/core3ext.py", line 397, in on_domain_start
Sep 06 01:12:36 dom0 qubesd[2660757]:     yield from self.on_device_attach_usb(vm, '', device, options={})
Sep 06 01:12:36 dom0 qubesd[2660757]:   File "/usr/lib/python3.8/site-packages/qubesusbproxy/core3ext.py", line 333, in on_device_attach_usb
Sep 06 01:12:36 dom0 qubesd[2660757]:     self.devices_cache[device.backend_domain.name][device.ident] = vm
Sep 06 01:12:36 dom0 qubesd[2660757]: KeyError: 'sys-usb'
Sep 06 01:12:38 dom0 qubesd[2660757]: libvirt: Xen Light Driver error : Domain not found

Rudd-O avatar Sep 06 '22 01:09 Rudd-O

So when is this getting fixed?

Rudd-O avatar Dec 02 '22 00:12 Rudd-O

Continues to be an issue.

Dec 02 00:16:24 dom0 qubesd[2374]: unhandled exception while calling src=b'dom0' meth=b'admin.vm.Start' dest=b'assistant' arg=b'' len(untrusted_payload)=0
Dec 02 00:16:24 dom0 qubesd[2374]: Traceback (most recent call last):
Dec 02 00:16:24 dom0 qubesd[2374]:   File "/usr/lib/python3.8/site-packages/qubes/api/__init__.py", line 288, in respond
Dec 02 00:16:24 dom0 qubesd[2374]:     response = await self.mgmt.execute(
Dec 02 00:16:24 dom0 qubesd[2374]:   File "/usr/lib/python3.8/site-packages/qubes/api/admin.py", line 883, in vm_start
Dec 02 00:16:24 dom0 qubesd[2374]:     await self.dest.start()
Dec 02 00:16:24 dom0 qubesd[2374]:   File "/usr/lib/python3.8/site-packages/qubes/vm/qubesvm.py", line 1247, in start
Dec 02 00:16:24 dom0 qubesd[2374]:     await self.fire_event_async('domain-start',
Dec 02 00:16:24 dom0 qubesd[2374]:   File "/usr/lib/python3.8/site-packages/qubes/events.py", line 233, in fire_event_async
Dec 02 00:16:24 dom0 qubesd[2374]:     effect = task.result()
Dec 02 00:16:24 dom0 qubesd[2374]:   File "/usr/lib/python3.8/site-packages/qubesusbproxy/core3ext.py", line 393, in on_domain_start
Dec 02 00:16:24 dom0 qubesd[2374]:     await self.on_device_attach_usb(vm, '', device, options={})
Dec 02 00:16:24 dom0 qubesd[2374]:   File "/usr/lib/python3.8/site-packages/qubesusbproxy/core3ext.py", line 331, in on_device_attach_usb
Dec 02 00:16:24 dom0 qubesd[2374]:     self.devices_cache[device.backend_domain.name][device.ident] = vm
Dec 02 00:16:24 dom0 qubesd[2374]: KeyError: 'sys-usb'
Dec 02 00:16:24 dom0 qvm-start[16375]: Got empty response from qubesd. See journalctl in dom0 for details.
Dec 02 00:16:24 dom0 systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
Dec 02 00:16:24 dom0 systemd[1]: [email protected]: Failed with result 'exit-code'.
Dec 02 00:16:24 dom0 systemd[1]: Failed to start Start Qubes VM assistant.
Dec 02 00:16:24 dom0 systemd[1]: Reached target Multi-User System.

Rudd-O avatar Dec 02 '22 00:12 Rudd-O

Still present with the latest 4.1 updates.

Rudd-O avatar Jan 04 '23 15:01 Rudd-O

https://github.com/QubesOS/qubes-app-linux-usb-proxy/blob/main/qubesusbproxy/core3ext.py#L331 is the location of the error.

This indicates that the devices_cache variable does not contain the backend host there. I am almost certain that the devices_cache should not be initialized as a dict, but rather should be initialized as a defaultdict(dict).

This bug makes the persistent attach feature useless.

Rudd-O avatar Jan 04 '23 15:01 Rudd-O

Tests may not have caught this issue because a qubesd restart (which probably happens between tests) makes it go away (I guess it rebuilds the caches?).

Rudd-O avatar Jan 04 '23 15:01 Rudd-O

@marmarek I've filed a fix PR!

Rudd-O avatar Jan 04 '23 15:01 Rudd-O

Automated announcement from builder-github

The component app-linux-usb-proxy (including package qubes-usb-proxy-dom0-1.1.3-1.fc32) has been pushed to the r4.1 testing repository for dom0. To test this update, please install it with the following command:

sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 12:01 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.1 testing repository for the CentOS centos-stream8 template. To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.1-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 12:01 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.2 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing bullseye-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Jan 18 '23 12:01 qubesos-bot

Automated announcement from builder-github

The package qubes-usb-proxy_1.1.3 has been pushed to the r4.1 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing buster-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Jan 18 '23 12:01 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.2 testing repository for the CentOS centos-stream8 template. To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 13:01 qubesos-bot

Automated announcement from builder-github

The component app-linux-usb-proxy (including package app-linux-usb-proxy) has been pushed to the r4.2 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 13:01 qubesos-bot

Automated announcement from builder-github

The component app-linux-usb-proxy (including package app-linux-usb-proxy) has been pushed to the r4.2 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 13:01 qubesos-bot

Thank you, @marmarek !

Rudd-O avatar Jan 18 '23 14:01 Rudd-O

Automated announcement from builder-github

The component app-linux-usb-proxy (including package qubes-usb-proxy-dom0-1.1.4-1.fc32) has been pushed to the r4.1 testing repository for dom0. To test this update, please install it with the following command:

sudo qubes-dom0-update --enablerepo=qubes-dom0-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.1 testing repository for the CentOS centos-stream8 template. To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.1-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.2 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing bullseye-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The package qubes-usb-proxy_1.1.4 has been pushed to the r4.1 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing buster-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The component app-linux-usb-proxy (including package app-linux-usb-proxy) has been pushed to the r4.2 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.2 testing repository for the CentOS centos-stream8 template. To test this update, please install it with the following command:

sudo yum update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The component app-linux-usb-proxy (including package app-linux-usb-proxy) has been pushed to the r4.2 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Jan 18 '23 21:01 qubesos-bot

Automated announcement from builder-github

The component app-linux-usb-proxy (including package qubes-usb-proxy-dom0-1.1.4-1.fc32) has been pushed to the r4.1 stable repository for dom0. To install this update, please use the standard update command:

sudo qubes-dom0-update

Or update dom0 via Qubes Manager.

Changes included in this update

qubesos-bot avatar Feb 07 '23 05:02 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.1 stable repository for the CentOS centos-stream8 template. To install this update, please use the standard update command:

sudo yum update

Changes included in this update

qubesos-bot avatar Feb 07 '23 05:02 qubesos-bot

Automated announcement from builder-github

The package qubes-usb-proxy_1.1.4+deb10u1 has been pushed to the r4.1 stable repository for the Debian template. To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Feb 07 '23 05:02 qubesos-bot

Automated announcement from builder-github

The package app-linux-usb-proxy has been pushed to the r4.2 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing bookworm-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Apr 29 '23 01:04 qubesos-bot