Bug 72206 - Optical media ejected by pressing optical device button is not unmounted (audio cds are not affected)
Summary: Optical media ejected by pressing optical device button is not unmounted (aud...
Status: REOPENED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) other
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
: 84374 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-12-01 18:48 UTC by Strangiato
Modified: 2017-07-21 13:11 UTC (History)
2 users (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH] Check if cdrom drive has media on cleanup (2.92 KB, patch)
2014-01-16 16:52 UTC, Tomas Bzatek
Details | Splinter Review

Description Strangiato 2013-12-01 18:48:57 UTC
I have a problem with some media types: DVD+R DL, DVD-R, DVD+RW and CD-R. Only audio CD works fine. I will explain...

audio cd (I think this is the correct behavior):
Insert the media in optical drive
the media is mounted and read without any problem
Press the optical device button to eject the audio cd
Nautilus automatically goes to home folder and the optical device icon disappears from nautilus left side and gnome-shell tray
insert other media type
the media is mounted and read without any problem again

DVD+R DL, DVD-R, DVD+RW and CD-R (annoying behavior)
insert the media
the media is mounted and read without any problem
press optical device button to eject the media
nautilus keeps showing the media content (???) and device icon on nautilus left side changes to "CD/DVD Drive"
insert other media immediately (except audio cd)
the system recognize the media because device icon name on nautilus changes to the media label (on gnome-shell tray is still "CD/DVD Drive"), but nautilus shows no file (???)
if I eject and reinsert the media using the optical device button I have the same result
I need eject the media using nautilus or gnome-shell icon to access the new media files



After eject problematic media I run below command

mount|grep sr0


My system says that the media is still mounted.
I insert other media and run the command again and it says that the previous media is mounted.  
My system is not umount/mount media correctly.

My optical device: BenQ DW1640 (IDE) with latest firmware (BSRB)
Thanks.
Comment 1 Tomas Bzatek 2014-01-16 16:52:00 UTC
Created attachment 92238 [details] [review]
[PATCH] Check if cdrom drive has media on cleanup

When cleanup is run, it is supposed to remove lingering mounts.
That probably works fine for card readers etc. since there's
a partition exposed for the drive but fails for optical media.
As a result, when mounted and user presses the drive eject
button, tray is ejected but mounts lives on.

This patch adds a special check for CDROM drives and looks for
active media.

--

The test is highly cdrom-specific and should not break anything else. On the other hand, not sure if there are e.g. card readers not exposing the "partition" device type, only presenting itself as a "disk". Haven't tested that, my concern was a flash medium having no partition table, used directly. Or, a ZIP drive (ATAPI vs. floppy mode) and such...
Comment 2 David Zeuthen (not reading bugmail) 2014-01-16 17:08:55 UTC
Hmm, I'm not sure this is the right fix so please don't commit it. I'll try to reproduce this...
Comment 3 Tomas Bzatek 2014-01-20 16:52:20 UTC
(In reply to comment #2)
> Hmm, I'm not sure this is the right fix so please don't commit it. I'll try
> to reproduce this...

Reproducing this is easy:
1. Insert CD/DVD media
2. Let Gnome/gvfs automount it (clean system, defaults)
3. Press the eject button on the drive
4. Watch the mount staying alive

Note that udisks cleanup routine properly registers the event, it's all about matching the cleanup conditions.
Comment 4 quellen 2014-06-17 11:50:00 UTC
I have the same problem. Can you solve please? Thanks.
Comment 5 lynx.light0 2014-09-26 16:42:21 UTC
Yes. This needs to be fixed.

See:

https://bugs.archlinux.org/task/42071
Comment 6 Tomas Bzatek 2014-09-29 13:25:57 UTC
*** Bug 84374 has been marked as a duplicate of this bug. ***
Comment 7 lynx.light0 2014-10-05 09:17:42 UTC
(In reply to Tomas Bzatek from comment #3)
> (In reply to comment #2)
> > Hmm, I'm not sure this is the right fix so please don't commit it. I'll try
> > to reproduce this...
> 
> Reproducing this is easy:
> 1. Insert CD/DVD media
> 2. Let Gnome/gvfs automount it (clean system, defaults)
> 3. Press the eject button on the drive
> 4. Watch the mount staying alive
> 
> Note that udisks cleanup routine properly registers the event, it's all
> about matching the cleanup conditions.

Thomas: can you not commit your patch? This is a much needed fix, and, even if your fix is not perfect, there has been no movement towards improvement in over 6 months.
Comment 8 Martin Pitt 2015-01-28 13:12:07 UTC
This was discussed recently on the systemd (udev) mailing list:

http://lists.freedesktop.org/archives/systemd-devel/2015-January/026948.html
http://lists.freedesktop.org/archives/systemd-devel/2015-January/027403.html

After a lot of back and forth, it was decided that the most robust fix under systemd is

http://lists.freedesktop.org/archives/systemd-devel/2015-January/027577.html

For the record, for distros without systemd it is easiest to adjust /lib/udev/rules.d/60-cdrom_id.rules like this:

-ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"
+ENV{DISK_EJECT_REQUEST}=="?*", RUN+="/usr/bin/eject $devnode", GOTO="cdrom_end"
Comment 10 Strangiato 2015-11-29 17:55:07 UTC
This problem is back in Fedora 23 64 bits.
Comment 11 Strangiato 2016-03-17 16:19:54 UTC
This problem is back in Arch linux with systemd 229 too.
Comment 12 Strangiato 2016-09-05 13:31:21 UTC
Any progress with this annoying and old bug?
This is still present on Arch running with systemd 231.
Comment 13 Strangiato 2017-07-20 18:12:27 UTC
Any comment about this report?
This problem is still happening with systemd 233 on Arch.
Comment 14 Strangiato 2017-07-20 22:07:32 UTC
This is not a systemd bug.
I am testing a distro without systemd (it uses OpenRC) and the same problem happens.
Can anyone tell me where is the problem?
Can it be a kernel bug?


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.