jeff's picture

I use VirtualBox when I need to run Windows, and it works beautifully. But today I went to install some Windows software off a CD and discovered that I could no longer connect the CD drive on my laptop to VirtualBox.

Normally you click on "Devices->CD/DVD Drives" and choose your host's CD/DVD drive from the list. (You can also use this to mount iso images as if they were CDs as well, which is a nice feature.) But today, there's no host CD drive listed, only the ISO images that I've previously used.

Now the last time I did this was probably 6 months ago. I don't use Windows very much and I almost never install new software. But I know it was working when last I needed this. So either a change to my system or a change in a VirtualBox upgrade has made the CD drive disappear. Regardless of the cause, I want that drive back.

I did a lot of googling and installed a bunch of packages that weren't already installed like "libhal-dev", but after all that VirtualBox still didn't see my host system's CD drive.

So in the end I decided to use the "big stick" approach. I found in the documentation that before it tries to find CD/DVDs drives on the host system, VirtualBox checks for the presence of the environmental variable "VBOX_CDROM". If that variable is set, then it simply uses the content of it instead of searching for drives on the host. Since I know my CD drive is "/dev/scd0", I enteredVBOX_CDROM='/dev/scd0'into the the "/etc/environment" file.

Now, voila, when I start VirtualBox it adds an item for my laptop's CD/DVD drive that I can use to mount the CD/DVD into the virtual Windows OS. It's a hack, but it works. :-)