Skip to content
Join readers who trust AllThings.How for practical guides Opens in a new tab

Fix VirtualBox "Unable to insert the virtual optical disk" (VERR_PDM_MEDIA_LOCKED)

Fix VirtualBox "Unable to insert the virtual optical disk" (VERR_PDM_MEDIA_LOCKED)

The "Unable to insert the virtual optical disk" error shows up the moment VirtualBox tries to load an ISO into a virtual machine's CD/DVD drive but the drive already has something locked in it. The full message usually ends with VERR_PDM_MEDIA_LOCKED, and it almost always appears when you pick Insert Guest Additions CD Image while a disc is still mounted and held open by the guest operating system. It is a host-side state problem, not a damaged disc, so the fix is to release the lock and re-mount cleanly.

Quick answer: Fully shut down the virtual machine, open Settings → Storage, select the optical drive holding VBoxGuestAdditions.iso, click the small CD icon and choose Remove disk from virtual drive (Force Unmount if asked). Start the VM again and re-insert the image.
VirtualBox unable to insert the virtual optical disk
The error appears when the optical drive already holds a locked disc image.

What VERR_PDM_MEDIA_LOCKED means

The error code is literal. The guest OS has locked the disc currently sitting in the virtual CD/DVD drive, so VirtualBox cannot swap in a new image on top of it. This frequently means the Guest Additions ISO is already loaded, or the same ISO is attached to another running virtual machine. The disc inside the guest is fine. The drive just will not accept a second image until the first one is released.

Because the lock lives on the host's view of the drive, forcing the guest to "auto-mount" or clicking Force Mount inside the guest does not resolve it. You have to clear the drive first.


Method 1: Eject the locked disc from the optical drive

This is the fastest fix and works on Windows, Linux, and macOS hosts.

Step 1: Shut the virtual machine down completely. Use a normal shutdown from inside the guest OS rather than a saved state. If a VM is in a saved state, start it and then shut it down properly.

Step 2: In the VirtualBox Manager, right-click the virtual machine and open Settings, then go to the Storage tab.

Step 3: Under Controller: IDE, select the optical drive that holds the Guest Additions disc. Click the small CD icon in the attributes area and choose Remove disk from virtual drive. If that option is greyed out, choose Remove Attachment instead.

Step 4: If VirtualBox asks, click Force Unmount. Save the settings, start the VM, and insert the Guest Additions image again from the Devices menu.

💡
If the same ISO is attached to a second virtual machine, remove it there too. An image held open by another VM will keep triggering the lock.

Method 2: Clear the disc from Virtual Media Manager

When the optical drive in Storage looks empty but the error persists, the image may still be registered globally.

Step 1: Shut down every open virtual machine. Any VM in a saved state should be started and then shut down so nothing keeps the media reserved.

Step 2: Open File → Virtual Media Manager in the VirtualBox Manager.

Step 3: Look for VBoxGuestAdditions.iso in the optical disks list. If it is checked or attached, release it. Removing it here detaches the registration that keeps the drive locked.

Step 4: Reboot the virtual machine and try inserting the image again. The drive should now accept it.


Method 3: The VM has no optical drive at all

A slightly different message, "machine has no optical drives," means the VM was created without a CD/DVD device. You cannot attach an ISO as a drive. The drive is the hardware; the ISO is the removable media that goes inside it.

Step 1: Shut down the virtual machine and open Settings → Storage.

Step 2: Next to the controller entry, click the disk icon with the green plus that adds an optical drive. When prompted, choose Leave empty.

Step 3: Start the VM, open the Devices menu and select Insert Guest Additions CD Image. If the lock error returns at this point, fall back to Method 1 to eject and re-insert.


Mount Guest Additions manually inside a Linux guest

If you only triggered the error while trying to install Guest Additions on a Linux guest, you can skip the swap entirely and mount the disc from inside the guest. After selecting Insert Guest Additions CD Image from the Devices menu, open a terminal in the guest.


sudo mkdir -p /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
cd /mnt/cdrom
sudo ./VBoxLinuxAdditions.run

Mount and run Guest Additions from the guest

On some systems the optical device shows up as /dev/sr0 instead. In that case use sudo mount /dev/sr0 /mnt/cdrom. If the basic mount fails, add the loop option with sudo mount -o loop /dev/cdrom /mnt/cdrom.

When you cannot mount it at all, copy the ISO into the guest and loop-mount the file directly. The image lives on the host at the path shown below.


sudo mkdir /media/GuestAdditionsISO
sudo mount -o loop path/to/VBoxGuestAdditions.iso /media/GuestAdditionsISO
cd /media/GuestAdditionsISO
sudo ./VBoxLinuxAdditions.run

Loop-mount a copied ISO file

A read-only warning during the mount is normal and does not stop the installer from running. You know the installation worked when the script finishes building kernel modules and tells you to reboot. After restarting, the guest display resizes with the host window, which is the clearest confirmation that Guest Additions loaded.

📁
On a Windows host the ISO is at C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso. On macOS it sits inside /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso.

Default ISO paths and device names by host

Host / GuestPath or device
Windows host ISOC:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso
macOS host ISO/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso
Linux guest optical device/dev/cdrom or /dev/sr0
Common mount points/mnt/cdrom, /media/cdrom0, /media/VBOXADDITIONS_xxx

Why the lock keeps coming back

If the error returns after a fix, only a few specific conditions are usually responsible. Work through them in order before retrying.

⚠️
The disc image is attached to a second virtual machine that is still running. Detach it from that VM and use the Insert Guest Additions CD Image menu item rather than wiring the ISO into Storage by hand.

The other common cause is starting the VM from a saved state. A saved state preserves the locked drive, so the eject never takes effect. Boot from a full shutdown, reproduce the issue once if needed, then shut down cleanly from inside the guest and apply Method 1.

One more point worth keeping straight. The virtual machine's CD drive is separate from the host's physical drive and gets its own letter inside a Windows guest, often D:. If you want the guest to read a disc sitting in the host's tray, point the VM at it through Devices → Optical Drives → Host Drive. Pointing the virtual drive at an ISO file instead of the physical disc avoids passthrough quirks entirely.

Once the drive ejects cleanly and the Guest Additions installer finishes, the lock is gone and the same ISO will mount on demand from the Devices menu without throwing the error again.