storaged-project / udisks

The UDisks project provides a daemon, tools and libraries to access and manipulate disks, storage devices and technologies.
http://storaged.org/doc/udisks2-api/latest/
Other
341 stars 143 forks source link

Cannot mount filesystem in a DS213 with udisks #826

Closed eduardosm closed 3 years ago

eduardosm commented 3 years ago

The DS213 is a pocket oscilloscope with a small (8M) flash memory that can be accessed from the computer through USB.

After plugin the device to the computer, a new block device appears (let's say it is /dev/sdc), an lsblk lists it as:

sdc                                             8:32   1     8M  0 disk

The device contains a FAT partition (without partition table). However, it is not possible to mount it with udisks.

For example,

udisksctl mount -b /dev/sdc

produces

Object /org/freedesktop/UDisks2/block_devices/sdc is not a mountable filesystem.

The file system can be mounted successfully with the mount command. On windows it is correctly detected like any other USB storage device.

Other USB storage devices can be mounter with udisks without issues.

More information

udisks version: 2.9.1

journalctl -u udisks2.service does not show anything related to that device.

Using a dbus debugger, /org/freedesktop/UDisks2/block_devices/sdc has the org.freedesktop.UDisks2.Block interface, but not org.freedesktop.UDisks2.Filesystem (as said before, there is a valid FAT filesystem that can be mounted with mount).

The device is listed by lsusb -v as

Bus 001 Device 059: ID 0483:5720 STMicroelectronics Mass Storage Device
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0483 STMicroelectronics
  idProduct          0x5720 Mass Storage Device
  bcdDevice            2.00
  iManufacturer           1 STMicroelectronics
  iProduct                2 STM32 Mass Storage
  iSerial                 3 7ÿÙRY14&b   Q
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              4 ST Mass
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               0
can't get device qualifier: Resource temporarily unavailable
can't get debug descriptor: Resource temporarily unavailable
Device Status:     0x0001
  Self Powered

fsck.vfat produces the following output:

fsck.fat 4.1 (2017-01-24)
Checking we can access the last sector of the filesystem
Boot sector contents:
System ID "MSDOS5.0"
Media byte 0xf8 (hard disk)
      4096 bytes per logical sector
      4096 bytes per cluster
         1 reserved sector
First FAT starts at byte 4096 (sector 1)
         2 FATs, 12 bit entries
      4096 bytes per FAT (= 1 sectors)
Root directory starts at byte 12288 (sector 3)
       512 root directory entries
Data area starts at byte 28672 (sector 7)
      2041 data clusters (8359936 bytes)
1 sectors/track, 1 heads
         0 hidden sectors
      2048 sectors total
Starting check/repair pass.
Checking for unused clusters.
Starting verification pass.
Checking for unused clusters.
/dev/sdc: 6 files, 38/2041 clusters

After connecting the device, dmesg shows:

usb 1-1: new full-speed USB device number 60 using xhci_hcd
usb 1-1: New USB device found, idVendor=0483, idProduct=5720, bcdDevice= 2.00
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: STM32 Mass Storage
usb 1-1: Manufacturer: STMicroelectronics
usb 1-1: SerialNumber: 7ÿÙ\x05RY14&b    Q
usb-storage 1-1:1.0: USB Mass Storage device detected
scsi host6: usb-storage 1-1:1.0
vojtechtrefny commented 3 years ago

Can you also please provide output of udisksctl info -b /dev/sdc and udevadm info /dev/sdc, thanks.

eduardosm commented 3 years ago
udisksctl info -b /dev/sdc
/org/freedesktop/UDisks2/block_devices/sdc:
  org.freedesktop.UDisks2.Block:
    Configuration:              []
    CryptoBackingDevice:        '/'
    Device:                     /dev/sdc
    DeviceNumber:               2080
    Drive:                      '/org/freedesktop/UDisks2/drives/MiniWare_8MB_Disk_MiniWare_8MB_Disk_0_3a0'
    HintAuto:                   true
    HintIconName:               
    HintIgnore:                 false
    HintName:                   
    HintPartitionable:          true
    HintSymbolicIconName:       
    HintSystem:                 false
    Id:                         
    IdLabel:                    
    IdType:                     
    IdUUID:                     
    IdUsage:                    
    IdVersion:                  
    MDRaid:                     '/'
    MDRaidMember:               '/'
    PreferredDevice:            /dev/sdc
    ReadOnly:                   false
    Size:                       8388608
    Symlinks:                   /dev/disk/by-id/usb-MiniWare_8MB_Disk-0:0
                                /dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0
    UserspaceMountOptions:      
udevadm info /dev/sdc
P: /devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0/block/sdc
N: sdc
L: 0
S: disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0
S: disk/by-id/usb-MiniWare_8MB_Disk-0:0
E: DEVPATH=/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1:1.0/host6/target6:0:0/6:0:0:0/block/sdc
E: DEVNAME=/dev/sdc
E: DEVTYPE=disk
E: MAJOR=8
E: MINOR=32
E: SUBSYSTEM=block
E: USEC_INITIALIZED=1167159068109
E: ID_VENDOR=MiniWare
E: ID_VENDOR_ENC=MiniWare
E: ID_VENDOR_ID=0483
E: ID_MODEL=8MB_Disk
E: ID_MODEL_ENC=8MB_Disk\x20\x20\x20\x20\x20\x20\x20\x20
E: ID_MODEL_ID=5720
E: ID_REVISION=0200
E: ID_SERIAL=MiniWare_8MB_Disk-0:0
E: ID_TYPE=disk
E: ID_INSTANCE=0:0
E: ID_BUS=usb
E: ID_USB_INTERFACES=:080650:
E: ID_USB_INTERFACE_NUM=00
E: ID_USB_DRIVER=usb-storage
E: ID_PATH=pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0
E: ID_PATH_TAG=pci-0000_00_14_0-usb-0_1_1_0-scsi-0_0_0_0
E: DEVLINKS=/dev/disk/by-path/pci-0000:00:14.0-usb-0:1:1.0-scsi-0:0:0:0 /dev/disk/by-id/usb-MiniWare_8MB_Disk-0:0
E: TAGS=:systemd:

I can also post a raw dump of the block device: raw_dump.zip

eduardosm commented 3 years ago

If I write the raw dump into another USB flash drive, the file system is detected by udisks.

vojtechtrefny commented 3 years ago

I tested the image with a loop device and it also works. The problem is somewhere in UDev -- your udevadm info output is missing filesystem information, so we think there is no filesystem on sdc. It works correctly with the loop device, this is what I get from the loop device:

E: ID_FS_VERSION=FAT12
E: ID_FS_TYPE=vfat
E: ID_FS_USAGE=filesystem

What does blkid -p /dev/sdc --output udev returns? If it shows filesystem information, it's UDev problem (systemd), if not it's (lib)blkid problem (util-linux).

eduardosm commented 3 years ago

There isn't any output, so it seems it is a blkid issue.

tbzatek commented 3 years ago

Closing for the time being as that's an external issue. Feel free to reopen once the blkid issue is fixed yet UDisks still couldn't detect any filesystem.