Bug 1950258 - USB flash disk cannot be mounted into a virtual machine. [NEEDINFO]
Summary: USB flash disk cannot be mounted into a virtual machine.
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: virt-manager
Version: 34
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Cole Robinson
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard: RejectedBlocker https://fedoraproject...
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-04-16 08:34 UTC by Lukas Ruzicka
Modified: 2021-05-05 17:06 UTC (History)
13 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
crobinso: needinfo? (lruzicka)


Attachments (Terms of Use)
Journalctl from the host machine on F34. (17.66 KB, text/plain)
2021-04-16 08:34 UTC, Lukas Ruzicka
no flags Details
Logs from the virtualized installed f34 (455.50 KB, text/plain)
2021-04-16 08:34 UTC, Lukas Ruzicka
no flags Details
Logs from the virtualized live F34 (168.23 KB, text/plain)
2021-04-16 08:35 UTC, Lukas Ruzicka
no flags Details
if specifically add USB pendrive as new hardware and then start VM, it recognizes (512.02 KB, image/png)
2021-04-17 00:08 UTC, Geraldo Simião
no flags Details
journalctl -r from the VM with pendrive attached the first time (503.61 KB, image/png)
2021-04-22 14:00 UTC, Geraldo Simião
no flags Details
journalctl -r from the VM trying to attach the same pendrive a second time (401.56 KB, image/png)
2021-04-22 14:02 UTC, Geraldo Simião
no flags Details
virt-manager --debug (full session recorded) (42.93 KB, text/plain)
2021-04-22 14:25 UTC, Geraldo Simião
no flags Details
virt-manager --debug (full session) (now with pendrive installed first) (24.41 KB, text/plain)
2021-04-22 14:47 UTC, Geraldo Simião
no flags Details
Journalctl -f from HOST machine same timestamp as last attachment (20.07 KB, text/plain)
2021-04-22 15:01 UTC, Geraldo Simião
no flags Details

Description Lukas Ruzicka 2021-04-16 08:34:10 UTC
Created attachment 1772381 [details]
Journalctl from the host machine on F34.

Description of problem:

On Fedora 34 (being a host), it is not possible to mount a USB flash disk into the virtual machine that runs Fedora 34 or Fedora 33 (did not test other OSes). When the host computer runs Fedora 33, everything seems to be working fine. 
I have tried many combinations and I realized the following:

* The virtual machine knows about the USB having been connected (info about connecting the device appears in the journal)
* It tries several times to read the content of the disk but it takes a long time and ends with an error (see logs).
* This behaviour does not go away when the host computer changes the SElinux settings from Enforcing to Permissive and it does not go away, when the VM's SElinux is set to Permissive.
* It happens on both BIOS and UEFI based VMs.
* When the VM runs KDE Plasma desktop (installed from KDE Live) any attempt to connect the USB to the VM makes the virt-manager crash!!! The VM is still running in the background though and when virt-manager is restarted, you can connect to the VM again. When it runs Gnome desktop (Wayland), the virt-manager never crashes.
* When the VM is restarted with the flash disk connected it never can boot again, waiting on some error about "LVM" but the system installed in the VM uses BTRFS. Once the flash disk is removed, the boot process continues without any issues.
* The same happens with various USB disks and USB slots on the machine.
* The same happens when the device is mounted on the host and passed through manually to the VM. 
* There are no issues on the host, which can mount the USB disk just fine.

I am not sure what causes the problem, so I am filing this bug agains virt-manager, but feel free to move it where it belongs.


Version-Release number of selected component (if applicable):

virt-manager-3.2.0-3.fc34.noarch
libvirt-7.0.0-4.fc34.x86_64

How reproducible:

Always.

Steps to Reproduce:
1. Run virt-manager on latest F34.
2. Create a virtual machine with default settings, i.e. skip the option to modify it before running.
3. Install a desktop Fedora (GNOME or KDE).
4. Connect a USB flash disk.

Actual results:

The disk is reported in the journalctl but never gets mounted on the system.

Expected results:

It should be possible to use flash disks in a VM as it was possible in Fedora 33.


Additional info:

I am attaching all the logs, I have collected, but the significant error is this one:

~~~
Apr 15 18:13:22 fedora kernel: usb 1-3: reset high-speed USB device number 4 using xhci_hcd
Apr 15 18:13:53 fedora kernel: usb 1-3: reset high-speed USB device number 4 using xhci_hcd
Apr 15 18:13:53 fedora kernel: sd 6:0:0:0: [sda] tag#0 FAILED Result: hostbyte=DID_TIME_OUT driverbyte=DRIVER_OK cmd_age=30s
Apr 15 18:13:53 fedora kernel: sd 6:0:0:0: [sda] tag#0 CDB: Read(10) 28 00 00 00 03 08 00 00 f0 00
Apr 15 18:13:53 fedora kernel: blk_update_request: I/O error, dev sda, sector 776 op 0x0:(READ) flags 0x84700 phys_seg 10 prio class 0
~~~

Comment 1 Lukas Ruzicka 2021-04-16 08:34:59 UTC
Created attachment 1772382 [details]
Logs from the virtualized installed f34

Comment 2 Lukas Ruzicka 2021-04-16 08:35:34 UTC
Created attachment 1772383 [details]
Logs from the virtualized live F34

Comment 3 Fedora Blocker Bugs Application 2021-04-16 08:39:47 UTC
Proposed as a Blocker for 34-final by Fedora user lruzicka using the blocker tracking app because:

 I am proposing this bug as a F34 final blocker because it violates one of the Beta Release Criteria:

**Automatic mounting**
Automatic mounting of removable media on insertion must work in release-blocking desktops.

Comment 4 Lukas Ruzicka 2021-04-16 08:58:10 UTC
I also tried to virtualize Ubuntu 20 in that VM and the result is exactly the same, so I can assume that there is no difference when a non-fedora OS is installed in the VM.

Comment 5 Kamil Páral 2021-04-16 12:26:26 UTC
I can confirm this, I see the same I/O errors when I try to connect a USB disk into my VM (F34 host, F34 VM).

Comment 6 Geraldo Simião 2021-04-17 00:01:20 UTC
(In reply to Fedora Blocker Bugs Application from comment #3)
> Proposed as a Blocker for 34-final by Fedora user lruzicka using the blocker
> tracking app because:
> 
>  I am proposing this bug as a F34 final blocker because it violates one of
> the Beta Release Criteria:
> 
> **Automatic mounting**
> Automatic mounting of removable media on insertion must work in
> release-blocking desktops.

Why use this criteria in a virtual machine especific bug? I'm using F34 on baremetal and automatic mounting works fine.

Comment 7 Geraldo Simião 2021-04-17 00:06:37 UTC
Tested here on my F34 kde host, with an F33 kde respin as gest.
Added the USB device at the VM and the started the vm.
The usb device showed fine at the VM.
Then removed the pendrive and tried to attach again.
VM doesn't recognize pendrive.

Comment 8 Geraldo Simião 2021-04-17 00:08:14 UTC
Created attachment 1772689 [details]
if specifically add USB pendrive as new hardware and then start VM, it recognizes

Comment 9 Raphael Groner 2021-04-17 08:20:56 UTC
Is this bug about USB pendrive or other USB devices, too? Did someone test with e.g. a webcam?
It could be a bug in the hypervisor (qemu/kvm) as well due to I see some issue with oVirt based on CentOS 8. Doubtful virt-manager is really the main reason.

Comment 10 Raphael Groner 2021-04-17 08:32:03 UTC
Do you use USB2 or USB3 for both the host and emulated controller?

Comment 11 Geoffrey Marr 2021-04-19 19:01:23 UTC
Discussed during the 2021-04-19 blocker review meeting: [0]

The decision to classify this bug as a "RejectedBlocker (Final)" was made as we agree that this does not really violate the criteria as they stand.

[0] https://meetbot.fedoraproject.org/fedora-blocker-review/2021-04-19/f34-blocker-review.2021-04-19-16.00.txt

Comment 12 Michael T 2021-04-21 16:34:05 UTC
I face the same problem: cannot mount ext4 usb drive in Debian 9 or Debian 10 guest in Virtual Machine Manager.

Tried USB 2 and USB 3 without success in both host and emulated controller.

Have mounted same ext4 drive in these vm guests for more than 1 year without any problems.

Host OS is Fedora 33, which mounts same usb disk without any problems.

Comment 13 Michael T 2021-04-21 16:40:33 UTC
Forgot to mention that "lsblk" shows the device, but "mount" command takes a really long time (USB dongle light flashes) but nothing happens.

Comment 14 Cole Robinson 2021-04-21 22:53:56 UTC
Can someone reproduce the issue with `virt-manager --debug` and attach the full output?
Logs will tell, but please describe specifically via the virt-manager UI how you are adding the USB device, similar to how Geraldo explained.

Comment 15 Geraldo Simião 2021-04-22 14:00:12 UTC
Created attachment 1774489 [details]
journalctl -r from the VM with pendrive attached the first time

Started the VM after manual install of the pendrive on the virt-manger GUI, pendrive recognized by the VM. then unmounted the unit and removed succesfully.

Comment 16 Geraldo Simião 2021-04-22 14:02:37 UTC
Created attachment 1774491 [details]
journalctl -r from the VM trying to attach the same pendrive a second time

After removeing the pendrive, with the VM still on I tried to attach it again, to see if the auto mount will work. Pendrive was not automounted.

Comment 17 Geraldo Simião 2021-04-22 14:25:57 UTC
Created attachment 1774495 [details]
virt-manager --debug (full session recorded)

I attached the full output of virt-manager --debug, as suggested.
In this session the pendrive was not pre-installed prior to launching the VM (I removed the hardware from the vm before, to test just as if I was attaching the pendrive with VM online for the first time).
Here the output record from the moment I connect the pendrive to the host:

######### moment when I attached the pendrive to the host###################
[qui, 22 abr 2021 11:12:58 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:12:58 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1_1_0 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:12:58 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_host6 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:12:59 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_target6_0_0 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:12:59 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_6_0_0_0 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:12:59 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_generic_sg2 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:13:00 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=block_sdb_Kingston_DataTraveler_2_0_5B77098B4EBC_0_0 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0

########## moment when I removed the pendrive ##########################
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_generic_sg2 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=block_sdb_Kingston_DataTraveler_2_0_5B77098B4EBC_0_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_6_0_0_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=scsi_generic_sg2 removed
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=scsi_6_0_0_0 removed
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=block_sdb_Kingston_DataTraveler_2_0_5B77098B4EBC_0_0 removed
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_target6_0_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_host6 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1_1_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=scsi_host6 removed
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=usb_3_1_1_0 removed
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=scsi_target6_0_0 removed
[qui, 22 abr 2021 11:14:35 virt-manager 12689] DEBUG (connection:1050) nodedev=usb_3_1 removed

Comment 18 Geraldo Simião 2021-04-22 14:47:09 UTC
Created attachment 1774506 [details]
virt-manager --debug (full session) (now with pendrive installed first)

In this debug I recorded the full session when I instaled the hardware (pendrive attached to host) first, and then startet the VM, see the pendrive working fine on the VM, removed it, and tried to re-attach it.
Here is the output from this moment:

############### successfully started, pendrive mounted corretcly #############

##################### Then I unmount and remove the pendrive ###############

[qui, 22 abr 2021 11:34:40 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1_1_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:34:40 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:34:40 virt-manager 13280] DEBUG (connection:1050) nodedev=usb_3_1_1_0 removed
[qui, 22 abr 2021 11:34:40 virt-manager 13280] DEBUG (connection:1050) nodedev=usb_3_1 removed

######### and then I try to attach again the same pendrive #############

[qui, 22 abr 2021 11:36:42 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:36:42 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1_1_0 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:36:42 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_host6 state=VIR_NODE_DEVICE_EVENT_CREATED reason=0
[qui, 22 abr 2021 11:36:42 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=scsi_host6 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:36:42 virt-manager 13280] DEBUG (connection:1050) nodedev=scsi_host6 removed
[qui, 22 abr 2021 11:36:42 virt-manager 13280] DEBUG (connection:1046) Requested removal of nodedev=scsi_host6, but it's not in our object list.
########## the led on the pendrive keeps blinking, nothing happens ########

######## and finaly I remove the pendrive from the usb ###############
[qui, 22 abr 2021 11:38:16 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1_1_0 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:38:16 virt-manager 13280] DEBUG (connection:706) node device lifecycle event: nodedev=usb_3_1 state=VIR_NODE_DEVICE_EVENT_DELETED reason=0
[qui, 22 abr 2021 11:38:16 virt-manager 13280] DEBUG (connection:1050) nodedev=usb_3_1_1_0 removed
[qui, 22 abr 2021 11:38:16 virt-manager 13280] DEBUG (connection:1050) nodedev=usb_3_1 removed

Comment 19 Geraldo Simião 2021-04-22 14:48:49 UTC
(In reply to Cole Robinson from comment #14)
> Can someone reproduce the issue with `virt-manager --debug` and attach the
> full output?
> Logs will tell, but please describe specifically via the virt-manager UI how
> you are adding the USB device, similar to how Geraldo explained.

Cole, the last attachments are any help? Do you need some other data?

Comment 20 Geraldo Simião 2021-04-22 15:01:42 UTC
Created attachment 1774522 [details]
Journalctl -f from HOST machine same timestamp as last attachment

I made all last tests with journalctl-f running on the host machine, to see how the host recorded the moment I add hardware to the VM and start it with pendrive corretcly attached, and then remove it online. Same timestamps as last attachment.

Comment 21 Tad 2021-04-29 15:53:11 UTC
In the meantime, can this be added to https://fedoraproject.org/wiki/Common_F34_bugs ?

Comment 22 Kamil Páral 2021-04-30 06:50:37 UTC
Good call, added there.


Note You need to log in before you can comment on or make changes to this bug.