1

I am trying to close and eject cd from the commandline. The purpose is to rip a lot of audio cds with abcde.

I use eject and eject -t commands to open and close the cd drive.

I mount my cdrom with this line in /etc/fstab:

/dev/sr0        /media/cdrom0   udf,iso9660 user,noauto     0       0

The problem is that ejecting the cd means also to unmount it. After the unmount, there is no way to close it.

When I start the computer, eject -t works and closes the tray. But if I open it again (with eject) eject -t does not find /dev/cdrom because it is not mounted (the tray is open and there is no cd mounted).

Someone sees a simple solution?

P-S : Debian (unstable) system.

ppr
  • 1,887
  • 7
  • 23
  • 40
  • 1
    /dev/cdrom is not mounted if you start the computer with the tray open either, so that can't be the problem. **Please show the exact error message from eject**. I wonder if `eject /dev/sr0` works. – sourcejedi Jul 25 '17 at 16:02
  • 1
    @DopeGhoti It works! the solution was so simple! Turn this into and answer and I will accept it. – ppr Jul 25 '17 at 16:02
  • 1
    Also well done for saying Debian, but please always say what version as well. – sourcejedi Jul 25 '17 at 16:02

1 Answers1

3

In my past experience, mount /dev/cdrom will, if the tray is open, close the tray and attempt to mount a disc, if present.

DopeGhoti
  • 73,792
  • 8
  • 97
  • 133