Known Ubuntu 12.04 CD Eject Failure Problem

Asked by Julianloui on 2012-06-21

Even though I am a Linux novice, recently I've done an extensive investigation of Ubuntu 12.04's strange CD eject problem. It appears to be an initialization of some sort. By the way, I am a retired electrical engineer with experience in hardware and software troubleshooting. I don't mean to boast. I just want to emphasize that my data has been collected objectively.

Hardware: HP d530 tabletop computer running only Ubuntu 12.04

1. I can mount and eject a CD from the system before Linux boots up while BIOS is running.

2. This problem prevails as soon as Linux takes over from BIOS and essentially blocks the user from opening the CD tray. When the eject button is pushed, the CD LED fails to light up and the tray remains locked. Obviously this condition is caused by Ubuntu 12.04 and not the hardware.

3. The same problem remains even though I have re-installed Ubuntu 12.04 twice on the same machine.

4. I have never experienced this kind of problem with Ubuntu 11.04, which shares another HP computer with Windows XP, where I can open and close the CD tray freely, as though I were running Windows XP.

5. I've run an interesting experiment in which I pre-load the CD drive with a CD prior to activating Ubuntu12.04. Initially everything works fine after 12.04 comes up. However, the lock-up problem soon returns after a short while. This is what leads me to suspect that the root cause may be some sort of improper initialization. By the way, my experiment's results re repeatable.

6. There is no question as to the soundness of the CD drive's hardware. Before switching my HP d530's O.S. from Windows XP to Ubuntu 12.04, I never had a single problem with the CD drive in three years.

7. If it were not for my repeated failures to install Ubuntu 11.04 successfully on the HPd530, I would have loved to drop 12.04 from this machine as 11.04 is far more user-friendly and accepts both my Linksys wireless-G adapter and IOGear wireless-N adapter instead of only the IOGear one. An interesting thing is that the same Ubuntu 11.04 installation CD works perfectly in a Wubi environment but won't even work off the CD itself before any installation is attempted on the HPd530 tabletop.

I hope I've presented my data clearly enough and will appreciate any advice from the Ubuntu community.


Question information

English Edit question
Ubuntu gnome-media Edit question
No assignee Edit question
Solved by:
Doug McMahon
Last query:
Last reply:

This question was reopened

If you run:

sudo eject /dev/sr0

Does it open?

Best Doug McMahon (mc3man) said : #2

It may be that the current default is to lock the drive (eject protection
You could test by , assuming your cd drive is /dev/sr0

With a disc in drive run this, then try the eject button on drive

eject -i 0 /dev/sr0

Julianloui (julianloui) said : #3

Thanks Doug McMahon, that solved my question.

Julianloui (julianloui) said : #4

Hi, Andrew and Doug,

Thank you both for your kind help.

Previously I did try 'sudo eject /dev/sr0' and Ubuntu 12.04 would come back with 'eject: Unable to eject, last error: Inappropriate ioctl for device'.

Now if I begin a Linux session with Doug's suggested command, Ubuntu 12.04 would always let me open the CD tray with the eject button or the simple 'eject' command whether the tray is empty or not. Actually in response to the user's first 'eject -i 0 /dev/sr0' command, Ubuntu helpfully displays 'CD-Drive may be ejected with device button'.

To simplify typing, I have added to the .bash_aliases file a new alias as follows:
# CD eject
alias ejt='eject -i 0 /dev/sr0'


Doug McMahon (mc3man) said : #5

The locking of the drive tray is intended, maybe it was bugged/broken in 11.04 or not yet set as default.
(I remember some nonsense about not wanting laptops in a travel case having media inadvertantly ejected

Anyway I'm not sure if this is a udev or kernel deal though you can clearly see in
/lib/udev/rules.d/60-cdrom_id.rules in the 2nd to last section

Because I have a borky ultra slimline here having the eject button available is a plus though generally use nautilus in most cases.
So here I edited the line to this, though not sure if parameter is valid or if not it has the effect of invalidating the line.

IMPORT{program}="cdrom_id --unlock-media $tempnode"

This works better here better than any other option concerning line. The .rules file is good unless udev updates, then it would need re-editing

Shaikailash (steve-doc-brown) said : #6

Hi, I have the same annoying problem on two machines, but I don't understand, if this is a bug as it seems, shouldn't be fixed through an official update (and not a manual fix)? Thanks

Julianloui (julianloui) said : #7

Hi, Shaikailash,

As Doug McMahon indicates, this may have been an intended fix introduced by Ubuntu in 12.04 even though I doubt very much its practicality. If you look at the link I am providing below, you'll see that it was meant as a fix.

In any case, you can resolved this problem at boot-up time by issuing the following command to unlock the CD tray:

eject -i 0 /dev.sr0

Julianloui (julianloui) said : #8

Hi, Shaikailash,
I've just responded to your message at the Ubuntu Launchpad site.
From: "Shaikailash" <email address hidden>
Sent: Sunday, November 11, 2012 4:51 AM
To: <email address hidden>
Subject: Re: [Question #201133]: Known Ubuntu 12.04 CD Eject Failure Problem

> Your question #201133 on gnome-media in Ubuntu changed:
> Shaikailash posted a new comment:
> Hi, I have the same annoying problem on two machines, but I don't
> understand, if this is a bug as it seems, shouldn't be fixed through an
> official update (and not a manual fix)? Thanks
> --
> You received this question notification because you asked the question.

Julianloui (julianloui) said : #9

Julianloui's typo correction to his Message #7:

The command line should have been entered as follows:

eject i -0 dev/sr0


Julianloui (julianloui) said : #10

Thanks Doug McMahon, that solved my question.

carlosv (cvedovatti) said : #11

To be honest guys, I dont get what is the solution for this problem. The command eject i -0 dev/sr0, didn't solve for me this problem. Should I add it to any specific location that command?

Julianloui (julianloui) said : #12


I think I can help you better if you call me at 7five7-four3zero-2782. Make sure that your cd drive's location is dev/sr0.