After installing the virtual machine in VirtualBox, I want to change the virtual machine’s screen resolution in the virtual machine. So I click the VirtualBox Manager or Virtual Machine’s Devices —> Insert Guest Additions CD image… menu item.
But it shows the error message like Unable to insert the virtual optical disk C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the machine macOS. This article will tell you how to fix it.
1. The Detailed Error Messages.
- My virtual machine is macOS, so I get the below error message. If your virtual machine is Linux you will get the errors similar.
Unable to insert the virtual optical disk C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the machine macOS. Could not mount the media/drive 'C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso' (VERR_PDM_MEDIA_LOCKED). Result Code: E_FAIL (0x80004005) Component: ConsoleWrap Interface: IConsole {872da645-4a9b-1727-bee2-5585105b9eed} Callee: IMachine {85632c68-b5bb-4316-a900-5eb28d3413df}
2. The Steps To Fix The Error Unable To Insert The Virtual Optical Disk VBoxGuestAdditions.iso Into The Machine.
- Power off the macOS virtual machine.
- Right-click the macOS virtual machine in the VirtualBox manager left panel.
- Then click the Settings… menu item in the popup menu list.
- Click the Storage item on the left side.
- Then click the Adds optical drive. icon button on the right side.
- In the popup macOS – Optical Disk Selector window, select the VBoxGuestAdditions.iso from the Attached list.
- Click the OK button to save the selection.
- Now start the macOS virtual machine, you will find the VBox_GAs optical disk on the desk.
- Double click it to open it, and then double click the VBoxDarwinAdditions.pkg file to run it.
- If the installation failed at the end, you may need to disable the macOS System Integrity Protection feature ( How To Turn On/Off SIP (System Integrity Protection) On Mac OS ).
- And then run the below commands to enable the writing permission to the folder /System/Library/Extensions/.
sudo mount -uw / sudo chown :admin /System/Library/Extensions/ sudo chmod 775 /System/Library/Extensions/
- And now you can install the VBox guest additions in the macOS virtual machine.
3. How To Fix The Error Unable To Insert The Virtual Optical Disk VBoxGuestAdditions.iso Into The Machine When The Virtual Machine OS Is Ubuntu.
- If the virtual machine OS is Ubuntu, you can open a file explorer by clicking the Files icon on the left side.
- Then you can find the VBox_GAs_6.1.32 iso file on the Files explorer left side.
- Right-click the disk icon, then click the Properties menu item in the popup menu list to open the properties window.
- Then you can get the disk saved directory in the popup window, the path is something like /media/jerry.
- Go to the directory /media/jerry/VBox_GAs_6.1.32, we can find the file VBoxLinuxAdditions.run.
/media/jerry/VBox_GAs_6.1.32$ ls -l total 47008 -r--r--r-- 1 jerry jerry 763 20 2020 AUTORUN.INF -r-xr-xr-x 1 jerry jerry 6384 14 03:11 autorun.sh dr-xr-xr-x 2 jerry jerry 792 14 03:20 cert dr-xr-xr-x 2 jerry jerry 1824 14 03:20 NT3x dr-xr-xr-x 2 jerry jerry 2652 14 03:20 OS2 -r-xr-xr-x 1 jerry jerry 4821 14 03:11 runasroot.sh -r--r--r-- 1 jerry jerry 592 14 03:20 TRANS.TBL -r--r--r-- 1 jerry jerry 4029558 14 03:17 VBoxDarwinAdditions.pkg -r-xr-xr-x 1 jerry jerry 3949 14 03:10 VBoxDarwinAdditionsUninstall.tool -r-xr-xr-x 1 jerry jerry 7474611 14 03:11 VBoxLinuxAdditions.run -r--r--r-- 1 jerry jerry 9439232 14 03:02 VBoxSolarisAdditions.pkg -r-xr-xr-x 1 jerry jerry 16895432 14 03:17 VBoxWindowsAdditions-amd64.exe -r-xr-xr-x 1 jerry jerry 270840 14 03:12 VBoxWindowsAdditions.exe -r-xr-xr-x 1 jerry jerry 10000520 14 03:13 VBoxWindowsAdditions-x86.exe -r--r--r-- 1 jerry jerry 259 4 23:48 windows11-bypass.reg
- Run the file VBoxLinuxAdditions.run in the terminal like below.
$ sudo ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 6.1.32 Guest Additions for Linux........ VirtualBox Guest Additions installer Removing installed version 6.1.30 of VirtualBox Guest Additions... update-initramfs: Generating /boot/initrd.img-5.11.0-27-generic update-initramfs: Generating /boot/initrd.img-5.13.0-27-generic Copying additional installer modules ... Installing additional modules ... VirtualBox Guest Additions: Starting. VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while. VirtualBox Guest Additions: To build modules for other installed kernels, run VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup <version> VirtualBox Guest Additions: or VirtualBox Guest Additions: /sbin/rcvboxadd quicksetup all VirtualBox Guest Additions: Building the modules for kernel 5.13.0-27-generic. update-initramfs: Generating /boot/initrd.img-5.13.0-27-generic VirtualBox Guest Additions: Running kernel modules will not be replaced until the system is restarted
- When you see the above output message that means the installation is successful.
Worked, thx!