Working with CDs in my current Ubuntu installation is proving to be quite annoying, as more often than not when trying to eject a CD the proper way by right-clicking on the icon and clicking Eject, I get greeting with an error message telling me the stupid machine won’t eject the disc – and if I simply eject via the eject button, Ubuntu won’t automatically mount a new disc that I insert because as far as its concerned, the old CD mount is still in place!
“Failed to eject media; one or more volumes on the media are busy” is the error message in case you were wondering.
What basically is happening is that one or more applications are services are trying to access the disc in the drive and even if they aren’t actively using the disc, they are nonetheless keeping it “busy”.
To force a clean unmount and eject, you can simply run this command via a terminal or by the Alt+F2 shortcut:
sudo umount -l /media/cdrom0 && eject
Note that since Ubuntu now automatically mounts points for discs based on label, you might want to confirm the mount point by running the following to get a listing of devices:
mount|grep ^'/dev'
But 9 out of 10 times /media/cdrom0 will be the one for you.
Nifty.