Re: add NO_REPORT_LUNS quirk for at least a few Seagate external drives to fix smartctl with uas

Alban Browaeys
2024-06-12T15:13:16Z

Le mercredi 12 juin 2024 à 03:39 +0200, Alban Browaeys a écrit :
> Le mardi 11 juin 2024 à 10:21 +0200, Oliver Neukum a écrit :
> >
> >
> > On 10.06.24 21:25, Alban Browaeys wrote:
> > > I found that for "smartctl" to work on my two Seagate Expansion
> > > external USB3  I had to add the "j" usb-storage quirks ie
> > > "US_FL_NO_REPORT_LUNS".
> > > (They are years apart).
> >
> > Hi,
> >
> > does the attached patch do the job?
> >
> > Regards
> > Oliver
>
> No, it does not work.
> smartctl is still broken with the US_FL_NO_REPORT_LUNS in
> drivers/usb/storage/unusual_uas.h.
>
> But if I add back the "j" usb.quirks flag back with:
> echo -n "0x0bc2:0x2037:j" | sudo tee
> /sys/module/usb_storage/parameters/quirks
> and then:
> echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/unbind
> echo -n "2-2:1.0" | sudo tee /sys/bus/usb/drivers/uas/bind
> then smartctl works.
>
> I tested on tw kernels with the two different seagate drives.
>
> sudo grep Seagate /sys/devices/ -r |& grep Seagate
> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer:Seagate
> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/2-
> 2:1.0/host8/target8:0:0/8:0:0:0/vendor:Seagate
>
> head /sys/devices/pci0000\:00/0000\:00\:14.0/usb2/2-2/quirks
> 0x0
>
>
>
>
> lrwxrwxrwx 1 root root  9 12 juin  03:14 usb-
> Seagate_Expansion_HDD_00000000NACSHZWL-0:0 -> ../../sdc
> lrwxrwxrwx 1 root root 10 12 juin  03:14 usb-
> Seagate_Expansion_HDD_00000000NACSHZWL-0:0-part1 -> ../../sdc1
>
> sudo smartctl -i /dev/sdc
> smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local
> build)
> Copyright (C) 2002-23, Bruce Allen, Christian Franke,
> www.smartmontools.org
>
> Read Device Identity failed: scsi error unsupported field in scsi
> command
>
> If this is a USB connected device, look at the various --device=TYPE
> variants
> A mandatory SMART command failed: exiting. To continue, add one or
> more '-T permissive' options.
>
>
> lsusb -t
> /:  Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p,
> 480M
>     |__ Port 001: Dev 002, If 0, Class=Vendor Specific Class,
> Driver=[none], 12M
>     |__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
>     |__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
>     |__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 002: Dev 005, If 0, Class=Vendor Specific Class,
> Driver=cp210x, 12M
>         |__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb,
> 12M
>         |__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb,
> 12M
>     |__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
>         |__ Port 003: Dev 009, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 003: Dev 009, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 004: Dev 010, If 0, Class=Human Interface Device,
> Driver=usbhid, 1.5M
>         |__ Port 004: Dev 010, If 1, Class=Human Interface Device,
> Driver=usbhid, 1.5M
> /:  Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p,
> 5000M
>     |__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas,
> 5000M
>     |__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-
> storage, 5000M
>     |__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
>     |__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-
> storage, 5000M
>
> with the "j" usb.quirks flag:
> sudo smartctl -i /dev/sdc
> smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.10.0-rc3+] (local
> build)
> Copyright (C) 2002-23, Bruce Allen, Christian Franke,
> www.smartmontools.org
>
> === START OF INFORMATION SECTION ===
> Model Family:     Seagate Barracuda 2.5 5400
> Device Model:     ST4000LM024-2AN17V
> Serial Number:    WCKAEWZZ
> LU WWN Device Id: 5 000c50 0e732b6d8
> Firmware Version: 0001
> User Capacity:    4 000 787 030 016 bytes [4,00 TB]
> Sector Sizes:     512 bytes logical, 4096 bytes physical
> Rotation Rate:    5526 rpm
> Form Factor:      2.5 inches
> Device is:        In smartctl database 7.3/5528
> ATA Version is:   ACS-3 T13/2161-D revision 5
> SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
> Local Time is:    Wed Jun 12 03:30:47 2024 CEST
> SMART support is: Available - device has SMART capability.
> SMART support is: Enabled
>
>

Your patch had:
+UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
+ "Seagate",
+ "RSS LLC Expansion HDD",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NO_REPORT_LUNS),
+
+/* Reported-by: Alban Browaeys <alban.browaeys@gmail.com> */
+UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
+ "Seagate",
+ "RSS LLC Expansion Portable",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NO_REPORT_LUNS),
+

but:
head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/manufacturer
Seagate

head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/product
Expansion HDD

head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/id*
==> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/idProduct <==
2037

==> /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/idVendor <==
0bc2
head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/quirks
0x0

and:

head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/manufacturer
Seagate
head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/product
Expansion
head /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/id*
==> /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/idProduct <==
231a

==> /sys/devices/platform/usb@fe900000/fe900000.usb/xhci-hcd.0.auto/usb2/2-1/2-1.2/2-1.2.1/2-1.2.1.4/idVendor <==
0bc2

I replace the product name with the one from sysfs in your patch but the patch still does not work.
+UNUSUAL_DEV(0x0bc2, 0x2037, 0x0000, 0x9999,
+ "Seagate",
+ "Expansion HDD",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NO_REPORT_LUNS),

+UNUSUAL_DEV(0x0bc2, 0x231a, 0x0000, 0x9999,
+ "Seagate",
+ "Expansion",
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
+ US_FL_NO_REPORT_LUNS),

How could I see if the quirk is applied?
Does sysfs:
head /sys/devices/pci0000:00/0000:00:14.0/usb2/2-2/quirks
0x0
tells it was not?

On the 0x2037 box:
lsusb -t
/: Bus 001.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/12p, 480M
|__ Port 001: Dev 002, If 0, Class=Vendor Specific Class, Driver=[none], 12M
|__ Port 001: Dev 002, If 1, Class=Audio, Driver=[none], 12M
|__ Port 001: Dev 002, If 2, Class=Audio, Driver=[none], 12M
|__ Port 005: Dev 003, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 002: Dev 005, If 0, Class=Vendor Specific Class, Driver=cp210x, 12M
|__ Port 003: Dev 008, If 0, Class=Wireless, Driver=btusb, 12M
|__ Port 003: Dev 008, If 1, Class=Wireless, Driver=btusb, 12M
|__ Port 009: Dev 004, If 0, Class=Hub, Driver=hub/4p, 480M
|__ Port 003: Dev 009, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 003: Dev 009, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 004: Dev 010, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M
|__ Port 004: Dev 010, If 1, Class=Human Interface Device, Driver=usbhid, 1.5M
/: Bus 002.Port 001: Dev 001, Class=root_hub, Driver=xhci_hcd/6p, 5000M
|__ Port 002: Dev 002, If 0, Class=Mass Storage, Driver=uas, 5000M
|__ Port 003: Dev 003, If 0, Class=Mass Storage, Driver=usb-storage, 5000M
|__ Port 005: Dev 004, If 0, Class=Hub, Driver=hub/4p, 5000M
|__ Port 006: Dev 005, If 0, Class=Mass Storage, Driver=usb-storage, 5000M

lsusb
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 046d:08ae Logitech, Inc. QuickCam for Notebooks
Bus 001 Device 003: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 004: ID 05e3:0610 Genesys Logic, Inc. Hub
Bus 001 Device 005: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 008: ID 0a12:0001 Cambridge Silicon Radio, Ltd Bluetooth Dongle (HCI mode)
Bus 001 Device 009: ID 17ef:608c Lenovo Lenovo Calliope USB Keyboard
Bus 001 Device 010: ID 046d:c517 Logitech, Inc. LX710 Cordless Desktop Laser
Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 002: ID 0bc2:2037 Seagate RSS LLC Expansion HDD
Bus 002 Device 003: ID 1058:1078 Western Digital Technologies, Inc. Elements Portable (WDBUZG)
Bus 002 Device 004: ID 05e3:0626 Genesys Logic, Inc. Hub
Bus 002 Device 005: ID 08e4:017a Pioneer Corp. BD-XD07 BD/DVD/CD Writer

Mind I have not test the 0x231a device on 6.9 branch yet as the kernel
build with the patch change is till building. I only tested the 0x2037
one on 6.10.0-rc3.

Regards,
Alban