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

sudo m-a prepare

In the virtual machine window, select Devices > Insert Guest Additions CD image.

insert guest addition image

You will be asked to download the guest additions iso image. Click Download.

download virtualbox guest additions cd image

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.

insert guest additions image

A pop-up will appear asking you if you would like to run it. Click the Run button.

Install Virtualbox Guest Additions on Ubuntu

Then enter your password on ubuntu and it will begin building the virtualbox guest additions kernel modules.

building 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.

enable 3d accerelation in virtualbox

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.

Rate this tutorial
[Total: 13 Average: 4.2]

3 Responses to “Install Virtualbox Guest Additions on Ubuntu To Enable 3D Support

  • AAA Comments
    7 years ago

    Thanks for this tut. Worked like a charm!

  • John Allwood
    3 years ago

    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}

Leave a Comment

  • Comments with links are moderated by admin before published.
  • Your email address will not be published.
  • Use <pre> ... </pre> HTML tag to quote the output from your terminal/console.
  • Please use the community (https://community.linuxbabe.com) for questions unrelated to this article.
  • I don't have time to answer every question. Making a donation would incentivize me to spend more time answering questions.

The maximum upload file size: 2 MB. You can upload: image. Links to YouTube, Facebook, Twitter and other services inserted in the comment text will be automatically embedded. Drop file here