Quick Tip – When Linux Won’t Give Your CD Back 04/02/08


Just a quick tip I wanted to pass on today. Have you ever had the issue where you want to eject your CD, but it will not eject; no matter how many times you press the eject button? Annoying isn’t it? :) I remember when I first started using Linux, years ago, (my OS was RedHat then), I actually would reboot the system just to get the CD out! Obviously, that’s not too smart.

One of my friends (a brand new user) just ran into this issue. He phoned me because he thought it was a bug. (It’s not). For any new users out there. Here is a quick fix to force the CD to eject:

sudo umount /media/cdrom0/ -l

Just run the above command in a terminal, and you’ll get your CD back.

Easy! :)

Oh… and if you want to mount it and see any hidden files on it:

sudo mount /media/cdrom0/ -o unhide

Sharing is loving!

You can leave a response, or trackback from your own site.

11 Responses to this article

Tara April 2, 2008 Reply

You know, I’m glad you posted this. I get this a few times and I just leave the cd until I bot up again. Or if I really need it I was rebooting just to get it.
Thank you for the tip.

UbuntuLinuxHelp April 2, 2008 Reply

@ Tara – I’m glad it was useful to someone. Thanks!

rick April 3, 2008 Reply

You can straighten out a paper clip and push it into the little hole on the front of any CD or DVD drive. Best done with the power off and be sure to push it in straight. You will meet some resistance, keep pushing and the mechanical part of the drawer will move it open.

menachem April 4, 2008 Reply

Don’t forget the “eject” command, which will not only unmount the CD, but eject the tray as well.

sudo eject

UbuntuLinuxHelp April 4, 2008 Reply

@menachem – Argh!! I’m a dope! :) Hee hee hee… I forgot about sudo.
Nice comment! ;) At least one of us know’s what we’re doing, and that’s obviously you. :)

kuratkull April 8, 2008 Reply

Thanks, I have this problem when my K3B burn fails. I just can’t get the failed cd out without a reboot :(


Stephan Beal April 8, 2008 Reply

When this happens, it is often (but not always) because you have some process (e.g. a file browser or a terminal) which is opened to that dir (e.g. open an xterm and cd /media/cdrom0). As long as that’s the case, the directory is “busy” and cannot be unmounted without extra effort. When this happens, first make sure you haven’t got a file or dir open on the drive, or that you aren’t running some process which holds the device open (e.g. k3b). Then try the “eject” command. Don’t use the paper-clip trick on a running system unless you have no other choice.

UbuntuLinuxHelp April 8, 2008 Reply

@Stephan Beal – You are totally correct. A case in point, last week I used the paper clip method and created a coaster out of my CD. I didn’t realize it was still spinning when I forced it open and the noise alone made me think I damaged the CD burner. The CD itself was scratched up like it had been spinning on sandpaper. So, common sense, I should have carefully listened first! ;)

Vadim P. April 15, 2008 Reply

Imo it should tell you at least that some program (preferably *which*!) is using the CD drive, so you actually know…

pedobear July 1, 2008 Reply

thanks for the tip.

raymon July 31, 2010 Reply

My Backtrack4-livedvd will not eject after ended session.Backtrack 4 is ubuntu-based,the predecessor was not.I tried the above suggestions as well as shutdown -P 0 and poweroff-commands.
Strangely enough in Backtrack3,the live dvd ejected automatically after ended session.I have to use a needle now to manually eject the cd-tray.
I guess this is an inherent ubuntu-issue,but maybe there is some ubuntu-commands i don’t know of.

Leave a Reply

close comment popup

Leave A Reply