When you first install a Linux virtual machine using VirtualBox, you might find the experience sub-par. VirtualBox Guest Additions upgrade your VM experience by bringing additional features to the table, including a shared clipboard, drag-and-drop file sharing, and adaptive display scaling support.
But knowing you need to add Guest Additions to your virtual machines isn’t as intuitive as it should be. Whether you’re using Ubuntu, Fedora, or any other Linux distribution, installing VirtualBox Guest Additions on your Linux machine is rather easy, and we’ll show you how to do it.
Install VirtualBox Guest Additions on Linux
Installing Guest Additions is one of the many ways to supercharge your virtual machines. Before you can install Guest Additions, you need to create at least one virtual machine using VirtualBox. Make sure to install the operating system as you won’t be able to install Guest Additions on a live operating system.
On Ubuntu and Debian
Note that this method will also work for other Debian-based distributions, including Kali Linux and Linux Mint.
Launch VirtualBox and start the Ubuntu or Debian virtual machine. Let it boot and wait for the desktop to load. Update and upgrade the existing packages on your system by typing:
sudo apt update && sudo apt upgrade
Then, run the following command to install some necessary packages:
sudo apt install build-essential dkms linux-headers-$(uname -r)
Next, click Devices from the VirtualBox menu and select Insert Guest Additions CD image. If you’re using Ubuntu, you’ll notice a disk icon appear in the dock. Click it to view the contents of the inserted image. On Debian or other distributions, you can view the files inside the disk image using any preinstalled file manager.
Right-click the autorun.sh script and select Run as a Program from the context menu.
A new terminal window will appear and the system will ask you for your password. Enter your administrator password to continue. Once done, the terminal will display the progress of the installation.
If you prefer executing commands from the terminal, first, change the directory to the inserted media by typing:
Make sure to substitute “username” in the command with your actual username. You can also use the lsblk command to view the exact path where the system has mounted the media.
Once you’re inside the directory, execute the autorun.sh script by typing:
Enter your administrator password and when the terminal displays “Press Return to close this window“, hit Enter and reboot the system for the changes to take effect.
On Arch-Based Distros
Installing VirtualBox Guest Additions on Arch Linux and Manjaro is relatively easier than on other Linux distributions. This is because you can directly install the virtualbox-guest-utils package from the official Arch repository instead of manually installing it using the disk.
Many Arch-based Linux distributions often include the Guest Additions package when you install them on a virtual machine. If your installation doesn’t offer Guest Additions support by default, start by updating the package sources on your system:
sudo pacman -Syyu
Next, install the virtualbox-guest-utils package by typing:
sudo pacman -S virtualbox-guest-utils
Finish by restarting the virtual machine. This ensures any changes you’ve made to the system get saved.
On Fedora, CentOS, and RHEL
When you install Fedora on VirtualBox, you’ll notice that it comes with VirtualBox Guest Additions preinstalled. This allows you to scale the resolution of the virtual machine by resizing the VirtualBox window, share the clipboard between the host and VM, and bidirectional drag-and-drop file sharing.
But if you’re running other RPM-based distributions, you might have to install Guest Additions manually. To do that, begin by starting the virtual machine. Then, click Devices > Insert Guest Additions CD image from the top menu bar. In the pop-up that follows, select Run.
Alternatively, you can also open the folder using a file manager and click the Run Software prompt located right below the top bar.
Enter the administrator password to authenticate the operation. A terminal will pop up and install the necessary modules. Once you notice the “Press Return to close this window” prompt on the terminal, press Enter and restart the virtual machine.
How to Uninstall VirtualBox Guest Additions on Linux
Although VirtualBox Guest Additions bring only good to the table and there’s no real harm in keeping them installed, in case you want to uninstall them, doing so is a piece of cake.
You can verify if VirtualBox Guest Additions are successfully removed from the virtual machine by resizing the VM window. If the display doesn’t scale according to the window size, or you’re unable to copy and paste text from the host to the VM or vice versa, you can conclude that the Guest Additions package has been removed.
On Ubuntu and Debian
On Ubuntu and Debian, change the present working directory to /opt/VBoxGuestAdditions-[version]. If you don’t know the exact version number, you can press Tab after typing the command up to “Additions” to trigger autocomplete.
Then, execute the uninstallation script by typing:
After the process is complete, restart the virtual machine and verify the changes.
On Arch Linux and Manjaro
Uninstalling VirtualBox Guest Additions on Arch-based distributions like Manjaro is as simple as removing the virtualbox-guest-utils package using Pacman:
sudo pacman -Rns virtualbox-guest-utils
On Fedora and Other RPM-Based Distros
To remove VirtualBox Guest Additions on Fedora, type the following command and type y when prompted:
sudo dnf remove virtualbox-guest-additions
If you manually installed Guest Additions, you need to execute the uninstallation script located at /opt/VBoxGuestAdditions-[version]. First, change your current working directory using the cd command:
Since you won’t know the exact version of the package installed beforehand, you can let the shell auto-complete your command by hitting Tab while typing the folder name.
Run the uninstallation script by typing:
Finally, restart the virtual machine to verify if the changes persist.
Virtual Machine Setups Made Easy With VirtualBox
VirtualBox Guest Additions are a must if you’ve installed a Linux distribution on VirtualBox and want to enjoy the complete desktop experience. Usually, without Guest Additions, your virtual machines will have a fixed display resolution, with no support for clipboard sharing or drag-and-drop file transfer.
If you tried VirtualBox and didn’t find it to be intuitive or convenient enough, you’re always free to try other virtualization software. VMware and Hyper-V are two other hypervisors that offer features similar to VirtualBox. Which one’s the best? The answer will depend on your preference and use case.