Bug 216282 - usb-mass storage
Summary: usb-mass storage
Status: RESOLVED ANSWERED
Alias: None
Product: Drivers
Classification: Unclassified
Component: USB (show other bugs)
Hardware: All Linux
: P1 high
Assignee: Default virtual assignee for Drivers/USB
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-07-25 22:39 UTC by JuanPC2018
Modified: 2022-07-30 02:45 UTC (History)
0 users

See Also:
Kernel Version: 5.15.0-41-generic
Subsystem:
Regression: No
Bisected commit-id:


Attachments
monout.txt.zip (94.79 KB, application/zip)
2022-07-29 18:39 UTC, JuanPC2018
Details

Description JuanPC2018 2022-07-25 22:39:01 UTC
since Groovy Gorilla, maybe older...

problem #1.
 usb mass storage,
delay time is too fast, and there is No .conf in /modprobe.d
i have to unplug and plug again the external usb hdd cable turned-on
so Linux can detect the HDD and mount.

ASM1051 is detected with $ lsusb
when i turn-on, 
but the HDD is Not Detected, because delay time is too fast/short.
its like turning-on without a HDD.

upgraded the firmware of the external USB IC controller to latest.
https://github.com/juanpc2018/Asmedia-AS2105-sata-to-USB-3

because large HDDs "over 2TB" was Not working,
Now works ok exept that problem in Linux.
Windows8.1x64 works OK.

problem #2.
Linux detects a different speed?.
$ lsusb
Bus 002 Device 004: ID 174c:5106 ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge

is Not 3Gb/s = 375MB/s.
is 5Gb/s = 550MB/s
when used with SSD,
large 18TB HDD are 250MB/s.

there is something strange going on with usb-mass-storage.

https://support.apple.com/kb/SP710?locale=en_US
Comment 1 Alan Stern 2022-07-26 01:20:08 UTC
What delay time are you referring to?

What speed does Linux detect?

What does "lsusb -v" show for this drive?

What shows up in the dmesg log when the HDD is detected and when it is not detected?

In your lsusb output, where it says "ASM1051 SATA 3Gb/s bridge", that 3Gb/s speed is not what Linux detects; it is part of the device's product name.
Comment 2 JuanPC2018 2022-07-26 02:49:16 UTC
Detected but No HDD:

$ lsusb -v

Bus 002 Device 009: ID 174c:5106 ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x174c ASMedia Technology Inc.
  idProduct          0x5106 ASM1051 SATA 3Gb/s bridge
  bcdDevice            1.00
  iManufacturer           2 Thermaltake
  iProduct                3 BlacX
  iSerial                 1 000000000002
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x002c
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15

-------------

Detected with HDD:

$ lsusb -v

Bus 002 Device 010: ID 174c:5106 ASMedia Technology Inc. ASM1051 SATA 3Gb/s bridge
Couldn't open device, some information will be missing
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               3.00
  bDeviceClass            0 
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0         9
  idVendor           0x174c ASMedia Technology Inc.
  idProduct          0x5106 ASM1051 SATA 3Gb/s bridge
  bcdDevice            1.00
  iManufacturer           2 Thermaltake
  iProduct                3 BlacX
  iSerial                 1 000000000002
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x002c
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xc0
      Self Powered
    MaxPower                0mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass         8 Mass Storage
      bInterfaceSubClass      6 SCSI
      bInterfaceProtocol     80 Bulk-Only
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0400  1x 1024 bytes
        bInterval               0
        bMaxBurst              15
Comment 3 JuanPC2018 2022-07-26 03:07:35 UTC
When you Turn-on the USB3.0 to SATA controller,
electrons travel near the speed of light.

Kernel interupts the CPU very fast, betwenn 1GHz and 2.8Ghz
to detect & load drivers.

BUT... the Mechanical HDD needs time to spin-up, when is turned-on,
time to reach operating speed of 7200rpm,
Large 3.5" HDD eat more than 3Amps at 12volts dc to spin-up.

USB Mass Storage Needs a Delay, an interrupt wait to read from the controller,
wait to initialize, until HDD had enough time to spin-up and read basic info, like Name, File system, etc...

Like the Turtle vs. Rabbit Tale.

-------------


$ sudo dmesg | grep usb

[93862.823187] usb 2-2: new SuperSpeed USB device number 4 using xhci_hcd
[93862.844103] usb 2-2: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[93862.844109] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[93862.844111] usb 2-2: Product: BlacX
[93862.844113] usb 2-2: Manufacturer: Thermaltake
[93862.844114] usb 2-2: SerialNumber: 000000000002
[93862.881811] usb-storage 2-2:1.0: USB Mass Storage device detected
[93862.881944] scsi host2: usb-storage 2-2:1.0
[93862.882037] usbcore: registered new interface driver usb-storage
[93862.885157] usbcore: registered new interface driver uas
[93887.950491] usb 2-2: reset SuperSpeed USB device number 4 using xhci_hcd
[94392.705178] usb 2-2: USB disconnect, device number 4
[94397.329093] usb 2-4: new SuperSpeed USB device number 5 using xhci_hcd
[94397.350234] usb 2-4: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[94397.350246] usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[94397.350252] usb 2-4: Product: BlacX
[94397.350255] usb 2-4: Manufacturer: Thermaltake
[94397.350259] usb 2-4: SerialNumber: 000000000002
[94397.353440] usb-storage 2-4:1.0: USB Mass Storage device detected
[94397.353565] scsi host2: usb-storage 2-4:1.0
[94405.460664] usb 2-2: new SuperSpeed USB device number 6 using xhci_hcd
[94405.481472] usb 2-2: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[94405.481478] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[94405.481481] usb 2-2: Product: BlacX
[94405.481483] usb 2-2: Manufacturer: Thermaltake
[94405.481484] usb 2-2: SerialNumber: 000000000001
[94405.483318] usb-storage 2-2:1.0: USB Mass Storage device detected
[94405.483606] scsi host3: usb-storage 2-2:1.0
[94845.006638] usb 2-2: USB disconnect, device number 6
[94857.034440] usb 2-4: USB disconnect, device number 5
[96252.135710] usb 2-2: new SuperSpeed USB device number 7 using xhci_hcd
[96252.156665] usb 2-2: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[96252.156679] usb 2-2: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[96252.156685] usb 2-2: Product: BlacX
[96252.156689] usb 2-2: Manufacturer: Thermaltake
[96252.156693] usb 2-2: SerialNumber: 000000000001
[96252.160248] usb-storage 2-2:1.0: USB Mass Storage device detected
[96252.160387] scsi host2: usb-storage 2-2:1.0
[96618.800360] usb 2-2: USB disconnect, device number 7
[96643.705966] usb 2-3.1: new SuperSpeed USB device number 8 using xhci_hcd
[96643.726865] usb 2-3.1: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[96643.726872] usb 2-3.1: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[96643.726874] usb 2-3.1: Product: BlacX
[96643.726876] usb 2-3.1: Manufacturer: Thermaltake
[96643.726877] usb 2-3.1: SerialNumber: 000000000001
[96643.731430] usb-storage 2-3.1:1.0: USB Mass Storage device detected
[96643.731717] scsi host2: usb-storage 2-3.1:1.0
[97775.098841] usb 2-3.1: USB disconnect, device number 8
[97789.264277] usb 1-1.4: USB disconnect, device number 14
[109374.033610] usb 2-4: new SuperSpeed USB device number 9 using xhci_hcd
[109374.054547] usb 2-4: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[109374.054561] usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[109374.054567] usb 2-4: Product: BlacX
[109374.054571] usb 2-4: Manufacturer: Thermaltake
[109374.054575] usb 2-4: SerialNumber: 000000000002
[109374.056168] usb-storage 2-4:1.0: USB Mass Storage device detected
[109374.056547] scsi host2: usb-storage 2-4:1.0
[109399.212614] usb 2-4: reset SuperSpeed USB device number 9 using xhci_hcd
[109516.959732] usb 2-4: USB disconnect, device number 9
[109519.055610] usb 2-4: new SuperSpeed USB device number 10 using xhci_hcd
[109519.076525] usb 2-4: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
[109519.076540] usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
[109519.076545] usb 2-4: Product: BlacX
[109519.076550] usb 2-4: Manufacturer: Thermaltake
[109519.076554] usb 2-4: SerialNumber: 000000000002
[109519.078216] usb-storage 2-4:1.0: USB Mass Storage device detected
[109519.078505] scsi host2: usb-storage 2-4:1.0
Comment 4 JuanPC2018 2022-07-26 03:13:55 UTC
Serial number 00001,
its the same enclosure type TT BlacX, i have 2 same,
but 0001 has an SSD Crucial MX500
reads 440MB/s
using gnone-disks benchmark
because its a cheap TLC, but Not as cheap as the BX500 with No ram.

serial 0002 has the mechanical 3.5" HDD.
Comment 5 JuanPC2018 2022-07-26 03:41:27 UTC
[110025.067097] usb 2-4: USB disconnect, device number 10
Comment 6 JuanPC2018 2022-07-26 04:04:58 UTC
Similar:
https://superuser.com/questions/1206664/disable-mtp-udev-rules-for-specific-device-so-it-can-be-mount-as-a-usb-mass-stor

No HDD:

$ journalctl -fe

Jul 25 22:52:29 P- kernel: usb 2-4: new SuperSpeed USB device number 11 using xhci_hcd
Jul 25 22:52:29 P- kernel: usb 2-4: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
Jul 25 22:52:29 P- kernel: usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
Jul 25 22:52:29 P- kernel: usb 2-4: Product: BlacX
Jul 25 22:52:29 P- kernel: usb 2-4: Manufacturer: Thermaltake
Jul 25 22:52:29 P- kernel: usb 2-4: SerialNumber: 000000000002
Jul 25 22:52:29 P- kernel: usb-storage 2-4:1.0: USB Mass Storage device detected
Jul 25 22:52:29 P- kernel: scsi host2: usb-storage 2-4:1.0
Jul 25 22:52:29 P- mtp-probe[247971]: checking bus 2, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-4"
Jul 25 22:52:29 P- mtp-probe[247971]: bus: 2, device: 11 was not an MTP device
Jul 25 22:52:29 P- systemd-udevd[247970]: 2-4:1.0: Process '/usr/lib/snapd/snap-device-helper bind snap_remmina_remmina /devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4:1.0 0:0' failed with exit code 1.
Jul 25 22:52:29 P- mtp-probe[247990]: checking bus 2, device 11: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-4"
Jul 25 22:52:29 P- mtp-probe[247990]: bus: 2, device: 11 was not an MTP device
Jul 25 22:52:29 P- systemd-udevd[247970]: 2-4: Process '/usr/lib/snapd/snap-device-helper bind snap_remmina_remmina /devices/pci0000:00/0000:00:14.0/usb2/2-4 189:138' failed with exit code 1.

Jul 25 22:52:36 P- smartd[1378]: Device: /dev/sda [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 71 to 72
Jul 25 22:52:36 P- smartd[1378]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 73 to 75

Jul 25 22:52:44 P- NetworkManager[1318]: <info>  [1658807564.5537] dhcp4 (enp3s0f0): state changed new lease, address=192.168.0.00

Jul 25 22:52:54 P- kernel: usb 2-4: reset SuperSpeed USB device number 11 using xhci_hcd
Jul 25 22:52:58 P- rtkit-daemon[2222]: Supervising 7 threads of 5 processes of 1 users.
Jul 25 22:52:58 P- rtkit-daemon[2222]: Supervising 7 threads of 5 processes of 1 users.


HDD OK:

Jul 25 22:59:42 P- kernel: usb 2-4: USB disconnect, device number 11
Jul 25 22:59:42 P- systemd-udevd[249165]: 2-4:1.0: Process '/usr/lib/snapd/snap-device-helper unbind snap_remmina_remmina /devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4:1.0 0:0' failed with exit code 1.
Jul 25 22:59:42 P- systemd-udevd[249159]: 2-4: Process '/usr/lib/snapd/snap-device-helper unbind snap_remmina_remmina /devices/pci0000:00/0000:00:14.0/usb2/2-4 189:138' failed with exit code 1.

Jul 25 22:59:46 P- kernel: usb 2-4: new SuperSpeed USB device number 12 using xhci_hcd
Jul 25 22:59:46 P- kernel: usb 2-4: New USB device found, idVendor=174c, idProduct=5106, bcdDevice= 1.00
Jul 25 22:59:46 P- kernel: usb 2-4: New USB device strings: Mfr=2, Product=3, SerialNumber=1
Jul 25 22:59:46 P- kernel: usb 2-4: Product: BlacX
Jul 25 22:59:46 P- kernel: usb 2-4: Manufacturer: Thermaltake
Jul 25 22:59:46 P- kernel: usb 2-4: SerialNumber: 000000000002
Jul 25 22:59:46 P- kernel: usb-storage 2-4:1.0: USB Mass Storage device detected
Jul 25 22:59:46 P- kernel: scsi host2: usb-storage 2-4:1.0
Jul 25 22:59:46 P- mtp-probe[249185]: checking bus 2, device 12: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-4"
Jul 25 22:59:46 P- mtp-probe[249185]: bus: 2, device: 12 was not an MTP device
Jul 25 22:59:46 P- systemd-udevd[249180]: 2-4:1.0: Process '/usr/lib/snapd/snap-device-helper bind snap_remmina_remmina /devices/pci0000:00/0000:00:14.0/usb2/2-4/2-4:1.0 0:0' failed with exit code 1.
Jul 25 22:59:46 P- mtp-probe[249205]: checking bus 2, device 12: "/sys/devices/pci0000:00/0000:00:14.0/usb2/2-4"
Jul 25 22:59:46 P- mtp-probe[249205]: bus: 2, device: 12 was not an MTP device
Jul 25 22:59:46 P- systemd-udevd[249180]: 2-4: Process '/usr/lib/snapd/snap-device-helper bind snap_remmina_remmina /devices/pci0000:00/0000:00:14.0/usb2/2-4 189:139' failed with exit code 1.
Jul 25 22:59:47 P- kernel: scsi 2:0:0:0: Direct-Access     ST18000N M013J            GH02 PQ: 0 ANSI: 5
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: Attached scsi generic sg2 type 0
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] Very big device. Trying to use READ CAPACITY(16).
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] 35156656128 512-byte logical blocks: (18.0 TB/16.4 TiB)
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] Write Protect is off
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] Mode Sense: 23 00 00 00
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] No Caching mode page found
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] Assuming drive cache: write through
Jul 25 22:59:47 P- kernel:  sdc: sdc1 sdc2
Jul 25 22:59:47 P- kernel: sd 2:0:0:0: [sdc] Attached SCSI disk
Jul 25 22:59:47 P- systemd-udevd[249180]: sdc: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/sdc' failed with exit code 1.
Jul 25 22:59:47 P- dbus-daemon[1317]: [system] Activating service name='org.kde.kded.smart' requested by ':1.52' (uid=1000 pid=2607 comm="/usr/bin/kded5 " label="unconfined") (using servicehelper)
Jul 25 22:59:47 P- dbus-daemon[1317]: [system] Successfully activated service 'org.kde.kded.smart'
Jul 25 22:59:48 P- systemd-udevd[249180]: sdc1: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/sdc1' failed with exit code 1.
Jul 25 22:59:48 P- systemd-udevd[249184]: sdc2: Process '/usr/bin/unshare -m /usr/bin/snap auto-import --mount=/dev/sdc2' failed with exit code 1.
Jul 25 22:59:48 P- kernel: ntfs3: Unknown parameter 'windows_names'


Jul 25 22:59:49 P- ntfs-3g[249239]: Version 2021.8.22 integrated FUSE 28
Jul 25 22:59:49 P- ntfs-3g[249239]: Mounted /dev/sdc2 (Read-Write, label "18-TB-1", NTFS 3.1)
Jul 25 22:59:49 P- ntfs-3g[249239]: Cmdline options: rw,nodev,nosuid,uid=1000,gid=1000,windows_names,uhelper=udisks2
Jul 25 22:59:49 P- ntfs-3g[249239]: Mount options: nodev,nosuid,uhelper=udisks2,allow_other,nonempty,relatime,rw,default_permissions,fsname=/dev/sdc2,blkdev,blksize=4096
Jul 25 22:59:49 P- ntfs-3g[249239]: Global ownership and permissions enforced, configuration type 7
Jul 25 22:59:49 P- udisksd[1404]: Mounted /dev/sdc2 at /media/mama/18-TB-1 on behalf of uid 1000
Comment 8 Alan Stern 2022-07-26 14:15:25 UTC
Some of the things you wrote above are not correct.  "When you Turn-on the USB3.0 to SATA controller, electrons travel near the speed of light."  Not true at all; electric waves travel near the speed of light but the electrons themselves move at only a few centimeters per second (bulk motion).

Anyway, the information you reported doesn't indicate what's going wrong.  I don't think it's simply a matter of waiting for the disk to spin up; the commands sent by the kernel have a 30-second timeout and that should be plenty of time.

A usbmon trace of a non-working connection should help.  Before you plug in the USB cable, do:

   cat /sys/kernel/debug/usb/usbmon/2u >mon.out

Then after the drive has been plugged in and the drive has failed to appear, kill the "cat" process with ^C and attach the mon.out file to this bug report.

In fact, you might want to do this twice: once where the drive doesn't work, and once where it does work, for comparison.
Comment 9 JuanPC2018 2022-07-26 15:45:02 UTC
$ sudo cat /sys/kernel/debug/usb/usbmon/2u >mon.out
[sudo] password: 
cat: /sys/kernel/debug/usb/usbmon/2u: No such file or directory

$ su
Password: 
root@macmini:/home/user# cat /sys/kernel/debug/usb/usbmon/2u >mon.out
cat: /sys/kernel/debug/usb/usbmon/2u: No such file or directory

root@macmini:/home/user# whoami
root
Comment 10 Alan Stern 2022-07-26 17:38:53 UTC
Your system probably didn't mount debugfs for you.  You'll have to do:

   mount -t debugfs none /sys/kernel/debug

first.
Comment 11 JuanPC2018 2022-07-26 19:20:29 UTC
$ sudo mount -t debugfs none /sys/kernel/debug
[sudo] password: 
mount: /sys/kernel/debug: none already mounted on /run/credentials/systemd-sysusers.service.
Comment 12 Alan Stern 2022-07-27 01:21:43 UTC
I don't understand that error message.  Regardless, what you want is the directory on which a debugfs filesystem is mounted.  On my system that's /sys/kernel/debug:

$ mount
...
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel)

Maybe you need to change the command line to:

   mount -t debugfs debugfs /sys/kernel/debug

Or maybe debugfs is already mounted somewhere else.  Or maybe your kernel was built without support for debugfs.
Comment 13 JuanPC2018 2022-07-27 01:42:35 UTC
$ sudo mount -t debugfs debugfs /sys/kernel/debug
[sudo] password: 
mount: /sys/kernel/debug: debugfs already mounted on /sys/kernel/debug.
$ uname -a
Linux P- 5.15.0-41-generic #44-Ubuntu SMP Wed Jun 22 14:20:53 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

$ neofetch
           `.:/ossyyyysso/:.               mac@P- 
        .:oyyyyyyyyyyyyyyyyyyo:`           ------------ 
      -oyyyyyyyodMMyyyyyyyysyyyyo-         OS: Kubuntu 22.04 LTS x86_64 
    -syyyyyyyyyydMMyoyyyydmMMyyyyys-       Host: Macmini7,1 1.0 
   oyyysdMysyyyydMMMMMMMMMMMMMyyyyyyyo     Kernel: 5.15.0-41-generic 
 `oyyyydMMMMysyysoooooodMMMMyyyyyyyyyo`    Uptime: 9 hours, 47 mins 
 oyyyyyydMMMMyyyyyyyyyyyysdMMysssssyyyo    Packages: 4488 (dpkg), 28 (snap) 
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy-   Shell: bash 5.1.16 
oyyyysoodMyyyyyyyyyyyyyyyyyyydMMMMysyyyo   Resolution: 1920x1080 
yyysdMMMMMyyyyyyyyyyyyyyyyyyysosyyyyyyyy   DE: Plasma 5.24.4 
yyysdMMMMMyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy   WM: KWin 
oyyyyysosdyyyyyyyyyyyyyyyyyyydMMMMysyyyo   WM Theme: Sweet-Dark 
-yyyyyyyydMysyyyyyyyyyyyyyysdMMMMMysyyy-   Theme: Brisa oscuro [Plasma], Akamayan-darker [GTK2/3] 
 oyyyyyydMMMysyyyyyyyyyyysdMMyoyyyoyyyo    Icons: breeze-dark [Plasma], breeze-dark [GTK2/3] 
 `oyyyydMMMysyyyoooooodMMMMyoyyyyyyyyo     Terminal: konsole 
   oyyysyyoyyyysdMMMMMMMMMMMyyyyyyyyo      CPU: Intel i5-4308U (4) @ 3.300GHz 
    -syyyyyyyyydMMMysyyydMMMysyyyys-       GPU: Intel Haswell-ULT 
      -oyyyyyyydMMyyyyyyysosyyyyo-         Memory: 6206MiB / 7827MiB 
        ./oyyyyyyyyyyyyyyyyyyo/.
Comment 14 JuanPC2018 2022-07-27 01:43:44 UTC
$ cat /sys/kernel/debug/usb/usbmon/2u >mon.out
cat: /sys/kernel/debug/usb/usbmon/2u: Permission denied

$ sudo cat /sys/kernel/debug/usb/usbmon/2u >mon.out
cat: /sys/kernel/debug/usb/usbmon/2u: No such file or directory
Comment 15 JuanPC2018 2022-07-27 01:45:10 UTC
i will try with other linux...
Comment 16 Alan Stern 2022-07-27 14:01:23 UTC
The question is which directory or file on that path is missing.  From comment 13, it looks like /sys/kernel/debug/usb should exist.  Maybe it doesn't have a usbmon subdirectory because the usbmon module hasn't been loaded.  If you do:

   modprobe usbmon

it should create that directory and the 2u file within it.
Comment 17 JuanPC2018 2022-07-28 03:44:47 UTC
im using another Linux, same usb problem, 
but in this linux
$ sudo mount -t debugfs debugfs /sys/kernel/debug

is mounted in /syskernel/debug ok

i can see inside /sys/kernel/debug
with sudo

$ sudo modprobe usbmon
works
$ sudo cat /sys/kernel/debug/usb/usbmon/2u >mon.out

creates a directory in /sys/kernel/debug/usb
called /usbmon

but nothing happens all files inside are 0kb.
Comment 18 JuanPC2018 2022-07-28 03:50:12 UTC
$ neofetch
     
                  .+yh                   mac@macmini71 
                 sMMMo                   ------------------ 
                sMMN+                    OS: pearOS Monterey Beta x86_64 
                +o:                      Host: Macmini7,1 1.0 
           ./oyyys+.                     Kernel: 5.14.0-1036-oem 
         :dMMMMMMMMMm/                   Uptime: 2 hours, 48 mins 
        :MMMMMMMMMMMMMy                  Resolution: 1920x1080 @ 60.00Hz 
        yMMMMMMMMMMMMMN                  CPU: Intel i5-4308U (4) @ 3.300GHz [49.0°C] 
        mMMMMMMMMMMMMs`                  GPU: Intel Haswell-ULT 
       yMMMMMMMMMMMMo                     
     -mMMMMMMMMMMMMM`                    Packages: 2789 (dpkg), 17 (snap) 
    oMMMMMMMMMMMMMMM`                    Shell: bash 5.0.17 
   oMMMMMMMMMMMMMMMMy                    Terminal: konsole 
  .MMMMMMMMMMMMMMMMMMy`                   
  +MMMMMMMMMMMMMMMMMMMMy/`               Memory: 4290MiB / 7832MiB [--------=======] 
  /MMMMMMMMMMMMMMMMMMMMMMMNds            CPU Usage: 13% [-==============] 
  `mMMMMMMMMMMMMMMMMMMMMMMMM/            Disk (/): 58G / 103G (60%) [---------======] 
   .mMMMMMMMMMMMMMMMMMMMMMM+  
    `oNMMMMMMMMMMMMMMMMMMd-                                      
      `+hMMMMMMMMMMMMMms-                                        
          -/osyhhyso:. 
                                         Copyright © 2021 Alexandru Balan w/ axtlos
Comment 19 Alan Stern 2022-07-28 14:42:19 UTC
Make sure your current directory is something regular, like your home directory. Not something under /sys/ -- those directories aren't writeable.

It's normal for the files under /sys to show up as 0 bytes long in an "ls -l" listing.  They aren't real files, but interfaces to the kernel.  As long as they do show up at all they should be okay.

While the "cat" process is running, any activity on the USB bus (such as activity caused by plugging in the drive) will get copied to the "mon.out" file.

(By the way, the output from neofetch is not really useful.  You might as well stop including it.)
Comment 20 JuanPC2018 2022-07-29 18:39:13 UTC
Created attachment 301515 [details]
monout.txt.zip

$ sudo modprobe usbmon
[sudo] password: 
$ sudo cat /sys/kernel/debug/usb/usbmon/2u >monout.txt

turn-on No HDD
unplug & plug again
HDD mounted automatically.
Safe Remove
^C
1.1MB file
Compress to .zip
Create New Attachment for Bug 216282
Comment 21 Alan Stern 2022-07-29 20:06:34 UTC
It looks like you may be right about the initial time delay being too small.  I don't see any significant differences in the usbmon trace between the initial plug-in and the later one, except that the device failed to respond during the initial plug-in when asked to identify itself.

(You can compare them yourself just by looking at the trace file.  The initial plug-in is detected at line 7, and the second plug-in is detected at line 193.  The lines subsequent to those are virtually identical if you ignore the first two columns, with just one or two unimportant differences -- up until the failure at line 75.)

You can change the length of the time delay by setting the usb-storage delay_use parameter.  For instance, assuming that the usb-storage module is already loaded, do:

   echo 20 >/sys/module/usb_storage/parameters/delay_use

before you plug in the drive.  That will change the delay to 20 seconds (the default delay value is 1 second).  Maybe it will help.
Comment 22 JuanPC2018 2022-07-29 22:35:46 UTC
1 Fail, yes..
...
4 worked 1x time, because did not waited for hdd platter to stop before turn-on. inertia.
...
10 works but probably more is required for 20TB.
The heavier the platter = more time.

Large HDDs "fail" because are sealed with Helium,
has gas leak,
was Not filled enough at factory,
does Not-pass Quality Control.
Temps are higher, does Not lower fast at Idle.
= more spin-up time,
sold cheaper without warranty. LOL™

creating /etc/modprobe.d/usb-storage.conf
adding
delay_use 15

Fails.
Parameter invalid,
but deletes the folder 
/sys/module/usb_storage

Edit:
$ sudo tea /sys/module/usb_storage/parameters/delay_use
10

Save 
works but...
each reboot Linux changes back to 1

---------------

$ sudo echo 2 >/sys/module/usb_storage/parameters/delay_use
bash: /sys/module/usb_storage/parameters/delay_use: Permission denied

Fail,
because modprobe usb-storage is loaded

$ sudo modprobe -r usb_storage
[sudo] password: 
libkmod: ERROR ../libkmod/libkmod-config.c:712 kmod_config_parse: /etc/modprobe.d/usb-storage.conf line 1: ignoring bad line starting with 'delay_use'
modprobe: FATAL: Module usb_storage is in use.

$ sudo modprobe -r usb_storage
libkmod: ERROR ../libkmod/libkmod-config.c:712 kmod_config_parse: /etc/modprobe.d/usb-storage.conf line 1: ignoring bad line starting with 'delay'
modprobe: FATAL: Module usb_storage is in use.

$ sudo modprobe -r usb_storage
libkmod: ERROR ../libkmod/libkmod-config.c:712 kmod_config_parse: /etc/modprobe.d/usb-storage.conf line 1: ignoring bad line starting with '2'
modprobe: FATAL: Module usb_storage is in use.

$ sudo modprobe -r usb_storage
libkmod: ERROR ../libkmod/libkmod-config.c:712 kmod_config_parse: /etc/modprobe.d/usb-storage.conf line 1: ignoring bad line starting with 'delay'
modprobe: FATAL: Module usb_storage is in use.

$ sudo modprobe -r usb_storage
libkmod: ERROR ../libkmod/libkmod-config.c:712 kmod_config_parse: /etc/modprobe.d/usb-storage.conf line 1: ignoring bad line starting with 'delay-use'

"Works"
Comment 23 Alan Stern 2022-07-30 02:38:53 UTC
Your /etc/modprobe.d/usb-storage.conf file didn't work because it had the wrong format.  It should contain a line saying:

   options usb-storage delay_use=15

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