Ubuntu 16.04: Install VirtualBox Guest Additions

This article will describe installing Guest Additions on Ubuntu 16.04.

 

1 What is Guest Additions

This is for improvement of video performance, sharing directory, and sharing copy/paste clip board.

There is only 2 resolutions of display like 1024x768 and 800x600 before installing Guest Additions, you can select a certain resolution what you want after installing.

0001_Resolution-before-install.png

Guest Additions has virt drivers. You need to build drivers.

2 Install kernel header

Install linux-headers-generic package with apt.

$ sudo apt-get install -y linux-headers-generic

If you use RedHat, please install kernel-devel package.

3 Mount Guest Additions CD image

Insert iso file of VirtualBox Guest Additions from window menu of VirtualBox.

Devices -> Insert Guest Additions CD image

If an automount is running, an automount will mount CD image to /media/<username>/<virtualbox> automatically.

0002_Automount.png

If an automount is not running, mount CD image manually.

$ sudo mount -t iso9660 /dev/sr0 /mnt

4 Build Guest Additions

If an automount is running, a dialog will be pop and Selecting "Run" will start to build Guest Additions with sudo password.

0003_Run.png

"Press Return to close this window…" message is displayed when installation is completed.

0004_Complete.png

You can start to build Guest Additions from terminal manually.

$ cd /media/hiroom2/VBOXADDITIONS_5.0.20_106931/
$ sudo ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.0.20 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules
The headers for the current running kernel were not found. If the
following
module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...done.
Building the graphics driver module ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest AdditionsInstalling the Window System
drivers
Installing X.Org Server 1.18 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the the Window System (or just restart the
guest system)
to enable the Guest Additions.

Installing graphics libraries and desktop services components ...done.
 ...done.

4.1 Build failure

Driver code of Guest Additions may be not compatibled with kernel.

For example, when a function which is used by Guest Additions is not defined at kernel no longer, undefined symbol error will be occured.

 

Please check update of VirtualBox for fixing error.

If you cannot find any update for fixning error, you need to fix driver code manually or wait for update.

4.2 Guest Additions not work after kernel update

Current Guest Additions's driver supports dkms and driver will be built after kernel update automatically.

You do not need to rebuild driver for each update.

 

Guest Additions does not work after kernel update, it means that there is a compatible problem.

Please build drive manually and check update for fixing it.

5 Execution result

Restart Ubuntu 16.04 after installation is completed.

Check whether driver which has a vbox prefix is loaded.

$ lsmod | grep vbox
vboxsf                 45056  0
vboxvideo              49152  2
ttm                    98304  1 vboxvideo
drm_kms_helper        139264  1 vboxvideo
drm                   360448  5 ttm,drm_kms_helper,vboxvideo
syscopyarea            16384  2 drm_kms_helper,vboxvideo
sysfillrect            16384  2 drm_kms_helper,vboxvideo
sysimgblt              16384  2 drm_kms_helper,vboxvideo
vboxguest             282624  8 vboxsf,vboxvideo

Resolution number of display is changed 2 kinds to all.

When you change VirtualBox window size, a resolution of Ubuntu 16.04 will be chagned automatically.

0005_Resolution-after-install.png