shadyabhi@shadyabhi-desktop:~$ eject -v
eject: using default device `cdrom'
eject: device name is `cdrom'
eject: expanded name is `/media/cdrom'
eject: `/media/cdrom' is a link to `/media/cdrom0'
eject: `/media/cdrom0' is not mounted
eject: `/media/cdrom0' is not a mount point
eject: tried to use `/media/cdrom0' as device name but it is no block device
eject: unable to find or open device for: `cdrom'

The tray doesnt open.. How do I open tray using command line?

I am using Ubuntu 9.10 64bit and I have no dvd inserted in the DVDROM...

  • Please post details about the DVD-ROM drive in this computer. – Broam Apr 5 '10 at 20:45

Depending on your device and how it is set up one of those commands should work:

eject /dev/cdrom
eject /dev/cdrw
eject /dev/dvd
eject /dev/dvdrom
eject /dev/dvdrw

If none of these work then look for the correct device in the list generated by this command:

ls -l /dev | grep '\->'

You can also specify the raw device:

eject /dev/sda
eject /dev/hdd
  • eject: unable to find or open device for: ******.. For all of them, same errors... And I want to make a point that I dont have any DVD loaded in the DVDROM. – Abhijeet Rastogi Mar 28 '10 at 10:21
  • Do you know to wich device node your drive is bound? – lajuette Mar 28 '10 at 10:26
  • try this: ls -l /dev | grep '\->' if your dvd device is properly recognized by your system it will be on that list. On my system I get, along with some junk: 'dvd -> hda' and 'cdrw -> hda', eject /dev/dvd, eject /dev/hda, and eject /dev/cdrom all work – Justin Smith Mar 28 '10 at 17:01
  • the absence of a dvd in the drive will not affect any of these commands at all – Justin Smith Mar 28 '10 at 17:02
  • cdrom2 -> sr0, cdrw2 -> sr0, core -> /proc/kcore, dvd2 -> sr0, dvdrw2 -> sr0... is the output.. I now did "eject /dev/dvd2"... And now it works.. Thanx.. – Abhijeet Rastogi Mar 30 '10 at 20:48

Try $ eject -t


Try eject -T.


You may need to name the device or mount point. It may be something other than the ones that it automatically tried. Look at the output of mount to see which ones might be it.

  • not working. same error – Abhijeet Rastogi Mar 27 '10 at 22:35
  • Actually, I have no DVD inserted, so there isnt anything mounted.. So, what can I do now? – Abhijeet Rastogi Mar 28 '10 at 10:20

The only way that I could find to make eject to detect cdrom by default (without any options or arguments):

echo "/dev/sr0  /media/cdrom0  udf,iso9660 user,noauto  0 0" >> /etc/fstab
mkdir -p /media/cdrom0
cd /media
ln -s cdrom0 cdrom

You may have to change sr0 to scd0 depending on your system

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.