Ubuntu – Strange LED blinking problem with USB flash drives – is it just me

ejectflashkerneludisksusb

Introduction

I'm using Ubuntu MATE 16.04.5 LTS with latest 4.4 Linux kernel on several machines (laptops and desktops with USB 2.0 and USB 3.0).

For me it seems that something was changed inside USB driver internals of the kernel (or maybe udisks). Or USB flash hardware become cheaper and low-quality.

My USB flash has LED indicator. It is no-name gift (ChipsBank CBM2099E controller).

When I connect it to the computer – it has LED indicator on, it blinks when data is transferred.
My main idea: when I see blinking indicator I suppose that flash is busy, so I should not disconnect it to prevent data corruption.

Problem

Expected behavior

Many flashes – old Transcend JFV60, JF110, JF150, JF500, modern JF790; Kingston Data Traveller G2 and ADATA UE700, SanDisk Extreme Pro do not have such continuous blink problem. They stop blinking exactly after selecting Eject option and show bubble message that device is safe to remove:

Behavior of problematic flash

When I eject problematic USB flash drive from Caja file-manager or from GNOME Disks by pressing Eject menu option the flash LED is continuous blinking with fast rate. I tried to wait for about one hour, but is still blinks after this period of time. This happens even if I do not write anything on the drive. The notification bubble is not shown.

Question

My questions – what may be the reason of such blinking problem? Is it just me? Is it safe (for data) to disconnect such blinking flash?

Notes and updates

Notes

1. I do not ask here about slow drop of write cache and/or sync the drive. It highly depends on RAM size and on real write speed of the flash. The mentioned behavior exists in cases when no data were written.
2. All these flashes do not have problems with eject functionality on Windows. They get LED off just after clicking on Eject/Safely remove.
3. Selecting Power off this disk (PowerOff) in GNOME Disks forces flash to stop blinking, but I'm not sure about data safety in such case (for this particular flash; for other flashes and USB HDDs or SSDs it is safe, I know it).
4. I know that for example WD MyPassport USB hard-drives changes blink rate from fast to slow glow-fade after safely remove, but is other story as it have had spin-down and parked before, so it is safe to unplug it afterwards. So I do not think that the blinking of USB flashes indicate their polling and force user to detach it…

Updates

1. below is live output of tail -f /var/log/syslog

Nov 11 23:37:35 hostname kernel: [32596.101403] scsi 7:0:0:0: Direct-Access     General  UDisk            5.00 PQ: 0 ANSI: 2
Nov 11 23:37:35 hostname kernel: [32596.102526] sd 7:0:0:0: Attached scsi generic sg2 type 0
Nov 11 23:37:35 hostname kernel: [32596.104745] sd 7:0:0:0: [sdc] 31129600 512-byte logical blocks: (15.9 GB/14.8 GiB)
Nov 11 23:37:35 hostname kernel: [32596.107594] sd 7:0:0:0: [sdc] Write Protect is off
Nov 11 23:37:35 hostname kernel: [32596.107611] sd 7:0:0:0: [sdc] Mode Sense: 0b 00 00 08
Nov 11 23:37:35 hostname kernel: [32596.107792] sd 7:0:0:0: [sdc] No Caching mode page found
Nov 11 23:37:35 hostname kernel: [32596.107805] sd 7:0:0:0: [sdc] Assuming drive cache: write through
Nov 11 23:37:35 hostname kernel: [32596.109561]  sdc:
Nov 11 23:37:35 hostname kernel: [32596.110621] sd 7:0:0:0: [sdc] Attached SCSI removable disk
Nov 11 23:37:35 hostname udisksd[2294]: Mounted /dev/sdc at /media/username/FLASHDEVICE on behalf of uid 1000
Nov 11 23:37:52 hostname udisksd[2294]: Cleaning up mount point /media/username/FLASHDEVICE (device 8:32 is not mounted)
Nov 11 23:37:52 hostname udisksd[2294]: Unmounted /dev/sdc on behalf of uid 1000

note last lines here, at 23:37:35 device was unmounted/ejected from file manager, at 23:37:52 udisks removed it, but its LED still blinking.

2. Followed @WinEunuuchs2Unix ideas I tried both UDisks (legacy, it remains on my system because of upgrades from 12.04) and UDisks2 (modern and actual) to perform safely remove procedure – both

#udisks1 (legacy)
udisks --unmount /dev/sdc1 && udisks --detach /dev/sdc
#udisks2 (modern)
udisksctl unmount -b /dev/sdc1 && udisksctl power-off -b /dev/sdc

ended with same LED blinking problem with only one of my flashes.

3. Repeated the method above on my old Ubuntu 12.04.5 LTS and here LED is blinking on problematic flash. So it is a USB flash hardware issue.

Conclusion

There is some software-hardware incompatibility between my no-name ChipsBank CBM2099E based flash and Linux and/or Udisks. Other flashes (listed above in expected behavior) do not have problems.
In the Windows 8.1 running on the same laptop its safe removal is successful and LED is off.

Best Answer

The problem of LED blinking after Eject is selected in Nautilus, is very close to this Launchpad Bug Report from 2013:

That bug report only has five subscribers and has been closed as a duplicate of this Bug Report from 2011:

The latter bug report has 155 subscribers and:

  • October 2017 fix has been triaged for Trusty (Ubuntu 14.04 LTS)
  • October 2017 fix has been released for Xenial (Ubuntu 16.04 LTS)
  • October 2017 fix has been released for Yakkety (Ubuntu 16.10)

Scouring through the first bug report (the one closed as a duplicate) you see the author of udisks mentioning how patches need to be made. Two users who applied the patch reported no success however.

I think in the bug report they missed some of the important aspects of one user's output. Here is the equivalent output from my system (that works):

$ gvfs-mount -li

Drive(3): 3SYSTEM USB Flash Disk
  Type: GProxyDrive (GProxyVolumeMonitorUDisks2)
  ids:
   unix-device: '/dev/sdb'
  themed icons:  [drive-removable-media-usb]  [drive-removable-media]  [drive-removable]  [drive]
  symbolic themed icons:  [drive-removable-media-usb-symbolic]  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media-usb]  [drive-removable-media]  [drive-removable]  [drive]
  is_media_removable=1
  has_media=1
  is_media_check_automatic=1
  can_poll_for_media=0
  can_eject=1
  can_start=0
  can_stop=0
  start_stop_type=shutdown
  sort_key=01hotplug/1546789639130384

  Volume(0): LIVE_USB
    Type: GProxyVolume (GProxyVolumeMonitorUDisks2)
    ids:
     class: 'device'
     unix-device: '/dev/sdb1'
     uuid: '641A-A7DB'
     label: 'LIVE_USB'
    themed icons:  [drive-removable-media-usb]  [drive-removable-media]  [drive-removable]  [drive]
    symbolic themed icons:  [drive-removable-media-usb-symbolic]  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media-usb]  [drive-removable-media]  [drive-removable]  [drive]
    can_mount=1
    can_eject=1
    should_automount=1
    sort_key=gvfs.time_detected_usec.1546789639358749
    Mount(0): LIVE_USB -> file:///media/rick/LIVE_USB
      Type: GProxyMount (GProxyVolumeMonitorUDisks2)
      default_location=file:///media/rick/LIVE_USB
      themed icons:  [drive-removable-media-usb]  [drive-removable-media]  [drive-removable]  [drive]
      symbolic themed icons:  [drive-removable-media-usb-symbolic]  [drive-removable-media-symbolic]  [drive-removable-symbolic]  [drive-symbolic]  [drive-removable-media-usb]  [drive-removable-media]  [drive-removable]  [drive]
      can_unmount=1
      can_eject=1
      is_shadowed=0
      sort_key=gvfs.time_detected_usec.1546789639395990
  • The variable is_media_removable is set to 1 on my system but on the bug reporters system is is set to 0. I think this should have been addressed.
  • The bug reporter has can_eject=0 but my system has can_eject=1

Check your own gvfs-mount -li output to mine. Also consider subscribing to the bug reports above and/or posting there.

Related Question