4

My Thinkpad T420 has a problem. It's just too sensitive. I just slightly touch it on the right side, and woosh, the DVD drive pops open. (I think this is called a premature ejection :)).

Is there a way to disable the eject button? I'm running Linux (Fedora 17).

4
  • This is not a exact duplicate. The question you refer ask how to disable the button on Windows and the answer is a program called LockCD on Windows. I'm running Linux, so the answer does not help me. I'll flag this for moderator attention to reopen it.
    – iblue
    Dec 27, 2012 at 22:52
  • I was posting an answer but couldn't because this got locked. FWIW I don't think that is an exact dupe either. Here's what I was gonna post; will add as answer if this gets unlocked: You can try cdctl -o or cdctl --lockdoor (cdctl website).
    – Karan
    Dec 27, 2012 at 23:06
  • Thank you, I tried that, it did not work. cdctl -o expects a numeric argument. I tried 0 and 1, both do not lock the door. I also tried eject -i 1 /dev/sr0 and echo 1 > /proc/sys/dev/cdrom/lock as root and manually sending a CDROM_LOCKDOOR ioctl to the device. Nothing seems to work.
    – iblue
    Dec 27, 2012 at 23:15
  • Hmm, cdctl generally works. Perhaps your laptop's drive does not support the lock function.
    – Karan
    Dec 28, 2012 at 17:12

1 Answer 1

3

This is a repost of an answer I provided to my own identical question on the Unix & Linux site titled: How can I disable the button of my CD/DVD drive?.


The problem is definitely caused by UDEV as you've guessed. The issue is this line that is in most UDEV files related to the cdrom drive.

Example

On Fedora 19 there is the following file, /usr/lib/udev/rules.d/60-cdrom_id.rules. In this file is the following line which is co-opting the eject button for CD/DVD devices.

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

You can work around the issue and disable UDEV's ability to co-opt the eject button by doing the following:

  1. Make a copy of the file 60-cdrom_id.rules

    $ sudo cp /usr/lib/udev/rules.d/60-cdrom_id.rules /etc/udev/rules.d/.
    
  2. Edit this copied version of the file and comment out the line containing the string, DISK_EJECT_REQUEST.

    $ sudoedit /etc/udev/rules.d/60-cdrom_id.rules
    
  3. Save the file and the change should be noticeable immediately!

The above solution fixes the problem for both eject and cdctl. So now the following commands work as expected:

lock the drive

$ eject -i on /dev/sr0
eject: CD-Drive may NOT be ejected with device button

-or-

$ cdctl -o1

unlock the drive

$ eject -i off /dev/sr0
eject: CD-Drive may be ejected with device button

-or-

$ cdctl -o0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .