USB HDD not properly spin down after safely remove

Bug #1937350 reported by cshong
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Linux
Confirmed
Undecided
Unassigned
linux (Ubuntu)
New
Undecided
Unassigned
udisks2 (Ubuntu)
New
Undecided
Unassigned

Bug Description

I do not know which package I should file the bug for.

I am using Ubuntu MATE 20.04 LTS and Microsoft Windows 10.

On Microsoft Windows 10, no issue with safely remove any USB external HDD. When using Microsoft Windows 10, after safely remove my external HDD, the HDD will spin down.

But, on Ubuntu MATE 20.04 LTS, some issues occur after I try to safely remove my external HDD.

Tried different hard drive, different enclosures, and also some external hard drive that came bundled with enclosure. All having same or different issues after safely remove them in Ubuntu MATE.

Problems will also occur on those branded external HDD that came bundled with enclosure, for example, those Seagate Backup Plus drives ( https://www.seagate.com/as/en/consumer/backup/backup-plus/ ).

Here are the common problems after safely remove (in Ubuntu MATE):
1. The external HDD will spin down and then spin up again, and then being automatically remounted again. The "dmesg" command shows errors.

2. The external HDD will spin down and then spin up again, no remount. The LED on the enclosure keep flashing. The "dmesg" command shows errors. After you unplug the HDD, you can connect another HDD.

3. The external HDD will spin down and then spin up again, no remount. The LED on the enclosure keep flashing. The "dmesg" command shows errors. BUT, after you unplug the HDD, when you connect another HDD, the computer will not detect it and will not mount it until you reboot the computer. But, before reboot connecting another device (e.g. keyboard, mouse, etc) to the same USB port, the device works perfectly.

4. The external HDD will spin down and then spin up again, no remount. But, after a few seconds, it spin down again. But, still, the "dmesg" command shows errors.

Different HDD, different enclosure, show different symptoms or problems. Some HDD enclosures, number 1 above will occur. Some HDD enclosures, either number 2 or 3 above will occur. Sometimes, problem number 2 above will occur. Sometimes, problem number 3 will occur. Some enclosure, problem number 4 will occur.

Here, I will use the following enclosure as example in this bug report:

Product link: https://www.ugreen.com/products/usb-c-2-5-sata-iii-hard-drive-enclosure

Purchase link in my country: https://shopee.com.my/UGREEN-USB-3.1-To-SATA-III-External-Hard-Drive-Enclosure-(2.5-)-i.64923440.1583255569?position=1

Here are the steps to reproduce (for the enclosure above):

1. Connect the external HDD to any available USB 3.0 port. The HDD will be mounted. Caja (Ubuntu MATE default file manager) will launch.
2. Close the Caja window. Do not do anything on the HDD.
3. Use left or right hand, touch the HDD enclosure to feel the spinning. Do not let your hand leave the enclosure, so that you can continue feel the spinning.
4. Use your another hand to operate your computer.
5. Go to desktop.
6. Right click on the external HDD icon.
7. Click "Safely Remove Drive".

The HDD unmounted. Assume that one of your hands still touching the enclosure of the HDD, you will feel that the HDD will spin down and then spin up again. No remount. The LED indicator on the enclosure will keep flashing. These are described in problem number 2 and 3 above. Sometimes, after you unplug the drive and try to connect another drive, it will not be detected until you reboot your computer.

Almost all external HDDs I tested will cause "dmesg" command to shows "Buffer I/O error" and "Synchronize Cache(<a number>) failed" error after "Safely Remove Drive".

In Microsoft Windows 10, all above mentioned problems WILL NOT occur.
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: cshong 1059 F.... pulseaudio
 /dev/snd/controlC0: cshong 1059 F.... pulseaudio
CasperMD5CheckResult: skip
CurrentDesktop: MATE
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2020-11-23 (242 days ago)
InstallationMedia: Ubuntu-MATE 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
IwConfig:
 lo no wireless extensions.

 enp3s0 no wireless extensions.
MachineType: ASUS All Series
Package: linux (not installed)
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.8.0-63-generic root=UUID=cad772fa-c02b-4268-bc15-e366825ac807 ro quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 5.8.0-63.71~20.04.1-generic 5.8.18
RelatedPackageVersions:
 linux-restricted-modules-5.8.0-63-generic N/A
 linux-backports-modules-5.8.0-63-generic N/A
 linux-firmware 1.187.15
RfKill:

Tags: focal
Uname: Linux 5.8.0-63-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 02/26/2016
dmi.bios.release: 4.6
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 2603
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: H97-PLUS
dmi.board.vendor: ASUSTeK COMPUTER INC.
dmi.board.version: Rev X.0x
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr2603:bd02/26/2016:br4.6:svnASUS:pnAllSeries:pvrSystemVersion:rvnASUSTeKCOMPUTERINC.:rnH97-PLUS:rvrRevX.0x:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.family: ASUS MB
dmi.product.name: All Series
dmi.product.sku: All
dmi.product.version: System Version
dmi.sys.vendor: ASUS
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
AudioDevicesInUse:
 USER PID ACCESS COMMAND
 /dev/snd/controlC1: cshong 1059 F.... pulseaudio
 /dev/snd/controlC0: cshong 1059 F.... pulseaudio
CasperMD5CheckResult: skip
CurrentDesktop: MATE
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2020-11-23 (242 days ago)
InstallationMedia: Ubuntu-MATE 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
IwConfig:
 lo no wireless extensions.

 enp3s0 no wireless extensions.
MachineType: ASUS All Series
Package: linux-generic 5.4.0.80.84
PackageArchitecture: amd64
ProcFB: 0 i915drmfb
ProcKernelCmdLine: BOOT_IMAGE=/boot/vmlinuz-5.8.0-63-generic root=UUID=cad772fa-c02b-4268-bc15-e366825ac807 ro quiet splash vt.handoff=7
ProcVersionSignature: Ubuntu 5.8.0-63.71~20.04.1-generic 5.8.18
RelatedPackageVersions:
 linux-restricted-modules-5.8.0-63-generic N/A
 linux-backports-modules-5.8.0-63-generic N/A
 linux-firmware 1.187.15
RfKill:

Tags: focal
Uname: Linux 5.8.0-63-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
_MarkForUpload: True
dmi.bios.date: 02/26/2016
dmi.bios.release: 4.6
dmi.bios.vendor: American Megatrends Inc.
dmi.bios.version: 2603
dmi.board.asset.tag: To be filled by O.E.M.
dmi.board.name: H97-PLUS
dmi.board.vendor: ASUSTeK COMPUTER INC.
dmi.board.version: Rev X.0x
dmi.chassis.asset.tag: To Be Filled By O.E.M.
dmi.chassis.type: 3
dmi.chassis.vendor: To Be Filled By O.E.M.
dmi.chassis.version: To Be Filled By O.E.M.
dmi.modalias: dmi:bvnAmericanMegatrendsInc.:bvr2603:bd02/26/2016:br4.6:svnASUS:pnAllSeries:pvrSystemVersion:rvnASUSTeKCOMPUTERINC.:rnH97-PLUS:rvrRevX.0x:cvnToBeFilledByO.E.M.:ct3:cvrToBeFilledByO.E.M.:
dmi.product.family: ASUS MB
dmi.product.name: All Series
dmi.product.sku: All
dmi.product.version: System Version
dmi.sys.vendor: ASUS
---
ProblemType: Bug
ApportVersion: 2.20.11-0ubuntu27.18
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: MATE
DistroRelease: Ubuntu 20.04
InstallationDate: Installed on 2020-11-23 (242 days ago)
InstallationMedia: Ubuntu-MATE 20.04.1 LTS "Focal Fossa" - Release amd64 (20200731)
Package: linux-generic-hwe-20.04 5.8.0.63.71~20.04.45
PackageArchitecture: amd64
ProcVersionSignature: Ubuntu 5.8.0-63.71~20.04.1-generic 5.8.18
Tags: focal
Uname: Linux 5.8.0-63-generic x86_64
UpgradeStatus: No upgrade log present (probably fresh install)
UserGroups: adm cdrom dip lpadmin lxd plugdev sambashare sudo
_MarkForUpload: True

Revision history for this message
cshong (cshong87) wrote : AlsaInfo.txt

apport information

tags: added: apport-collected focal
description: updated
Revision history for this message
cshong (cshong87) wrote : CRDA.txt

apport information

Revision history for this message
cshong (cshong87) wrote : CurrentDmesg.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lspci.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lspci-vt.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lsusb.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lsusb-t.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lsusb-v.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcEnviron.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcInterrupts.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcModules.txt

apport information

Revision history for this message
cshong (cshong87) wrote : PulseList.txt

apport information

Revision history for this message
cshong (cshong87) wrote : UdevDb.txt

apport information

Revision history for this message
cshong (cshong87) wrote : WifiSyslog.txt

apport information

Revision history for this message
cshong (cshong87) wrote : acpidump.txt

apport information

description: updated
Revision history for this message
cshong (cshong87) wrote : AlsaInfo.txt

apport information

Revision history for this message
cshong (cshong87) wrote : CRDA.txt

apport information

Revision history for this message
cshong (cshong87) wrote : CurrentDmesg.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Dependencies.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lspci.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lspci-vt.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lsusb.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lsusb-t.txt

apport information

Revision history for this message
cshong (cshong87) wrote : Lsusb-v.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcCpuinfo.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcEnviron.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcInterrupts.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcModules.txt

apport information

Revision history for this message
cshong (cshong87) wrote : PulseList.txt

apport information

Revision history for this message
cshong (cshong87) wrote : UdevDb.txt

apport information

Revision history for this message
cshong (cshong87) wrote : WifiSyslog.txt

apport information

Revision history for this message
cshong (cshong87) wrote : acpidump.txt

apport information

description: updated
Revision history for this message
cshong (cshong87) wrote : Dependencies.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcCpuinfoMinimal.txt

apport information

Revision history for this message
cshong (cshong87) wrote : ProcEnviron.txt

apport information

Revision history for this message
cshong (cshong87) wrote :

The original linux kernel version is 5.4. The problems occur before I try to update kernel. I tried to update kernel by installing linux-generic-hwe-20.04, but this did not solve the problems.

affects: kernel → linux
Revision history for this message
cshong (cshong87) wrote :

I found a workaround.

Steps for workaround:
1. Open caja or any file manager.
2. Unmount all the partitions on the drive by clicking on the eject button.
3. Open Gnome Disk Utility or run "gnome-disks" command.
4. Select the HDD.
5. Click the "Drive Options" button located on the upper right.
6. Click "power off".

The drive will not spin up again.

Paul White (paulw2u)
affects: ubuntu → linux (Ubuntu)
Norbert (nrbrtx)
no longer affects: caja (Ubuntu)
Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Status changed to Confirmed

This change was made by a bot.

Changed in linux:
status: New → Confirmed
Revision history for this message
cshong (cshong87) wrote :

Is it possible that the system try to spin down the USB HDD, while the unmounting of partitions or synchronization of cache still in progress?

Is it possible that the system did not wait for the progress of unmounting pof partition and cache synchronization to finish, before attempt to spin down the USB HDD?

I think the correct way to safely remove a USB storage device is to wait for the unmount and cache synchronization to finish, then wait for the other HDD related operations to finish before spin down the HDD.

Revision history for this message
Kai-Heng Feng (kaihengfeng) wrote :

The USB device gets disconnected successfully:
[ 70.483616] usb 4-2: USB disconnect, device number 2

If you know how to hack the kernel, this is what I'll try in USB/xHCI code:
- Put the USB link to U3 before disconnecting
- Ensure remote wakeup is disabled before disconnecting

no longer affects: ubuntu-mate
To post a comment you must log in.