Laptop:DELL inspiron 15 3521 (from 2014), BIOS version A12 OS: Xubuntu 16.04.6 , Kernel: 4.4.0-141-generic. I tried everything I found on internet (almost all of them are old posts +- 5,6 years-old) with no success! The only way for me is to introduce a pin on CD drive hole to pull up the tray. The CD drive works, it's recognized by the system, I can play and so on. Is there a fix to this issue ? I attached a output from (sudo eject -rv) command. Appreciate some help. "eject -rv" output
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 () 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.
Note: Answer now updated to function under 19.04
I'm on 14.04 and accidentally open my cd/dvd/bluray drive about 20 times a day. I've looked at a few questions here which provided no working solution.
Both this question and this question appear to be outdated -- the offered solution doesn't work.
When I do, eject -i on
I'm met with eject: unable to find or open device for: 'cdrom'
When I do, eject -i on /dev/sr0
I get a more favorable response: CD-Drive may NOT be ejected with device button
however the button is unfortunately still enabled.
The information from /proc/sys/dev/cdrom/info
suggests that locking is possible:
CD-ROM information, Id: cdrom.c 3.20 2003/12/17
drive name: sr0
drive speed: 24
drive # of slots: 1
Can close tray: 1
Can open tray: 1
Can lock tray: 1
Can change speed: 1
Can select disk: 0
Can read multisession: 1
Can read MCN: 1
Reports media changed: 1
Can play audio: 1
Can write CD-R: 1
Can write CD-RW: 1
This answer has a working solution which fixes a UDEV rule to enable locking the drive. I've added some practical info to the solution, allowing one to:
- Disable the optical drive hardware eject button at startup
- Add a keyboard shortcut to eject the optical drive
- Ensure the drive stays locked after waking from suspend
I'm new to Linux and have Ubuntu 11.04. After you eject an SD card, how do you reinsert a different one in the same slot? my computer wont recognize any after the first one and after the initial eject, the drive disappears in the disk utility. Thanks in advance
To secure unmount a usbdrive i use the eject button next to the drive-icon in nautilus before i plug it from the usb jack. But not always nautilus is in use and sometimes i have to start extra it for this purpose.
Which other different methods exist to quick secure unmount (eject) a removable usbdrive?