Project

General

Profile

Actions

Bug #991

closed

Some USB drives are showing up as /dev/sdX without going through the USB handler.

Added by Hammel 11 months ago. Updated 5 months ago.

Status:
Closed
Priority:
Immediate
Assignee:
Target version:
Start date:
22 May 2023
Due date:
% Done:

100%

Estimated time:
Severity:
03 - Medium

Description

This means that they are not USB devices for some reason. /var/log/messages shows their mdev environment which should help debug this.

Actions #1

Updated by Hammel 6 months ago

  • Status changed from New to In Progress
  • % Done changed from 0 to 10

It's possible that real drives (not USB sticks) are showing up as sda. I need to test using the USB hub and both hard disks and USB sticks.
It doesn't matter which hardware I try this on, or rather it shouldn't matter. I should try it on a pi3 and pi4 at a minimum.

Actions #2

Updated by Hammel 6 months ago

  • % Done changed from 10 to 20

Plugged in a cheap, usb powered hard drive (aka MegaZ drive) that isn't a USB stick. This was not automounted by blockhandler.sh

Nov  2 23:53:45 (none) kern.info kernel: [  961.141417] usb 1-1.3: USB disconnect, device number 4
Nov  2 23:53:45 (none) kern.crit kernel: [  961.453143] hwmon hwmon1: Undervoltage detected!
Nov  2 23:53:45 (none) kern.info kernel: [  961.873076] usb 1-1.1.2: new high-speed USB device number 7 using dwc_otg
Nov  2 23:53:46 (none) kern.info kernel: [  962.084310] usb 1-1.1.2: New USB device found, idVendor=152d, idProduct=0583, bcdDevice= 2.09
Nov  2 23:53:46 (none) kern.info kernel: [  962.084360] usb 1-1.1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov  2 23:53:46 (none) kern.info kernel: [  962.084376] usb 1-1.1.2: Product: USB 3.0
Nov  2 23:53:46 (none) kern.info kernel: [  962.084388] usb 1-1.1.2: Manufacturer: Maxone
Nov  2 23:53:46 (none) kern.info kernel: [  962.084399] usb 1-1.1.2: SerialNumber: DD564198838A2
Nov  2 23:53:46 (none) kern.warn kernel: [  962.085347] usb 1-1.1.2: The driver for the USB controller dwc_otg_hcd does not support scatter-gather which is
Nov  2 23:53:46 (none) kern.warn kernel: [  962.085387] usb 1-1.1.2: required by the UAS driver. Please try an other USB controller if you wish to use UAS.
Nov  2 23:53:46 (none) kern.info kernel: [  962.085405] usb-storage 1-1.1.2:1.0: USB Mass Storage device detected
Nov  2 23:53:46 (none) kern.info kernel: [  962.087186] usb-storage 1-1.1.2:1.0: Quirks match for vid 152d pid 0583: 4000000
Nov  2 23:53:46 (none) kern.info kernel: [  962.087402] scsi host1: usb-storage 1-1.1.2:1.0
Nov  2 23:53:46 (none) kern.info kernel: [  962.183128] usb 1-1.3: new low-speed USB device number 8 using dwc_otg
Nov  2 23:53:46 (none) kern.info kernel: [  962.342551] usb 1-1.3: New USB device found, idVendor=258a, idProduct=0001, bcdDevice= 1.00
Nov  2 23:53:46 (none) kern.info kernel: [  962.342587] usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
Nov  2 23:53:46 (none) kern.info kernel: [  962.342603] usb 1-1.3: Product: USB KEYBOARD
Nov  2 23:53:46 (none) kern.info kernel: [  962.342615] usb 1-1.3: Manufacturer: SINO WEALTH
Nov  2 23:53:46 (none) kern.info kernel: [  962.361071] input: SINO WEALTH USB KEYBOARD as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.0/0003:258A:0001.0003/input/input3
Nov  2 23:53:46 (none) kern.info kernel: [  962.425472] hid-generic 0003:258A:0001.0003: input,hidraw0: USB HID v1.10 Keyboard [SINO WEALTH USB KEYBOARD] on usb-3f980000.usb-1.3/input0
Nov  2 23:53:46 (none) kern.info kernel: [  962.448234] input: SINO WEALTH USB KEYBOARD System Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.1/0003:258A:0001.0004/input/input4
Nov  2 23:53:46 (none) kern.info kernel: [  962.514868] input: SINO WEALTH USB KEYBOARD Consumer Control as /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.3/1-1.3:1.1/0003:258A:0001.0004/input/input5
Nov  2 23:53:46 (none) kern.info kernel: [  962.517726] hid-generic 0003:258A:0001.0004: input,hiddev96,hidraw1: USB HID v1.10 Device [SINO WEALTH USB KEYBOARD] on usb-3f980000.usb-1.3/input1
Nov  2 23:53:47 (none) kern.notice kernel: [  963.144042] scsi 1:0:0:0: Direct-Access     Maxone   USB 3.0          0209 PQ: 0 ANSI: 6
Nov  2 23:53:48 (none) kern.notice kernel: [  964.441781] sd 1:0:0:0: [sdb] 234441648 512-byte logical blocks: (120 GB/112 GiB)
Nov  2 23:53:48 (none) kern.notice kernel: [  964.442236] sd 1:0:0:0: [sdb] Write Protect is off
Nov  2 23:53:48 (none) kern.debug kernel: [  964.442255] sd 1:0:0:0: [sdb] Mode Sense: 47 00 00 08
Nov  2 23:53:48 (none) kern.notice kernel: [  964.442638] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
Nov  2 23:53:48 (none) kern.info kernel: [  964.465221]  sdb: sdb1
Nov  2 23:53:48 (none) kern.notice kernel: [  964.465793] sd 1:0:0:0: [sdb] Attached SCSI disk
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2472]:  DEVNAME: sdb
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2470]:  DEVNAME: sdb1
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2472]:  REALDEV: /dev/sdb
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2470]:  REALDEV: /dev/sdb1
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2472]:  DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/host1/target1:0:0/1:0:0:0/block/sdb
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2470]:  DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.1/1-1.1.2/1-1.1.2:1.0/host1/target1:0:0/1:0:0:0/block/sdb/sdb1
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2472]:  device /dev/sdb is not removable.
Nov  2 23:53:48 (none) user.notice blockhandler.sh[2470]:  device /dev/sdb1 is not removable.

If I plug in a USB stick, it looks like this.

Nov  2 23:56:46 (none) kern.crit kernel: [ 1142.425903] hwmon hwmon1: Undervoltage detected!
Nov  2 23:56:52 (none) kern.info kernel: [ 1148.655884] hwmon hwmon1: Voltage normalised
Nov  2 23:56:56 (none) kern.crit kernel: [ 1152.816022] hwmon hwmon1: Undervoltage detected!
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.695954] usb 1-1.2: new high-speed USB device number 9 using dwc_otg
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.842750] usb 1-1.2: New USB device found, idVendor=154b, idProduct=1006, bcdDevice= 1.10
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.842791] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.842808] usb 1-1.2: Product: USB 3.2.1 FD
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.842820] usb 1-1.2: Manufacturer: PNY
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.842831] usb 1-1.2: SerialNumber: 07082972EEAEDB15
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.843985] usb-storage 1-1.2:1.0: USB Mass Storage device detected
Nov  2 23:56:57 (none) kern.info kernel: [ 1153.852659] scsi host2: usb-storage 1-1.2:1.0
Nov  2 23:56:58 (none) kern.notice kernel: [ 1154.898712] scsi 2:0:0:0: Direct-Access     PNY      USB 3.2.1 FD     PMAP PQ: 0 ANSI: 6
Nov  2 23:56:58 (none) kern.notice kernel: [ 1154.901433] sd 2:0:0:0: [sdc] 60628992 512-byte logical blocks: (31.0 GB/28.9 GiB)
Nov  2 23:56:58 (none) kern.notice kernel: [ 1154.902608] sd 2:0:0:0: [sdc] Write Protect is off
Nov  2 23:56:58 (none) kern.debug kernel: [ 1154.902659] sd 2:0:0:0: [sdc] Mode Sense: 45 00 00 00
Nov  2 23:56:58 (none) kern.notice kernel: [ 1154.903658] sd 2:0:0:0: [sdc] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
Nov  2 23:56:59 (none) kern.info kernel: [ 1155.248944]  sdc: sdc1
Nov  2 23:56:59 (none) kern.notice kernel: [ 1155.249528] sd 2:0:0:0: [sdc] Attached SCSI removable disk
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2761]:  DEVNAME: sdc
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  DEVNAME: sdc1
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2761]:  REALDEV: /dev/sdc
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  REALDEV: /dev/sdc1
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/host2/target2:0:0/2:0:0:0/block/sdc/sdc1
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2761]:  DEVPATH: /devices/platform/soc/3f980000.usb/usb1/1-1/1-1.2/1-1.2:1.0/host2/target2:0:0/2:0:0:0/block/sdc
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2761]:  Trying to add sdc
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  Trying to add sdc1
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2761]:  testing /dev/sdc for filesystem
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  testing /dev/sdc1 for filesystem
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2761]:  /dev/sdc has no detectable filesystem
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  testing    ext4 against * * ext3
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  testing    ext4 against * * ext4
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  found entry * * ext4 rw for /dev/sdc1
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  /dev/sdc1: /media/usb/sdc1 options rw
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  trying automount of /dev/sdc1 at /media/usb/sdc1
Nov  2 23:56:59 (none) user.notice blockhandler.sh[2762]:  mount -o rw /dev/sdc1 /media/usb/sdc1
Nov  2 23:56:59 (none) kern.info kernel: [ 1155.831620] EXT4-fs (sdc1): mounted filesystem with ordered data mode. Quota mode: none.

The primary difference I see here is that blockhandler.sh says the hard drive is non-removable while it doesn't say that for the usb stick. That's the place to start looking for this issue.

Actions #3

Updated by Hammel 5 months ago

  • % Done changed from 20 to 30

Where the check for removable is done, test if MDEV is prefixed with "sd" and DEVPATH contains "usb" then just call mmc() (updated to handle sdx) or make a new function called sdx() to do basically what mmc() does.

Actions #4

Updated by Hammel 5 months ago

  • Status changed from In Progress to Closed
  • % Done changed from 30 to 100

The non-USB sticks still have the removable file under sysfs, but the value is 0 instead of 1. So in those cases we check if it's an /dev/sdX device under a usb path. If so, we try to mount it anyway.

This could really be reduced to just say that if the removable file is there, try to mount it no matter what the contents of the removable file is. But I didn't do it that way for now.

Code tested on hardware. Committed and pushed.

Closing issue.

Actions

Also available in: Atom PDF