Problems connecting usb flash drive to any vm

508 views
Skip to first unread message

zxe...@gmail.com

unread,
Nov 26, 2016, 12:56:12 AM11/26/16
to qubes-users
When I first installed Qubes (3.2), I could attach and detach block devices without errors and mount flash drives in VM's. I wanted to use my external keyboard with my laptop so followed the steps in the guide (https://www.qubes-os.org/doc/usb/) for "Creating and Using a USB qube" (using the management stack) and "How to use a USB keyboard".

However, the generated sys-usb Qube fails to boot and detaching a USB flash drive using the VM Manager always give me a blank window with the text "Houston, we have a problem..." and freezes the VM Manager. After a few seconds of trying to close the blank window I get "This window might be busy and is not responding. Do you want to terminate the application?". After I restart the VM Manager the USB device is still shows as attached. If I restart the VM with the attached USB device it gives me another error "AssertionError: This is most likely a bug in the Qubes Manager" and the VM is killed. (Note I did this with a DisposableVM).

The above happens even if I attach and then immediately detach the USB block device.

After plugging in the USB flash drive to my laptop, but not attaching it to any VM the USB flash drive is visible to sys-net with "fdisk -l", but mounting fails with "wrong fs type" even though I mount it with "-t vfat" and fdisk shows the USB flash drive is FAT32. If I attache the USB flash drive to any other VM "fdisk -l" does not show any attached flash drive.

I am currently in China, so I cannot reach google with the laptop running Qubes until I get a socks proxy set up and tor is block in China (any bridges I have tried are quickly blocked).

Any help would be helpful. Let me know what logs would be useful to post (I am still very new to Qubes).

Andrew David Wong

unread,
Nov 26, 2016, 1:10:32 AM11/26/16
to zxe...@gmail.com, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 11/25/16 21:56, zxe...@gmail.com wrote:
> When I first installed Qubes (3.2), I could attach and detach block devices without errors and mount flash drives in VM's. I wanted to use my external keyboard with my laptop so followed the steps in the guide (https://www.qubes-os.org/doc/usb/) for "Creating and Using a USB qube" (using the management stack) and "How to use a USB keyboard".
>
> However, the generated sys-usb Qube fails to boot

Have you changed the devices assigned to sys-usb? If so, it's possible you're running into a pci_strictreset issue here? Try running this in dom0 (but before you do, make sure you understand the risks [1]):

$ qvm-prefs -s sys-usb pci_strictreset false

Then try starting sys-usb again:

$ qvm-start sys-usb

Let us know if there are any useful error messages.

> and detaching a USB flash drive using the VM Manager always give me a blank window with the text "Houston, we have a problem..." and freezes the VM Manager. After a few seconds of trying to close the blank window I get "This window might be busy and is not responding. Do you want to terminate the application?". After I restart the VM Manager the USB device is still shows as attached.

Try detaching it from the command-line instead:

$ qvm-block -d <device-vm-name>:<device>

Or just:

$ qvm-block -d <vm-name>

And let us know if there are any useful error messages.

> If I restart the VM with the attached USB device it gives me another error "AssertionError: This is most likely a bug in the Qubes Manager" and the VM is killed. (Note I did this with a DisposableVM).

Errors are to be expected when restarting a VM with USB devices still attached. They should be detached first.

> The above happens even if I attach and then immediately detach the USB block device.
>
> After plugging in the USB flash drive to my laptop, but not attaching it to any VM the USB flash drive is visible to sys-net with "fdisk -l",

Did you mean "sys-usb" instead of "sys-net"? (If not, the description you've provided of your overall setup is inconsistent. Please clarify it.)

> but mounting fails with "wrong fs type" even though I mount it with "-t vfat" and fdisk shows the USB flash drive is FAT32.

Are you sure the drive is formatted correctly? If you have a backup of the data already, try reformatting it.

If your VM is based on an unusual template, that could also be a clue.

> If I attache the USB flash drive to any other VM "fdisk -l" does not show any attached flash drive.

If you attach the drive to another VM, what is the output of this command?

$ qvm-block -l

If the drive is really attached, it should indicate that in the output of the above command.

> I am currently in China, so I cannot reach google with the laptop running Qubes until I get a socks proxy set up and tor is block in China (any bridges I have tried are quickly blocked).
>
> Any help would be helpful. Let me know what logs would be useful to post (I am still very new to Qubes).
>

[1] https://www.qubes-os.org/doc/user-faq/#i-created-a-usbvm-and-assigned-usb-controllers-to-it-now-the-usbvm-wont-boot

- --
Andrew David Wong (Axon)
Community Manager, Qubes OS
https://www.qubes-os.org
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJYOSdBAAoJENtN07w5UDAwHl0P/2fisY9AfoPnDKWTb0QnGfjE
EIBjlLWgTiN5fBAfZ7A+aPLadqOXn3PXuytsP/FCaswLzuu/Y09hYzqmssKPSnnj
7tXmb3DbOqJNn/oY2T2FtS1BoAlnEYrSxt1pGdO22ZV6NyvpytqUu+jeZ0fAfNK1
/wI1CsPaRHSbI+slqTexGtggJ3kM2Oh0I2O4HIZeRPL/gyN71zGbek5JpkeUjdju
+AbJ2+OteFXIMEXbP+1t6oJ5kwP4QkAnidgvImDAmV0fL21DXtn25rhoq338egB6
7Oh0YfK1s8bk2VTBFOMUj1gI8u3unrUUswegr0J0IlT/b8jF8c8G9+1EiQi2KM3Z
swqWRLWGWO5wi5PfWYIpb6Lsg5Z9rr3i5MYtkhXpzsaFWk1HHS6lr9frQCZJLpE6
vKuZpvXBnp3yv70TyOcWurfA+dkE/W/WRgkSskUutfqZNUO4mDzPw+dnzUWAbMEY
76tLEKhU2DBxkKnzVobL2hEG7d5XKIFIau+NV3Xq1kcSWWrpY8M/sKf54jr/DPP9
6hju7DyyP/CUeo+ekFq2Z0CECQ3vQh7vRwENhF2YFQn8hOKnXdsDE0ep16OGRy6C
RiGpeCM8fXkj37mlVe1+eJoy/IR6LbXf44vvHh8UbJAM5KIyL8xOfjTldVL3kqFw
kcyOP1BU/M8jO7Z5WO5v
=7/Or
-----END PGP SIGNATURE-----

zxe...@gmail.com

unread,
Nov 26, 2016, 2:26:46 AM11/26/16
to qubes-users, zxe...@gmail.com
> Have you changed the devices assigned to sys-usb? If so, it's possible you're running into a pci_strictreset issue here? Try running this in dom0 (but before you do, make sure you understand the risks [1]):
>
> $ qvm-prefs -s sys-usb pci_strictreset false
>
> Then try starting sys-usb again:
>
> $ qvm-start sys-usb
>
> Let us know if there are any useful error messages.
I ran both and got:
Traceback (most recent call last):
File "/usr/bin/qvm-start", line 136, in <module>
main()
File "/usr/bin/qvm-start", line 120 in main
xid = vm.start(verbose=options.verbose, preparing_dvm=options.preparing_dvm, start_guid=not options.noguid, notify_function=tray_notify_generic if options.tray else None)
File "/usr/lib64/python2.7/site-packages/qubes/modules/005QubesNetVm.py", line 122 in start
xid=super(QubesNetVm, self),start(**kwargs)
File "/user/lib64/python2.7/site-packages/qubes/moduels/000QubesVm.py", line 1958, in start nd.detach()
File "/usr/lib64lpython2.7/site-packages/libvert.py", line 5249, in detach
in ret == -1: raise libvertError ('verNodeDevicesDetach() failed')
libvert.libvertError: Requested operation is not valid: PCI device 0000:00:10.0 is in use by driver xenlight, domain sys-net
(Note I typed this, so there may be errors in the transcription)

If I shutdown the sys-net VM then sys-usb boots. Of course this also means that sys-net fails to boot with the same error message. Now when I attach a flash drive it automatically connects to sys-usb, instead of sys-net. How do I stop sys-net from trying to request driver access? As long as sys-usb is active, I am not able to boot any other VM. Everything fails silently.

> Did you mean "sys-usb" instead of "sys-net"? (If not, the description you've provided of your overall setup is inconsistent. Please clarify it.)

I did mean sys-net. When the sys-usb VM is not booted and I have attach a usb flash drive, I get a notification in the upper right hand corner saying "Attached new device to sys-net /dev/sda". If I exit all VM's and boot the sys-usb VM then it attaches to the sys-usb VM.

qvm-block -l gives:
sys-usb:sda Flash_Dis () 7 GiB
sys-usb:sda1 Flash_Disk (CHINA) 7 GiB.

I was mounting wrong... "sudo mount -t vfat /dev/sda1 /mnt/removable/" works (sda1 not sda). However, the folder is empty. I checked on my other laptop and the flash drive is neither empty nor broken.

Thanks for your help!

Andrew David Wong

unread,
Nov 26, 2016, 2:43:39 AM11/26/16
to zxe...@gmail.com, qubes-users
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On 11/25/16 23:26, zxe...@gmail.com wrote:
>> Have you changed the devices assigned to sys-usb? If so, it's possible you're running into a pci_strictreset issue here? Try running this in dom0 (but before you do, make sure you understand the risks [1]):
>>
>> $ qvm-prefs -s sys-usb pci_strictreset false
>>
>> Then try starting sys-usb again:
>>
>> $ qvm-start sys-usb
>>
>> Let us know if there are any useful error messages.
> I ran both and got:
> Traceback (most recent call last):
> File "/usr/bin/qvm-start", line 136, in <module>
> main()
> File "/usr/bin/qvm-start", line 120 in main
> xid = vm.start(verbose=options.verbose, preparing_dvm=options.preparing_dvm, start_guid=not options.noguid, notify_function=tray_notify_generic if options.tray else None)
> File "/usr/lib64/python2.7/site-packages/qubes/modules/005QubesNetVm.py", line 122 in start
> xid=super(QubesNetVm, self),start(**kwargs)
> File "/user/lib64/python2.7/site-packages/qubes/moduels/000QubesVm.py", line 1958, in start nd.detach()
> File "/usr/lib64lpython2.7/site-packages/libvert.py", line 5249, in detach
> in ret == -1: raise libvertError ('verNodeDevicesDetach() failed')
> libvert.libvertError: Requested operation is not valid: PCI device 0000:00:10.0 is in use by driver xenlight, domain sys-net
> (Note I typed this, so there may be errors in the transcription)
>

Thanks. For future reference, you can copy text out of dom0 like this:

https://www.qubes-os.org/doc/copy-from-dom0/#copying-from-dom0

> If I shutdown the sys-net VM then sys-usb boots. Of course this also means that sys-net fails to boot with the same error message. Now when I attach a flash drive it automatically connects to sys-usb, instead of sys-net. How do I stop sys-net from trying to request driver access? As long as sys-usb is active, I am not able to boot any other VM. Everything fails silently.
>
>> Did you mean "sys-usb" instead of "sys-net"? (If not, the description you've provided of your overall setup is inconsistent. Please clarify it.)
>
> I did mean sys-net. When the sys-usb VM is not booted and I have attach a usb flash drive, I get a notification in the upper right hand corner saying "Attached new device to sys-net /dev/sda". If I exit all VM's and boot the sys-usb VM then it attaches to the sys-usb VM.
>

Ah, it sounds like you have your USB controller assigned to both sys-net and sys-usb. In retrospect, this makes sense, since you described manually creating a USB qube even after the installer manually created one for you.

I'm not sure exactly what you're trying to achieve, but my recommendation would be to assign your USB controller to only one qube. Let's suppose you want it assigned to sys-usb. (This assumes that you're not using a USB Wi-Fi device, in which case you'll want to have a single sys-net that also functions as a USB qube, rather than having separate sys-net and sys-usb qubes.)

1. Shut down sys-net. (This will probably require shutting down most of your other VMs first.)
2. In Qubes Manager, right click on sys-net, then click "VM settings." Then, click the "Devices" tab.
3. On the right-hand side, select your USB controller(s), then click the "<" button, leaving only your network devices.
4. Reboot the whole system.

You should no longer run into the problem you described above.

> qvm-block -l gives:
> sys-usb:sda Flash_Dis () 7 GiB
> sys-usb:sda1 Flash_Disk (CHINA) 7 GiB.
>
> I was mounting wrong... "sudo mount -t vfat /dev/sda1 /mnt/removable/" works (sda1 not sda). However, the folder is empty. I checked on my other laptop and the flash drive is neither empty nor broken.
>

/mnt/removable is empty? Are you sure anything is actually mounted there?

- --
Andrew David Wong (Axon)
Community Manager, Qubes OS
https://www.qubes-os.org
-----BEGIN PGP SIGNATURE-----

iQIcBAEBCgAGBQJYOT0jAAoJENtN07w5UDAw70oP/A7Yu4kngpk6aoWx9b7NEzHq
xazY5K/aQIXIT9M5uMNvb7ui1md9Z90y7S9P9LSM4Tp8QVCcRFJ82sxpsbQej9Ib
eLZ+0YuejomX6RDk+1prlQxjn+HouvbTsJrBOfCdA9O1SZd1UuS4bc/dm3/cWO+l
qgUtxZGLMH/RoTK+z75OdBZjv6s5jCfAc1tw0Ynt6yrKR94O5aGRQhdjWdOF9Pbn
7CH2C1o4OEEWCbRX9PlsBZtv0Y4wPmbKvMhs6925PBmrcV1ZWar7JT9mWGXuf2Dz
1BmVw4RiFmOU7M1dFKaRVer5Y8jGhI43klr/B/ca3fzCf0BByc1610Rw50rhYwMS
0w1opl25DyjrAWT2r5SNUiddMIjExAZTT7cbwzmT55j9LPkUEy5Cy1uzvDxdrMeC
xsDRttgGDIsEdY6De1o0Y6YiZpoIeDWE/ZBTyr7apr2N3/ZJ1qI3G8GhFEW+60Hq
c/v9SOhce6oJygCRhUCQdB2YrMp4hgHlz600C1v3+v8m0Lh/rrx0UofdpOwnaoo2
5UoiW2j7+9Ob9Js1lElAQLjeTW23VE+dHNIbELt0sP1ZvyyYecvFTrUw7NuHICxs
pG0RAGHBvqM+HU/Sz0KrrOfDXjHshSOK3R8X1rIsMcIZdVJvCpGBGXaZj23NOKoi
FKcRRagPBt0XW2vqokPK
=FWdR
-----END PGP SIGNATURE-----

raah...@gmail.com

unread,
Dec 1, 2016, 1:11:09 AM12/1/16
to qubes-users, zxe...@gmail.com

ya I concur, just try deleting all sys-usb vms and then rerun qubesctl top.enable qvm.sys-usb and just use that for your usb controller(s)

I had run into the same problem before trying to switch the controller to another usbvm. didn't bother to do the strictset. Although that was back in 3.1 I thought things were supposed to be easier now. I think we can add single usb devices to diff vms. I haven't tried this. I hope soon will work for hvms as well if not yet.

raah...@gmail.com

unread,
Dec 1, 2016, 1:16:17 AM12/1/16
to qubes-users, zxe...@gmail.com, raah...@gmail.com

forgot there is another command after that one. qubesctl state.highstate https://www.qubes-os.org/doc/usb/

If your two usb ports next to the ps2 kb port are on a separate controller, you might want to keep those in dom0 just for your mouse and kb instead.

Reply all
Reply to author
Forward
0 new messages