[arch-general] Issue with 'eject -T'

Ralf Mardorf silver.bullet at zoho.com
Sat Oct 19 10:37:36 UTC 2019


On Sat, 2019-10-19 at 11:54 +0200, Guus Snijders wrote:
> Op za 19 okt. 2019 11:30 schreef Ralf Mardorf via arch-general <arch-general at archlinux.org>:
> > Hi,
> > 
> > 'eject -T' doesn't work anymore on my machine, resp. opening the DVD
> > drive doesn't work anymore, when using the traytoggle option. Opening
> > still works without an option and closing with the traytoggle option
> > also still works.
> > 
> > $ eject -V
> > eject from util-linux 2.34
> > $ eject -T
> > eject: CD-ROM eject command failed: Device or resource busy
> 
> 2 things that come to mind; 
> 
> - check the kernel messages  (dmesg), there could be something useful

Hi,

there are no useful messages.

> - does eject (close) work as root? It could be a weird permission issue

Oops, yes, with root privileges the traytoggle option works for opening
and closing, but without root privileges the user can only open the tray
by using 'eject' without the toggle option.

There's an udev rule from end of last month, maybe it stopped already
working in the end of last month.

I don't understand the content of the udev rule, but as soon as I've got
more time, I'll take a look, if the rule did look different before.

[rocketmouse at archlinux ~]$ ls -hl /usr/lib/udev/rules.d/60-cdrom_id.rules 
-rw-r--r-- 1 root root 1.1K Sep 22 20:35 /usr/lib/udev/rules.d/60-cdrom_id.rules
[rocketmouse at archlinux ~]$ cat /usr/lib/udev/rules.d/60-cdrom_id.rules 
# do not edit this file, it will be overwritten on update

ACTION=="remove", GOTO="cdrom_end"
SUBSYSTEM!="block", GOTO="cdrom_end"
KERNEL!="sr[0-9]*|vdisk*|xvd*", GOTO="cdrom_end"
ENV{DEVTYPE}!="disk", GOTO="cdrom_end"

# unconditionally tag device as CDROM
KERNEL=="sr[0-9]*", ENV{ID_CDROM}="1"

# stop automatically any mount units bound to the device if the media eject
# button is pressed.
ENV{ID_CDROM}=="1", ENV{SYSTEMD_MOUNT_DEVICE_BOUND}="1"

# media eject button pressed
ENV{DISK_EJECT_REQUEST}=="?*", RUN+="cdrom_id --eject-media $devnode", GOTO="cdrom_end"

# import device and media properties and lock tray to
# enable the receiving of media eject button events
IMPORT{program}="cdrom_id --lock-media $devnode"

# ejecting a CD does not remove the device node, so mark the systemd device
# unit as inactive while there is no medium; this automatically cleans up of
# stale mounts after ejecting
ENV{DISK_MEDIA_CHANGE}=="?*", ENV{ID_CDROM_MEDIA}!="?*", ENV{SYSTEMD_READY}="0"

KERNEL=="sr0", SYMLINK+="cdrom", OPTIONS+="link_priority=-100"

LABEL="cdrom_end"
[rocketmouse at archlinux ~]$ ls -hl /usr/lib/udev/cdrom_id 
-rwxr-xr-x 1 root root 30K Sep 22 20:35 /usr/lib/udev/cdrom_id
[rocketmouse at archlinux ~]$ file -i /usr/lib/udev/cdrom_id 
/usr/lib/udev/cdrom_id: application/x-pie-executable; charset=binary

Regards,
Ralf


More information about the arch-general mailing list