Install Virtualbox Guest Additions on Ubuntu To Enable 3D Support
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.
sudo reboot
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
Output
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.
sudo reboot
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.
/usr/lib/nux/unity_support_test -p
Look at the last line of the output, if it says
Unity 3D supported: yes
Then Unity 3D is supported.
Thanks for this tut. Worked like a charm!
Did not work for me 🙁
After clicking on Devices – Insert Guest Additions CD Image I get a an error dialog with the following error:-
Unable to insert the virtual optical disk C:\Program Files\Oracle\VirtualBox\VBoxGuestAdditions.iso into the machine Exxxx.
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}