Adding an Optical Drive to the Virtual Machine

To do this we need to shut the VM down, then add a virtual DVD drive to the VM in VirtualBox GUI. The virtual DVD drive is where we will mount the VirtualBox Guest Additions - distributed as an .iso file

To shutdown the ubuntu/focal64 VM from the terminal, we can use the:

keith@hp-compaq-b:~/workspace/vagrant/focal64$ vagrant halt


With the VM Powered Off, in the VirtualBox GUI

Go to Settings->Storage and highlight Controller: IDE

Click the blue circle with a green + sign to add an optical drive.

In the 'Medium' 'Optical Disk Selector' window click the 'Add' icon with the green + sign

In the 'Please choose a virtual optical disk file' window, navigate to the directory where you downloaded the VBoxGuestAdditions_x.y.x.iso that matches the exact version of VirtualBox you are using. Highlight the VBoxGuestAdditions_.x.y.z.iso file you want to use and click the 'Open' button.

Back in the 'Medium' 'Optical Disk Selector' window click the 'Choose' button.

Click the 'OK' button to finish adding the optical drive.

Under Storage Devices -> Controller: IDE, you should now have an optical drive IDE Primary Device 0 with the VBoxGuestAdditions.iso attached to it. (In this example I installed VirtualBox 6.1.38 - so I need to use the matching VBoxGuestAdditions_6.1.38.iso file.)