I finally upgrade my 24.04 to 24.10, and now fstrim fails. I have the
udev rules for all my USB SSDs, one old SATA two newer MVMe:

# cat /etc/udev/rules.d/10-uas-discard.rules
# Enable TRIM support for USB SSD enclosures.
ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="235c", 
SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="1351", 
SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"
ACTION=="add|change", ATTRS{idVendor}=="174c", ATTRS{idProduct}=="2362", 
SUBSYSTEM=="scsi_disk", ATTR{provisioning_mode}="unmap"

Here are the kernel messages from attaching the SATA SSD:

[Mi Jan  1 18:37:14 2025] sd 2:0:0:0: [sdc] Synchronizing SCSI cache
[Mi Jan  1 18:37:14 2025] sd 2:0:0:0: [sdc] Synchronize Cache(10) failed: 
Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK
[Mi Jan  1 18:37:14 2025] usb 2-2: USB disconnect, device number 11
[Mi Jan  1 18:42:48 2025] usb 2-2: new SuperSpeed USB device number 12 using 
xhci_hcd
[Mi Jan  1 18:42:48 2025] usb 2-2: New USB device found, idVendor=174c, 
idProduct=1351, bcdDevice= 1.00
[Mi Jan  1 18:42:48 2025] usb 2-2: New USB device strings: Mfr=2, Product=3, 
SerialNumber=1
[Mi Jan  1 18:42:48 2025] usb 2-2: Product: RAPID-CASE U 3.1
[Mi Jan  1 18:42:48 2025] usb 2-2: Manufacturer: Sharkoon
[Mi Jan  1 18:42:48 2025] usb 2-2: SerialNumber: 2016050500000000000A
[Mi Jan  1 18:42:48 2025] scsi host2: uas
[Mi Jan  1 18:42:53 2025] scsi 2:0:0:0: Direct-Access     CT1000MX 500SSD1      
    0    PQ: 0 ANSI: 6
[Mi Jan  1 18:42:53 2025] sd 2:0:0:0: Attached scsi generic sg2 type 0
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] 1953525168 512-byte logical blocks: 
(1.00 TB/932 GiB)
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] 4096-byte physical blocks
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] Write Protect is off
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] Mode Sense: 43 00 00 00
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] Write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] Preferred minimum I/O size 4096 
bytes
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] Optimal transfer size 33553920 
bytes not a multiple of preferred minimum block size (4096 bytes)
[Mi Jan  1 18:42:57 2025]  sdc: sdc1
[Mi Jan  1 18:42:57 2025] sd 2:0:0:0: [sdc] Attached SCSI disk


lsusb output:
Bus 002 Device 012: ID 174c:1351 ASMedia Technology Inc. RAPID-CASE U 3.1


systemctl status udev.service prints this:

Jan 01 18:42:48 alanya mtp-probe[396856]: checking bus 2, device 12: 
"/sys/devices/pci0000:00/0000:00:08.1/0000:04:00.3/usb2/2-2"
Jan 01 18:42:48 alanya mtp-probe[396856]: bus: 2, device: 12 was not an MTP 
device
Jan 01 18:42:48 alanya mtp-probe[396862]: checking bus 2, device 12: 
"/sys/devices/pci0000:00/0000:00:08.1/0000:04:00.3/usb2/2-2"
Jan 01 18:42:48 alanya mtp-probe[396862]: bus: 2, device: 12 was not an MTP 
device
Jan 01 18:42:57 alanya (udev-worker)[396874]: sdc: Process '/usr/bin/unshare -m 
/usr/bin/snap auto-import --mount=/dev/sdc' failed with exit code 1.
Jan 01 18:42:57 alanya (udev-worker)[396872]: sdc1: Process '/usr/bin/unshare 
-m /usr/bin/snap auto-import --mount=/dev/sdc1' failed with exit code 1.

I don't think the message about an SSD not being an MTP device is
relevant, but here you have it ;-)

Here is what fstrim thinks now:
# fstrim --verbose /mnt
fstrim: /mnt: the discard operation is not supported


Here is the SMART information:

Model Family:     Crucial/Micron Client SSDs
Device Model:     CT1000MX500SSD1
Serial Number:    1912E1F45B1B
LU WWN Device Id: 5 00a075 1e1f45b1b
Firmware Version: M3CR023
User Capacity:    1,000,204,886,016 bytes [1.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    Solid State Device
Form Factor:      2.5 inches
TRIM Command:     Available
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 T13/2161-D revision 5
SATA Version is:  SATA 3.3, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Wed Jan  1 19:09:27 2025 CET
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

Right now I'm assuming that the UDev lines are not sufficient anymore.
Google does not find anything releated to Ubuntu oracular usb trim.

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux-lts-xenial in Ubuntu.
https://bugs.launchpad.net/bugs/1336541

Title:
  No TRIM via USB

Status in Linux:
  Confirmed
Status in linux-lts-xenial package in Ubuntu:
  Confirmed

Bug description:
  Hi,

  As USB attached SSDs are becoming quite big and affordable, along comes the 
idea of installing systems on these.
  But with current USB drivers, some functionality seems to be missing from USB 
subsystem.

  The system does not recognize it is an SSD, but it is corrected manually:
  # cat /etc/udev/rules.d/10-forcessd.rules
  SUBSYSTEM=="block", ATTRS{vendor}=="SanDisk", ATTRS{model}=="Extreme", 
KERNEL=="sd?", ATTR{queue/rotational}="0"

  # cat /sys/block/sdb/queue/rotational
  0

  Checked hdparm, it is saying I have TRIM on the device:
  # hdparm -I /dev/sdb

  /dev/sdb:

  ATA device, with non-removable media
   Model Number:       SanDisk pSSD
  (...)
  Commands/features:
   Enabled      Supported:
  (...)
      * Data Set Management TRIM supported (limit 8 blocks)
      * Deterministic read ZEROs after TRIM
  (...)

  Here is appropriate dmesg:
  [    3.815604] usb 2-8: Manufacturer: SunplusIT INC.
  [    4.122002] usb 3-3: new SuperSpeed USB device number 2 using xhci_hcd
  [    4.138402] usb 3-3: New USB device found, idVendor=0781, idProduct=5580
  [    4.138404] usb 3-3: New USB device strings: Mfr=1, Product=2, 
SerialNumber=3
  [    4.138405] usb 3-3: Product: Extreme
  [    4.138406] usb 3-3: Manufacturer: SanDisk
  [    4.138407] usb 3-3: SerialNumber: AA011109131654094942
  [    4.141393] usb-storage 3-3:1.0: USB Mass Storage device detected
  [    4.141431] scsi0 : usb-storage 3-3:1.0
  [    4.141703] usbcore: registered new interface driver usb-storage

  And:
  [    5.331311] sd 0:0:0:0: [sdb] 122544516 512-byte logical blocks: (62.7 
GB/58.4 GiB)
  [    5.331608] sd 0:0:0:0: [sdb] Write Protect is off
  [    5.331611] sd 0:0:0:0: [sdb] Mode Sense: 33 00 00 08
  [    5.331855] sd 0:0:0:0: [sdb] Write cache: disabled, read cache: enabled, 
doesn't support DPO or FUA
  [    5.339849]  sdb: sdb1 sdb2 sdb3 < sdb5 >
  [    5.340783] sd 0:0:0:0: [sdb] Attached SCSI disk

  From here I'll be using /boot formatted to ext4 to eliminate luks,lvm
  and btrfs from the equasion:

  # mount |grep sdb2
  /dev/sdb2 on /boot type ext4 (rw,noexec,discard)

  # fstrim -v /boot/
  fstrim: /boot/: FITRIM ioctl failed: Operation not supported

  # strace fstrim -v /boot/
  (...)
  open("/boot/", O_RDONLY)                = 3
  ioctl(3, FITRIM, 0x7fffdded85c0)        = -1 EOPNOTSUPP (Operation not 
supported)
  (...)

  During debugging, I've tried compiling a kernel with UAS module to
  check, it booted, system was g changed with the trim - as it wouldn't
  been used at all.

  Any ideas why TRIM is not working on USB?
  Any timeframes for possible fix?
  Any workarounds maybe?
  --- 
  ApportVersion: 2.14.1-0ubuntu3.2
  Architecture: amd64
  AudioDevicesInUse:
   USER        PID ACCESS COMMAND
   /dev/snd/controlC1:  dome       2460 F.... pulseaudio
   /dev/snd/pcmC1D0p:   dome       2460 F...m pulseaudio
   /dev/snd/controlC0:  dome       2460 F.... pulseaudio
  DistroRelease: Ubuntu 14.04
  HibernationDevice: RESUME=UUID=bafebd1d-6988-438f-afd4-b41bb8608616
  InstallationDate: Installed on 2014-06-12 (56 days ago)
  InstallationMedia: Ubuntu 14.04 LTS "Trusty Tahr" - Release amd64 (20140417)
  MachineType: LENOVO 20AR001AUK
  Package: linux (not installed)
  ProcEnviron:
   LANGUAGE=en_US
   TERM=xterm
   PATH=(custom, no user)
   LANG=en_US.UTF-8
   SHELL=/bin/bash
  ProcFB: 0 inteldrmfb
  ProcKernelCmdLine: BOOT_IMAGE=/vmlinuz-3.13.0-24-generic 
root=/dev/mapper/system-root ro rootflags=subvol=@ 
cryptopts=target=crypter,source=/dev/disk/by-uuid/dc149cdf-62f9-4e29-a048-dd0403f51d56,lvm=system,discard
 quiet splash crashkernel=384M-:128M vt.handoff=7
  ProcVersionSignature: Ubuntu 3.13.0-24.47-generic 3.13.9
  PulseList:
   Error: command ['pacmd', 'list'] failed with exit code 1: Home directory not 
accessible: Permission denied
   No PulseAudio daemon running, or not running as session daemon.
  RelatedPackageVersions:
   linux-restricted-modules-3.13.0-24-generic N/A
   linux-backports-modules-3.13.0-24-generic  N/A
   linux-firmware                             1.127.5
  Tags:  trusty
  Uname: Linux 3.13.0-24-generic x86_64
  UpgradeStatus: No upgrade log present (probably fresh install)
  UserGroups:
   
  _MarkForUpload: True
  dmi.bios.date: 03/28/2014
  dmi.bios.vendor: LENOVO
  dmi.bios.version: GJET75WW (2.25 )
  dmi.board.asset.tag: Not Available
  dmi.board.name: 20AR001AUK
  dmi.board.vendor: LENOVO
  dmi.board.version: 0B98401 PRO
  dmi.chassis.asset.tag: No Asset Information
  dmi.chassis.type: 10
  dmi.chassis.vendor: LENOVO
  dmi.chassis.version: Not Available
  dmi.modalias: 
dmi:bvnLENOVO:bvrGJET75WW(2.25):bd03/28/2014:svnLENOVO:pn20AR001AUK:pvrThinkPadT440s:rvnLENOVO:rn20AR001AUK:rvr0B98401PRO:cvnLENOVO:ct10:cvrNotAvailable:
  dmi.product.name: 20AR001AUK
  dmi.product.version: ThinkPad T440s
  dmi.sys.vendor: LENOVO

To manage notifications about this bug go to:
https://bugs.launchpad.net/linux/+bug/1336541/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to