I have a 1TB Toshiba USB HDD connected to the USB 3.0 port in my laptop (Asus X550C). I am using Ubuntu 18.04 (kernel 4.15.0-166-generic).
I used to sleep/wake up the computer with the USB drive attached and everything resumed normally. However, since one Ubuntu update (I cannot tell which one) I get I/O errors from the USB disk after waking up:
user@asus:/media/user/HDD$ ls
ls: reading directory '.': Input/output error
All programs that have a file opened from the USB disk crash after resume because they cannot access the disk.
What I have observed by trial and error:
- New programs can access the disk successfully. However, those programs that went through the sleep/wake up cycle never recover access, even though the disk is working again
- There is one exception: if I leave a shell opened and pointing to a directory in the disk, I get I/O errors. However, if I type
cd .
errors go away and HDD works again (only cd .
, any other command results in IO error)
- If I attach the HDD to the USB 2.0 port, it wakes up successfully
- If I attach a USB flash drive (not HDD), it wakes up successfully
It is like the current directory is somehow lost for programs that go through the sleep/wake up process. Programs opened after wake up work nicely. This only happens for an HDD connected to the USB 3.0 (like some kind of racing condition).
$ sudo fdisk -l
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x8cc1ecc7
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 206847 204800 100M 7 HPFS/NTFS/exFAT
/dev/sda2 206848 440526847 440320000 210G 7 HPFS/NTFS/exFAT
/dev/sda3 440526848 937701375 497174528 237.1G 83 Linux
Disk /dev/sdc: 931.5 GiB, 1000204883968 bytes, 1953525164 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9b0f78c0
Device Boot Start End Sectors Size Id Type
/dev/sdc1 2048 983042047 983040000 468.8G 7 HPFS/NTFS/exFAT
/dev/sdc2 983042048 1953525163 970483116 462.8G 83 Linux
$ lsusb
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 04f2:b40a Chicony Electronics Co., Ltd
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 021: ID 0480:a00c Toshiba America Inc
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 003 Device 007: ID 0835:8502 Action Star Enterprise Co., Ltd
Bus 003 Device 006: ID 0835:8500 Action Star Enterprise Co., Ltd
Bus 003 Device 005: ID 046d:c31c Logitech, Inc. Keyboard K120
Bus 003 Device 004: ID 046d:c03e Logitech, Inc. Premium Optical Wheel Mouse (M-BT58)
Bus 003 Device 003: ID 0835:8501 Action Star Enterprise Co., Ltd
Bus 003 Device 002: ID 0835:8500 Action Star Enterprise Co., Ltd
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
dmes output with USB 3.0 (error reproduced):
[ 80.707547] wlp2s0: deauthenticating from 54:a0:50:e4:82:30 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 83.020979] PM: suspend entry (deep)
[ 83.020982] PM: Syncing filesystems ... done.
[ 83.034082] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 83.036245] OOM killer disabled.
[ 83.036246] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 83.037516] Suspending console(s) (use no_console_suspend to debug)
[ 83.056384] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 83.056445] sd 0:0:0:0: [sda] Stopping disk
[ 83.064227] sd 6:0:0:0: [sdb] Synchronizing SCSI cache
[ 83.225059] ACPI: EC: interrupt blocked
[ 83.244915] ACPI: Preparing to enter system sleep state S3
[ 83.252323] ACPI: EC: event blocked
[ 83.252325] ACPI: EC: EC stopped
[ 83.252326] PM: Saving platform NVS memory
[ 83.252516] Disabling non-boot CPUs ...
[ 83.268409] IRQ 31: no longer affine to CPU1
[ 83.269427] smpboot: CPU 1 is now offline
[ 83.294105] smpboot: CPU 2 is now offline
[ 83.316526] IRQ 23: no longer affine to CPU3
[ 83.316533] IRQ 26: no longer affine to CPU3
[ 83.316541] IRQ 29: no longer affine to CPU3
[ 83.317557] smpboot: CPU 3 is now offline
[ 83.319808] ACPI: Low-level resume complete
[ 83.319884] ACPI: EC: EC started
[ 83.319885] PM: Restoring platform NVS memory
[ 83.321732] Enabling non-boot CPUs ...
[ 83.321805] x86: Booting SMP configuration:
[ 83.321806] smpboot: Booting Node 0 Processor 1 APIC 0x2
[ 83.325400] cache: parent cpu1 should not be sleeping
[ 83.325731] CPU1 is up
[ 83.325772] smpboot: Booting Node 0 Processor 2 APIC 0x1
[ 83.328403] cache: parent cpu2 should not be sleeping
[ 83.329072] CPU2 is up
[ 83.329111] smpboot: Booting Node 0 Processor 3 APIC 0x3
[ 83.331670] cache: parent cpu3 should not be sleeping
[ 83.332147] CPU3 is up
[ 83.336322] ACPI: Waking up from system sleep state S3
[ 83.415767] ACPI: EC: interrupt unblocked
[ 83.436652] ACPI: EC: event unblocked
[ 83.436704] usb usb3: root hub lost power or was reset
[ 83.436709] usb usb4: root hub lost power or was reset
[ 83.437112] usb usb1: root hub lost power or was reset
[ 83.437889] usb usb2: root hub lost power or was reset
[ 83.441029] ehci-pci 0000:00:1a.0: cache line size of 64 is not supported
[ 83.441796] ehci-pci 0000:00:1d.0: cache line size of 64 is not supported
[ 83.444014] sd 0:0:0:0: [sda] Starting disk
[ 83.552768] r8169 0000:03:00.2 enp3s0f2: link down
[ 83.734197] usb 2-1: reset high-speed USB device number 2 using ehci-pci
[ 83.734220] usb 1-1: reset high-speed USB device number 2 using ehci-pci
[ 83.768919] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 83.768963] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 83.770066] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[ 83.770934] ata1.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 83.770939] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 83.771145] ata3.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 83.771152] ata3.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 83.772458] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[ 83.772534] ata1.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 83.772539] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 83.772644] ata1.00: configured for UDMA/133
[ 83.776606] ata3.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 83.776612] ata3.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 83.778387] ata3.00: configured for UDMA/133
[ 84.205989] usb 1-1.3: reset high-speed USB device number 3 using ehci-pci
[ 86.415072] OOM killer enabled.
[ 86.415075] Restarting tasks ...
[ 86.415368] usb 4-1: USB disconnect, device number 2
[ 86.422799] done.
[ 86.425772] print_req_error: I/O error, dev sdb, sector 0
[ 86.437800] sd 6:0:0:0: [sdb] Synchronizing SCSI cache
[ 86.437843] sd 6:0:0:0: [sdb] Synchronize Cache(10) failed: Result: hostbyte=DID_NO_CONNECT driverbyte=DRIVER_OK
[ 86.493540] blk_partition_remap: fail for partition 2
[ 86.493568] Buffer I/O error on dev sdb2, logical block 60325888, lost sync page write
[ 86.493581] JBD2: Error -5 detected when updating journal superblock for sdb2-8.
[ 86.493583] Aborting journal on device sdb2-8.
[ 86.493587] blk_partition_remap: fail for partition 2
[ 86.493588] Buffer I/O error on dev sdb2, logical block 60325888, lost sync page write
[ 86.493590] JBD2: Error -5 detected when updating journal superblock for sdb2-8.
[ 86.638576] PM: suspend exit
[ 86.746072] IPv6: ADDRCONF(NETDEV_UP): enp3s0f2: link is not ready
[ 86.843335] r8169 0000:03:00.2 enp3s0f2: link down
[ 86.843517] IPv6: ADDRCONF(NETDEV_UP): enp3s0f2: link is not ready
[ 86.846125] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[ 86.996625] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[ 87.053851] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[ 87.320988] usb 4-1: new SuperSpeed USB device number 3 using xhci_hcd
[ 87.344753] usb 4-1: New USB device found, idVendor=0480, idProduct=a00c
[ 87.344757] usb 4-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 87.344759] usb 4-1: Product: External USB 3.0
[ 87.344760] usb 4-1: Manufacturer: TOSHIBA
[ 87.344762] usb 4-1: SerialNumber: 20140114057420
[ 87.345967] usb-storage 4-1:1.0: USB Mass Storage device detected
[ 87.347590] usb-storage 4-1:1.0: Quirks match for vid 0480 pid a00c: 800000
[ 87.347626] scsi host6: usb-storage 4-1:1.0
[ 88.175858] wlp2s0: authenticate with 54:a0:50:e4:82:30
[ 88.185166] wlp2s0: send auth to 54:a0:50:e4:82:30 (try 1/3)
[ 88.186656] wlp2s0: authenticated
[ 88.188952] wlp2s0: associate with 54:a0:50:e4:82:30 (try 1/3)
[ 88.192934] wlp2s0: RX AssocResp from 54:a0:50:e4:82:30 (capab=0x1411 status=0 aid=5)
[ 88.193029] wlp2s0: associated
[ 88.214555] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
[ 88.377019] scsi 6:0:0:0: Direct-Access TOSHIBA External USB 3.0 5438 PQ: 0 ANSI: 6
[ 88.381543] sd 6:0:0:0: Attached scsi generic sg2 type 0
[ 88.382630] sd 6:0:0:0: [sdb] 1953525164 512-byte logical blocks: (1.00 TB/932 GiB)
[ 88.382979] sd 6:0:0:0: [sdb] Write Protect is off
[ 88.382982] sd 6:0:0:0: [sdb] Mode Sense: 23 00 00 00
[ 88.383327] sd 6:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[ 90.948674] sdb: sdb1 sdb2
[ 90.960736] sd 6:0:0:0: [sdb] Attached SCSI disk
[ 92.224427] EXT4-fs (sdb2): recovery complete
[ 92.284931] EXT4-fs (sdb2): mounted filesystem with ordered data mode. Opts: (null)
dmes output with USB 2.0 (no errors):
[ 101.037552] wlp2s0: deauthenticating from 54:a0:50:e4:82:30 by local choice (Reason: 3=DEAUTH_LEAVING)
[ 103.385167] PM: suspend entry (deep)
[ 103.385170] PM: Syncing filesystems ... done.
[ 103.397551] Freezing user space processes ... (elapsed 0.002 seconds) done.
[ 103.399954] OOM killer disabled.
[ 103.399955] Freezing remaining freezable tasks ... (elapsed 0.001 seconds) done.
[ 103.401220] Suspending console(s) (use no_console_suspend to debug)
[ 103.433979] sd 6:0:0:0: [sdb] Synchronizing SCSI cache
[ 103.433981] sd 0:0:0:0: [sda] Synchronizing SCSI cache
[ 103.434395] sd 0:0:0:0: [sda] Stopping disk
[ 103.603845] ACPI: EC: interrupt blocked
[ 103.623791] ACPI: Preparing to enter system sleep state S3
[ 103.755715] ACPI: EC: event blocked
[ 103.755717] ACPI: EC: EC stopped
[ 103.755718] PM: Saving platform NVS memory
[ 103.755866] Disabling non-boot CPUs ...
[ 103.771717] IRQ 31: no longer affine to CPU1
[ 103.772734] smpboot: CPU 1 is now offline
[ 103.797121] smpboot: CPU 2 is now offline
[ 103.819706] IRQ 23: no longer affine to CPU3
[ 103.819714] IRQ 26: no longer affine to CPU3
[ 103.819719] IRQ 27: no longer affine to CPU3
[ 103.820738] smpboot: CPU 3 is now offline
[ 103.823007] ACPI: Low-level resume complete
[ 103.823087] ACPI: EC: EC started
[ 103.823089] PM: Restoring platform NVS memory
[ 103.824934] Enabling non-boot CPUs ...
[ 103.825037] x86: Booting SMP configuration:
[ 103.825038] smpboot: Booting Node 0 Processor 1 APIC 0x2
[ 103.828655] cache: parent cpu1 should not be sleeping
[ 103.828991] CPU1 is up
[ 103.829030] smpboot: Booting Node 0 Processor 2 APIC 0x1
[ 103.831690] cache: parent cpu2 should not be sleeping
[ 103.832340] CPU2 is up
[ 103.832389] smpboot: Booting Node 0 Processor 3 APIC 0x3
[ 103.834918] cache: parent cpu3 should not be sleeping
[ 103.835416] CPU3 is up
[ 103.839605] ACPI: Waking up from system sleep state S3
[ 103.902963] ACPI: EC: interrupt unblocked
[ 103.923403] ACPI: EC: event unblocked
[ 103.923449] usb usb3: root hub lost power or was reset
[ 103.923454] usb usb4: root hub lost power or was reset
[ 103.925642] usb usb1: root hub lost power or was reset
[ 103.927446] usb usb2: root hub lost power or was reset
[ 103.929543] ehci-pci 0000:00:1a.0: cache line size of 64 is not supported
[ 103.931347] ehci-pci 0000:00:1d.0: cache line size of 64 is not supported
[ 103.935308] sd 0:0:0:0: [sda] Starting disk
[ 104.035971] r8169 0000:03:00.2 enp3s0f2: link down
[ 104.225463] usb 1-1: reset high-speed USB device number 2 using ehci-pci
[ 104.225473] usb 2-1: reset high-speed USB device number 2 using ehci-pci
[ 104.320371] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[ 104.320409] ata1: SATA link up 6.0 Gbps (SStatus 133 SControl 300)
[ 104.321734] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[ 104.322970] ata1.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 104.322978] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 104.323150] ata3.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 104.323158] ata3.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 104.324340] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out
[ 104.324379] ata1.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 104.324383] ata1.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 104.324562] ata1.00: configured for UDMA/133
[ 104.328629] ata3.00: ACPI cmd ef/10:06:00:00:00:a0 (SET FEATURES) succeeded
[ 104.328647] ata3.00: ACPI cmd ef/10:03:00:00:00:a0 (SET FEATURES) filtered out
[ 104.330415] ata3.00: configured for UDMA/133
[ 104.341631] usb 3-2: reset high-speed USB device number 2 using xhci_hcd
[ 104.697412] usb 1-1.3: reset high-speed USB device number 3 using ehci-pci
[ 104.837895] OOM killer enabled.
[ 104.837899] Restarting tasks ... done.
[ 105.098906] PM: suspend exit
[ 105.182497] IPv6: ADDRCONF(NETDEV_UP): enp3s0f2: link is not ready
[ 105.283583] r8169 0000:03:00.2 enp3s0f2: link down
[ 105.283671] IPv6: ADDRCONF(NETDEV_UP): enp3s0f2: link is not ready
[ 105.285124] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[ 105.433822] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[ 105.482910] IPv6: ADDRCONF(NETDEV_UP): wlp2s0: link is not ready
[ 106.622874] wlp2s0: authenticate with 54:a0:50:e4:82:30
[ 106.627239] wlp2s0: send auth to 54:a0:50:e4:82:30 (try 1/3)
[ 106.630373] wlp2s0: authenticated
[ 106.633249] wlp2s0: associate with 54:a0:50:e4:82:30 (try 1/3)
[ 106.649449] wlp2s0: RX AssocResp from 54:a0:50:e4:82:30 (capab=0x1411 status=0 aid=5)
[ 106.649543] wlp2s0: associated
[ 106.671964] IPv6: ADDRCONF(NETDEV_CHANGE): wlp2s0: link becomes ready
As you can see, the only difference between the two logs is that in the USB 3.0 the HDD gets disconnected from the USB bus:
...
[ 86.415368] usb 4-1: USB disconnect, device number 2
...
So when the OS tries to access files from the HDD, the HDD is not ready and the error happens.
Any idea what might be causing this disconnection only under USB 3.0?
Thank you very much in advance.