Up until Fedora 14 I was successfully using cdctl to enable/disable the CD/DVD eject button on my laptop (Thinkpad T410). Sadly it has stopped working now.I've consulted the methods discussed in these 2 questions:disable cd/dvd button on linux laptop (ubuntu)Disable the DVD eject button on a Thinkpad running LinuxNone of which have worked for me. So I turn back to cdctl to see if we can't fix what's broken with it, since it's worked for so long.Debugging the issueSo starting with cdctl switches I notice that most things seem to work just fine.ExamplesThese things work.ejects the drive$ cdctl -elist capabilities$ cdctl -kTray close             : 1Tray open              : 1Can disable eject      : 1Selectable spin speed  : 1Is a jukebox           : 0Is multisession capable: 1Can read the MCN (UPC) : 1Can report media change: 1Can play audio discs   : 1Can do a hard reset    : 1Can report drive status: 1According to that list cdctl even thinks that it can enable/disable the eject button.Can disable eject      : 1So I continue on with debugging the issue.Debugging cdctlSo I figure lets do an strace on cdctl to see if it can shed some light on what's going on.$ strace cdctl -o1...brk(0)                                  = 0x1371000open(/dev/cdrom, O_RDONLY|O_NONBLOCK) = -1 ENOENT (No such file or directory)open(/dev/cd, O_RDONLY|O_NONBLOCK)    = -1 ENOENT (No such file or directory)open(/dev/scd0, O_RDONLY|O_NONBLOCK)  = -1 ENOENT (No such file or directory)open(/dev/sr0, O_RDONLY|O_NONBLOCK)   = 3ioctl(3, CDROM_LOCKDOOR, 0x1)           = 0close(3)                                = 0exit_group(0)                           = ?+++ exited with 0 +++Curiously it seems like cdctl thinks it's disabling the button. $ strace cdctl -o1ioctl(3, CDROM_LOCKDOOR, 0x1)           = 0$ strace cdctl -o0ioctl(3, CDROM_LOCKDOOR, 0)             = 0NOTE: If I understand this right, the return of a 0 means it was successful.One thing that caught my eye here was the list of devices that cdctl is attempting to interact with. So I thought what if I try these devices with eject?eject commandOne of the other commands I used to use years ago was the eject command to interact with the CD/DVD device. I noticed that this command also now has a similar named switch:$ eject --help -i, --manualeject <on|off>  toggle manual eject protection on/offExample$ eject -i 1 /dev/sr0eject: CD-Drive may NOT be ejected with device button$ eject -i 0 /dev/sr0eject: CD-Drive may be ejected with device buttonSo eject too thinks that it's disabling the button, yet it isn't either. Using strace here I see the same system calls:$ strace eject -i 1 /dev/sr0 |& grep ioctlioctl(3, CDROM_LOCKDOOR, 0x1)           = 0$ strace eject -i 0 /dev/sr0 |& grep ioctlioctl(3, CDROM_LOCKDOOR, 0)             = 0So now I'm wondering if UDEV or something else is potentially blocking or taking ownership of device?Thoughts?
How can I disable the button of my CD/DVD drive?
linux;data cd;eject
Thanks to @Affix's answer which gave me the right direction to head, I've figured out the solution to the problem.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.ExampleOn 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_endYou can work around the issue and disable UDEV's ability to co-opt the eject button by doing the following: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/.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.rulesSave 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/sr0eject: CD-Drive may NOT be ejected with device button-or-$ cdctl -o1unlock the drive$ eject -i off /dev/sr0eject: CD-Drive may be ejected with device button-or-$ cdctl -o0