Brief: Install VirtualBox Guest Additions in Ubuntu and with this you’ll be able to copy-paste, drag and drop between the host and guest system. It makes using Ubuntu in virtual machine a lot easier.
The VirtualBox Guest Additions consist of device drivers and system applications that optimize the operating system for better performance and usability. These drivers provide a tighter integration between the guest and host systems.
No matter how you are using your Virtual Machine, Guest Additions can be very helpful for you. For example, I test many installations and applications inside a VM and take a lot of screenshots. It comes in very handy to be able to move those screenshots freely between the Host OS and the Guest OS.
Guest? Host? What’s that?
Before you see the steps to install VirtualBox Guest Additions in Ubuntu, let’s first talk about its features.
Why should you use VirtualBox Guest Additions?
With VirtualBox Guest Additions enabled, using the virtual machine becomes a lot more comfortable. Don’t believe me? Here are the important features that the Guest Additions offer:
Impressed by the features it provides? Let’s see how you can install VirtualBox Guest Additions on Ubuntu Linux.
Installing VirtualBox Guest Additions on Ubuntu
The scenario here is that you have Ubuntu Linux installed inside VirtualBox. The host system could be any operating system.
I’ll demonstrate the installation process on a minimal install of a Ubuntu virtual machine. First run your virtual machine:
To get started, select Device > Insert Guest Additions CD image…:
This will provide you with the required installer inside the guest system (i.e. the virtual operating system). It will try auto-running, so just click Run:
This should open up the installation in a terminal window. Follow the on-screen instructions and you’ll have the Guest Additions installed in a few minutes at most.
If you get an error like this one, it means you are missing some kernel modules (happens in some cases, such as minimal installs):
You need to install a few more packages here. Just to clarify, you need to run these commands in the virtual Ubuntu system:
sudo apt install build-essential dkms linux-headers-generic
Now run the Guest Addition setup again:
sudo rcvboxadd setup
Using VirtualBox Guest Addition features
Here are some screenshots for enabling/using helpful features of VirtualBox Guest Additions in use:
Change the Virtual Screen Resolution
Configure Drag And Drop (any files)
You can enable drag and drop from the top menu -> Devices ->Drag and Drop -> Bidirectional.
With Bidirectional, you can drag and drop from guest to host and from host to guest, both.
Configure Shared Clipboard (for copy-pasting)
Similarly, you can enable shared clipboard from the top menu -> Devices -> Shared Clipboard -> Bidirectional.
Uninstalling VirtualBox Guest Additions
Navigate to the CD image and open it in terminal (Right Click inside directory > Open in Terminal):
sh ./VBoxLinuxAdditions.run uninstall
However, in some cases you might have to do some more cleanup. Use the command:
Note: Replace VBoxGuestAdditions-version with the right version (you can hit tab to autocomplete; in my case it is VBoxGuestAdditions-6.0.4).
Hopefully by now you have learned how to install and use the VirtualBox Guest Additions in Ubuntu. Let us know if you use these Additions, and what feature you find to be the most helpful!