In this tutorial I will show you how to install virtualbox guest additions on Ubuntu virtual machine. Guest additions allow your guest OS to be full screen and enable the host and guest to share files and folders with each other. The guest additions will also provide 3D support for Unity desktop thus improving the speed of Ubuntu virtual machine.
Tip: Virtualbox Guest additions are compiled and installed inside a guest OS.
The following instructions are tested on Ubuntu 16.04 and Ubuntu 16.10.
Install Virtualbox Guest Additions on Ubuntu
Log into Ubuntu (Guest OS), open a terminal and update your software with the below command. && means the shell will only execute the next command after previous command is successfully executed.
sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade
Reboot your system.
Install required packages for building kernel modules.
sudo apt-get install build-essential module-assistant dkms
Note: On Ubuntu MATE edition, you need to enable the universe repository, which can be done with the following command, in order to install module-assistant.
sudo add-apt-repository universe sudo apt update
After the above packages are installed, prepare your system to build kernel module.
sudo m-a prepare
In the virtual machine window, select Devices > Insert Guest Additions CD image.
You will be asked to download the guest additions iso image. Click Download.
If you host is a Linux distribution, then the guest additions disk image will be downloaded to ~/.config/VirtualBox/ directory. Once the download is complete, click Insert button to insert the CD image into the virtual optical drive.
A pop-up will appear asking you if you would like to run it. Click the Run button.
Then enter your password on ubuntu and it will begin building the virtualbox guest additions kernel modules.
As you can see from the output, it’s also installing window system drivers and graphics libraries and that’s what make 3D acceleration in the guest OS possible. Once it’s done, press Return to close the window.
Reboot your Ubuntu virtual machine.
Now the resizeable display should be working and the resolution of Ubuntu will adjust with the size of virtulbox window. You can press right Ctrl and F keyboard shortcut to enter full-screen mode.
Enable 3D Hardware Acceleration
This step is useful to Ubuntu Unity edition.
Shutdown Ubutnu VM and open your virtualbox settings. Click Display on the left pane. In the Screen tab, allocate 128M video memory to Ubuntu VM and check the box before Enable 3D Acceleration. Save you settings.
Start your Ubuntu VM again. It should be running much faster right now because Unity 3D is supported now. You can run the following command in the terminal to determine whether Unity 3D is supported.
Look at the last line of the output, if it says
Unity 3D supported: yes
Then Unity 3D is supported.