Skip to content

Re-attaching USB partition (block device) shows error in dom0's journal #10828

@emanruse

Description

@emanruse

Qubes OS release

4.3.0

Brief summary

Detaching and attaching again the same block storage (of USB device) shows errors in dom0 journal.

Steps to reproduce

Connect a USB device that has a partition with a file system.

user@dom0:~ > qvm-device block list
BACKEND:DEVID  DESCRIPTION                                               USED BY
dom0:dm-5      Block_Storage: hosted by dom0 qubes dom0-swap             
sys-usb:sda    Block_Storage: sub-device of sys-usb:3-2 USB Flash Drive  
sys-usb:sda1   Block_Storage: sub-device of sys-usb:sda LEXAR

In another console:

root@dom0:~ # journalctl -o short-monotonic -f
user@dom0:~ > qvm-device block detach ddd4385 sys-usb:sda1
user@dom0:~ > qvm-device block attach ddd4385 sys-usb:sda1
user@dom0:~ > echo $?
0

Expected behavior

No errors.
Or, in case of error, have correct error exit code.

Actual behavior

Error in journal shows on second attach:

[ 6282.631637] dom0 widget-wrapper[7700]: Failed to handle event: ddd4385, device-attach:block, {'device': sys-usb+sda1:0000:0000::?******:1, 'options': "{'read-only': 'no', 'frontend-dev': 'xvdi'}"}
[ 6282.631637] dom0 widget-wrapper[7700]: Traceback (most recent call last):
[ 6282.631637] dom0 widget-wrapper[7700]:   File "/usr/lib/python3.13/site-packages/qubesadmin/events/__init__.py", line 307, in handle
[ 6282.631637] dom0 widget-wrapper[7700]:     handler(subject, event, **kwargs)
[ 6282.631637] dom0 widget-wrapper[7700]:     ~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
[ 6282.631637] dom0 widget-wrapper[7700]:   File "/usr/lib/python3.13/site-packages/qui/devices/device_widget.py", line 606, in device_attached
[ 6282.631637] dom0 widget-wrapper[7700]:     self.devices[dev_id] = backend.Device(device, self)
[ 6282.631637] dom0 widget-wrapper[7700]:                            ~~~~~~~~~~~~~~^^^^^^^^^^^^^^
[ 6282.631637] dom0 widget-wrapper[7700]:   File "/usr/lib/python3.13/site-packages/qui/devices/backend.py", line 160, in __init__
[ 6282.631637] dom0 widget-wrapper[7700]:     self._interfaces = dev.interfaces
[ 6282.631637] dom0 widget-wrapper[7700]:                        ^^^^^^^^^^^^^^
[ 6282.631637] dom0 widget-wrapper[7700]: AttributeError: 'VirtualDevice' object has no attribute 'interfaces'

and the exit code is 0, as if no error occurred.

Additional information

The attached device works as expected in both cases (1st and 2nd attach).

Metadata

Metadata

Assignees

No one assigned

    Labels

    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

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions