Bug 1575952
Summary: | DVD can be ejected even though it is mounted | ||
---|---|---|---|
Product: | Red Hat Enterprise Linux 7 | Reporter: | Renaud Métrich <rmetrich> |
Component: | systemd | Assignee: | systemd-maint |
Status: | CLOSED NOTABUG | QA Contact: | qe-baseos-daemons |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 7.5 | CC: | kwalker, systemd-maint-list |
Target Milestone: | rc | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-02-18 17:49:58 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Renaud Métrich
2018-05-08 11:42:42 UTC
A workaround is to subsume the standard udev rule by creating the following script in /usr/local/bin: -------- 8< ---------------- 8< ---------------- 8< -------- # cat /usr/local/bin/eject_cdrom.sh #!/bin/bash # Script locking the CD when mounted. # For demo purposes only, not supported by Red Hat in any way!!! DEVICE="$1" if ! awk "\$1 == \"$DEVICE\" { exit 1 }" /proc/mounts; then logger -t "$(basename $0)" "There is a CDROM, ignoring EJECT request." else /usr/lib/udev/cdrom_id --eject-media $DEVICE fi # chmod +x /usr/local/bin/eject_cdrom.sh -------- 8< ---------------- 8< ---------------- 8< -------- Then, copy the /lib/udev/rules.d/60-cdrom_id.rules file into /etc/udev/rules.d so that udev uses the latter as an overload (it will disable the original rules in /lib/udev/rules.d/60-cdrom_id.rules): -------- 8< ---------------- 8< ---------------- 8< -------- # cp /lib/udev/rules.d/60-cdrom_id.rules /etc/udev/rules.d/ -------- 8< ---------------- 8< ---------------- 8< -------- Finally, edit the /etc/udev/rules.d/60-cdrom_id.rules file to use the /usr/local/bin/eject_cdrom.sh command instead of the original "cdrom_id" command on the DISK_EJECT_REQUEST line: -------- 8< ---------------- 8< ---------------- 8< -------- ENV{DISK_EJECT_REQUEST}=="?*", RUN+="/usr/local/bin/eject_cdrom.sh $devnode", GOTO="cdrom_end" -------- 8< ---------------- 8< ---------------- 8< -------- You may now try to monitor the system logs. If you have a mounted DVD and press the Eject button, nothing will happen, except the log message shown below: -------- 8< ---------------- 8< ---------------- 8< -------- eject_cdrom.sh[13512]: There is a CDROM, ignoring EJECT request. -------- 8< ---------------- 8< ---------------- 8< -------- If you have an unmounted DVD and press the Eject button, the button should work. Yep, this change was intentional. Users quite often think that the button on cd-rom is more hardware-ish and were wondering why they can't open it in some cases. So I would even say that the new behaviour matches the behaviour of floppy driver or usb flash drives :-). Anyway, unless there is a strong push to change this I would like to keep the current state and create a KB article with your workaround as an official suggestion for those that want the opposite. Based on the feedback in comment 3, I am closing this as NOTABUG. Please utilize the guidance in the following article should the alternative described behaviour be needed: [RHEL7] How to lock the DVD tray when a DVD is mounted - Red Hat Customer Portal https://access.redhat.com/solutions/3442081 |