[WorksForMe] USB 3.0 SD Card Reader Unmounted Randomly

Discussions related to using VirtualBox on Windows hosts.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

[WorksForMe] USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Hello,
I am seeing my USB 3.0 SD card reader unmount randomly while using it in an Ubuntu 16LTS guest on a Windows 10 host.
I have tried using a filter with only Vendor ID and Product ID.
I have tried not using a filter and attaching using Devices->USB->Kingston... while the VM is running.
I have tried both of the above also because after the SD Card unmounts when mounted by the filter I then remount using Devices. Both cases have the same result. SD Card stays mounted for a minute or three. Then unmounts. Using Devices->USB->Kingston...

Host specs: Windows 10 Enterprise, Version 1703, OS Build 15063.608

Guest Specs: Linux 4.10.0-42-generic #46~16.04.1-Ubuntu SMP Mon Dec 4 15:57:59 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux, Ubuntu 16.04.3 LTS, XCFE version 4.12 from Xubuntu

VBox Specs: Version 5.1.28 r117968 (Qt5.6.2)

Card reader: Kingston FCR-HS3

SD Card: SanDisk Ultra 32GB SDHC Micro
Last edited by socratis on 19. Dec 2017, 17:45, edited 1 time in total.
Reason: Marked as [WorksForMe].
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by mpack »

Try accessing the drive as a shared folder.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by socratis »

Besides the solution/workaround that mpack has offered you, I'd like to know why there's a failure in the USB front (if any). So, please read the following FAQ: USB basics and troubleshooting, all of the posts.

I would like to see some information with the use of the USB filters. So, create a filter, and if you still have a problem after reading through the whole FAQ, please provide the information requested in the last post. No need to repeat information already provided in your first post.

And finally, besides that basic USB information asked before, I would like to see a "VBox.log.zip" from a complete run for the VM:
  • Start the VM from cold-boot (not from a paused or saved state) / Observe error / Shutdown the VM.
  • With the VM completely shut down (not paused or saved), right-click on the VM in the VirtualBox Manager and select "Show Log".
  • Save only the first "VBox.log", ZIP it and attach it to your response (see the "Upload attachment" tab below the reply form).
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

mpack wrote:Try accessing the drive as a shared folder.
Hi mpack,
I do not know how to do this. Windows does not see the drive correctly for some reason. So I can't navigate to it and add it as a shared folder. I will try this with another SD Card today.

Update: the cards are not visible to windows without formatting them.

Update: I added the drive without windows being able to view it (without formatting). I get this error message:
The shared folder 'H_DRIVE' could not be set up: Shared folder path 'H:\' does not exist on the host.
The shared folder setup will not be complete. It is recommended to power down the virtual machine and fix the shared folder settings while the machine is not running.
Error ID:
BrokenSharedFolder
Severity:
Warning


But so far the SD Card drive is staying mounted. The card has multiple partitions so I need to add them all separately I think.

Update: I added both partitions. Both seem to be staying mounted as shared folders.

Update: Added both partitions as shared folders with full read write permissions, seems to be working consistently now.
Last edited by nth on 14. Dec 2017, 17:07, edited 1 time in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by mpack »

You can't share a host folder that doesn't exist. And if the Windows host can't see the drive then you probably have some fundamental issues to work out.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Windows sees the drives but cannot navigate because of the formatting, fat32 and ext4.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Unfortunately, The drives are no longer read/write, they are read only. I am using gparted in Ubuntu VM. I can no longer repartition or manipulate the drives if they are shared folders. So the shared folders solution works if I only want to read the drives, but usually I will need to write and manipulate partitions.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Update again: If I unmount within Ubuntu file manager, the partitions are no longer locked in gparted, and are available as read/write in gparted temporarily. However, the random unmounting occurs again, so the partitions or drive are no longer accessible in the VM.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Correction: The shared folders idea does not work at all. I forgot to remove the USB filter. My mistake.

Actually it works for the fat32 partition but does not for the ext4 partition.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Trying to mount ext4 partition gives the following error:
$ sudo mount -t vboxsf I_DRIVE rootfs
/sbin/mount.vboxsf: mounting failed with the error: Protocol error
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

Clarification:
The fat32 partition is view-able and navigable in windows. The ext4 partition is not.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

socratis wrote:Besides the solution/workaround that mpack has offered you, I'd like to know why there's a failure in the USB front (if any). So, please read the following FAQ:
I will work on this later today.
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

socratis wrote: I would like to see some information with the use of the USB filters. So, create a filter, and if you still have a problem after reading through the whole FAQ, please provide the information requested in the last post. No need to repeat information already provided in your first post.

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage -version
5.1.28r117968
C:\Program Files\Oracle\VirtualBox>VBoxManage list extpacks
Extension Packs: 1
Pack no. 0:   Oracle VM VirtualBox Extension Pack
Version:      5.1.28
Revision:     117968
Edition:
Description:  USB 2.0 and USB 3.0 Host Controller, Host Webcam, VirtualBox RDP, PXE ROM, Disk Encryption, NVMe.
VRDE Module:  VBoxVRDP
Usable:       true
Why unusable:

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage list usbhost
Host USB Devices:

UUID:               958b1cf9-9902-41ec-8435-535d8023ffbb
VendorId:           0x1bcf (1BCF)
ProductId:          0x2b96 (2B96)
Revision:           104.37 (10437)
Port:               0
USB version/speed:  2/High
Manufacturer:       Sunplus Innovation Technology Inc.
Address:            {36fc9e60-c465-11cf-8056-444553540000}\0003
Current State:      Busy

UUID:               0a8b29c2-2edb-4233-982a-9d4c91037fa7
VendorId:           0x11b0 (11B0)
ProductId:          0x6348 (6348)
Revision:           1.49 (0149)
Port:               0
USB version/speed:  3/Super
Manufacturer:       Kingston
Product:            USB3.0 Media Reader
SerialNumber:       08735332512072
Address:            {36fc9e60-c465-11cf-8056-444553540000}\0010
Current State:      Unavailable

UUID:               87dacf2f-28df-45bb-b4fd-3a32adf99121
VendorId:           0x0cf3 (0CF3)
ProductId:          0xe007 (E007)
Revision:           0.1 (0001)
Port:               0
USB version/speed:  2/High
Manufacturer:       Qualcomm Atheros Communications
Address:            {e0cbf06c-cd8b-4647-bb8a-263b43f0f974}\0000
Current State:      Busy

UUID:               bce968e5-1c0a-4514-8da2-e75e8c002b4b
VendorId:           0x046d (046D)
ProductId:          0xc31c (C31C)
Revision:           100.0 (10000)
Port:               0
USB version/speed:  1/Full
Manufacturer:       Logitech
Product:            USB Keyboard
Address:            {36fc9e60-c465-11cf-8056-444553540000}\0020
Current State:      Busy

UUID:               75a06eb8-38a7-495f-bc97-4b57a176d36f
VendorId:           0x046d (046D)
ProductId:          0xc05a (C05A)
Revision:           99.0 (9900)
Port:               0
USB version/speed:  2/High
Manufacturer:       Logitech
Product:            USB Optical Mouse
Address:            {745a17a0-74d3-11d0-b6fe-00a0c90f57da}\0010
Current State:      Busy

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage list usbfilters
Global USB Device Filters:
<none>

Code: Select all

C:\Program Files\Oracle\VirtualBox>VBoxManage showvminfo Ubuntu-16-LTS-64
Name:            Ubuntu-16-LTS-64
Groups:          /
Guest OS:        Ubuntu (64-bit)
UUID:            90442002-5745-4301-b5ff-361f9b9d52ec
Config file:     C:\Users\nholder\VirtualBox VMs\Ubuntu-16-LTS-64\Ubuntu-16-LTS-64.vbox
Snapshot folder: C:\Users\nholder\VirtualBox VMs\Ubuntu-16-LTS-64\Snapshots
Log folder:      C:\Users\nholder\VirtualBox VMs\Ubuntu-16-LTS-64\Logs
Hardware UUID:   90442002-5745-4301-b5ff-361f9b9d52ec
Memory size:     8192MB
Page Fusion:     off
VRAM size:       128MB
CPU exec cap:    100%
HPET:            off
Chipset:         piix3
Firmware:        BIOS
Number of CPUs:  4
PAE:             off
Long Mode:       on
Triple Fault Reset: off
APIC:            on
X2APIC:          on
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode:  message and menu
Boot Device (1): HardDisk
Boot Device (2): Not Assigned
Boot Device (3): Not Assigned
Boot Device (4): Not Assigned
ACPI:            on
IOAPIC:          on
BIOS APIC mode:  APIC
Time offset:     0ms
RTC:             UTC
Hardw. virt.ext: on
Nested Paging:   on
Large Pages:     on
VT-x VPID:       on
VT-x unr. exec.: on
Paravirt. Provider: Default
Effective Paravirt. Provider: KVM
State:           powered off (since 2017-12-15T17:55:04.000000000)
Monitor count:   1
3D Acceleration: off
2D Video Acceleration: off
Teleporter Enabled: off
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: off
Allow Tracing to Access VM: off
Tracing Configuration:
Autostart Enabled: off
Autostart Delay: 0
Default Frontend:
Storage Controller Name (0):            IDE
Storage Controller Type (0):            PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0):  2
Storage Controller Port Count (0):      2
Storage Controller Bootable (0):        on
Storage Controller Name (1):            SATA
Storage Controller Type (1):            IntelAhci
Storage Controller Instance Number (1): 0
Storage Controller Max Port Count (1):  30
Storage Controller Port Count (1):      1
Storage Controller Bootable (1):        on
IDE (1, 0): Empty
SATA (0, 0): C:\Users\nholder\VirtualBox VMs\Ubuntu-16-LTS-64\Ubuntu-16-LTS-64-disk1.vdi (UUID: 395dbb91-751f-43b3-842d-1bf826757888)
NIC 1:           MAC: 080027510C48, Attachment: Bridged Interface 'Intel(R) Ethernet Connection (5) I219-LM', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2:           disabled
NIC 3:           disabled
NIC 4:           disabled
NIC 5:           disabled
NIC 6:           disabled
NIC 7:           disabled
NIC 8:           disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1:          disabled
UART 2:          disabled
UART 3:          disabled
UART 4:          disabled
LPT 1:           disabled
LPT 2:           disabled
Audio:           enabled (Driver: DSOUND, Controller: AC97, Codec: AD1980)
Clipboard Mode:  Bidirectional
Drag and drop Mode: Bidirectional
VRDE:            disabled
USB:             disabled
EHCI:            disabled
XHCI:            enabled
USB Device Filters:
Index:            0
Active:           yes
Name:             kingston card reader
VendorId:         11b0
ProductId:        6348
Revision:
Manufacturer:
Product:
Remote:           0
Serial Number:
Bandwidth groups:  <none>
Shared folders:
Name: 'UbuntuShared', Host path: 'C:\Users\nholder\Desktop\UbuntuShared' (machine mapping), writable
Name: 'H_DRIVE', Host path: 'H:\' (machine mapping), writable
Name: 'I_DRIVE', Host path: 'I:\' (machine mapping), writable
Video capturing:    not active
Capture screens:    0
Capture file:       C:\Users\nholder\VirtualBox VMs\Ubuntu-16-LTS-64\Ubuntu-16-LTS-64.webm
Capture dimensions: 1024x768
Capture rate:       512 kbps
Capture FPS:        25
Guest:
Configured memory balloon size:      0 MB
Last edited by socratis on 15. Dec 2017, 23:23, edited 1 time in total.
Reason: Enclosed the information in [code] tag for better readability
nth
Posts: 14
Joined: 13. Dec 2017, 23:49

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by nth »

socratis wrote:And finally, besides that basic USB information asked before, I would like to see a "VBox.log.zip" from a complete run for the VM:
  • Start the VM from cold-boot (not from a paused or saved state) / Observe error / Shutdown the VM.
  • With the VM completely shut down (not paused or saved), right-click on the VM in the VirtualBox Manager and select "Show Log".
  • Save only the first "VBox.log", ZIP it and attach it to your response (see the "Upload attachment" tab below the reply form).
Attachments
Ubuntu-16-LTS-64-2017-12-15-13-06-20.zip
(27.67 KiB) Downloaded 13 times
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: USB 3.0 SD Card Reader Unmounted Randomly

Post by socratis »

nth wrote:
Manufacturer:       Kingston
Product:            USB3.0 Media Reader
...
Current State:      Unavailable
The "Unavailable" part hints at something else actively using the device, most probably your OS. As for the log, there's only one reference at the beginning, and then nothing. This actually may be normal, I'm just including it for completion:
00:00:08.267137 VUSB: HidMouse: reset request is ignored, the device is already resetting!
00:00:08.267160 VUSB: 000000000a9c5400[proxy 11b0:6348]: reset request is ignored, the device is already resetting!
00:00:08.267165 VUSB: 000000000a9c5400[proxy 11b0:6348]: reset request is ignored, the device is already resetting!
00:00:08.267193 xHCI: root hub-attached device reset completed with VINF_SUCCESS
But, your post gave me the opportunity to test something that I've always wanted to; the "usbcardreader" option. I was wondering how that thing might work (see SD Card not recognized, after the "Entering in the unknown territory..."), but I didn't have an SD card reader at the moment to test my theory. Well, now I do, plus I have an Ubuntu 16.04 guest to test it on... ;)
  • The heart of the whole operation is in the "/src/VBox/Main/src-client/UsbCardReader.cpp" for you code junkies out there. It hasn't been essentially modified since 2016-08-10, so its latest incarnation should be included after 5.0.28, 5.1.6 and of course 5.2.x.
  • Since you're using Win10 as your host, I would urge to to update to the latest 5.2.2 (as of this writing), but please try it with your currently installed 5.1.28 first.
  • With the VM completely shut down, start by issuing the command:
    • VBoxManage modifyvm "<Your_VM_name>" --usbcardreader on
  • Launch the VM and verify that the card reader is seen:
    • $ lsusb
      Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
      Bus 001 Device 003: ID 80ee:0021 VirtualBox USB Tablet
      Bus 001 Device 002: ID 04e6:5115 SCM Microsystems, Inc. SCR335 SmartCard Reader
      Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
  • Add a USB filter, keeping only the VendorID and ProductID (and optionally a recognizable Name). You already have a filter setup, so you're good to go.
  • Launch the VM. On my OSX host, it complained that I didn't eject the HD that I had mounted, but it seemed to work nonetheless. As soon as I logged in, the card showed 1) as an icon in my sidebar, 2) as a "/dev/sdb1" after a "df", and 3) as mounted in "/home/socratis/SD".
  • Related entries in my "VBox.log", mainly for the VBox.log analyzers:

    Code: Select all

    00:00:01.375386 [/USB/] (level 1)
    00:00:01.375387 
    00:00:01.375387 [/USB/CardReader/] (level 2)
    00:00:01.375388 
    00:00:01.375388 [/USB/CardReader/0/] (level 3)
    00:00:01.375389 
    00:00:01.375389 [/USB/CardReader/0/Config/] (level 4)
    00:00:01.375390 
    00:00:01.375390 [/USB/CardReader/0/LUN#0/] (level 4)
    00:00:01.375392   Driver <string>  = "UsbCardReader" (cb=14)
    00:00:01.375392 
    00:00:01.375393 [/USB/CardReader/0/LUN#0/Config/] (level 5)
    00:00:01.375394   Object <integer> = 0x00007fc29bebdc60 (140 473 816 308 832)
    ...
    00:00:01.486356 VUSB: Attached 'CardReader' to port 1 on RootHub#1 (FullSpeed)
    00:00:01.486426 VUSB: Attached 'HidMouse' to port 2 on RootHub#1 (FullSpeed)
    ...
    00:00:03.112315 VUSB: Attached '00007fc29de0ad00[proxy 05ac:8406]' to port 1 on RootHub#0 (SuperSpeed)
    ...
    00:00:06.885713 VUSB: CardReader: reset request is ignored, the device is already resetting!
    00:00:06.885727 VUSB: HidMouse: reset request is ignored, the device is already resetting!
    00:00:06.885731 VUSB: 00007fc29de0ad00[proxy 05ac:8406]: reset request is ignored, the device is already resetting!
    00:00:06.885735 VUSB: 00007fc29de0ad00[proxy 05ac:8406]: reset request is ignored, the device is already resetting!
    00:00:06.887640 xHCI: USB Operational
    ...
    00:00:07.328289 USBSMARTCARDREADER: ignored request 0x80 0x06 0x0600 0x0000 10, cb 18
    00:00:07.328478 USBSMARTCARDREADER: ignored request 0x80 0x06 0x0600 0x0000 10, cb 18
    00:00:07.328596 USBSMARTCARDREADER: ignored request 0x80 0x06 0x0600 0x0000 10, cb 18
    ...
    
    
So, try that "usbcardreader" option and see if it gets you anywhere. I do not have a readily available Win10 host with an SD reader, but I will try it next time that I boot my MBPr with its Win10 personality...
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply