How to install Virtualbox guest additions on Ubuntu 14.04

11 Flares Filament.io 11 Flares ×

After installing Ubuntu inside virtualbox, you need to install the guest additions to get better hardware functionality inside it. These include full screen resolution, mouse wheel and pointer integration, copy paste from host os (shared clipboard), shared folders etc.

This tutorial shows you how to install VirtualBox guest additions in Ubuntu. The same method works for similar distros like Xubuntu, Kubuntu and Lubuntu.

1. Install kernel headers and build tools

Virtualbox guest additions are compiled for the target system, so it needs the necessary kernel headers and related programs. Install the following 2 packages.

$ sudo apt-get install build-essential module-assistant

Now run

$ sudo m-a prepare

2. Compile virtualbox guest additions

Now click "Devices > Insert guest additions CD image" in the virtualbox window. This will insert the guest additions cd image into the guest OS. On Xubuntu the cd should get mounted automatically inside the /media directory.

On Ubuntu unity, you should see the cd icon on the left panel towards the lower side. Click it to open the VBox guest additions cd in file manager.

Kubuntu would give you a device notification on bottom right and you can click "open with file manager" which will mount the cd and open it up in dolphin.

Check the path of the cd file system inside the file manager (press Ctrl + L). The location should be something similar to this

/media/<username>/VBOXADDITIONS_4.3.10_93012

The shall contain your username on the system.

Mount manually

If it does not mount by itself, then you can manually mount it. Find out the device using blkid and then use the mount command to mount it somewhere in your home directory

# find out the device
$ sudo blkid
/dev/sr0: LABEL="VBOXADDITIONS_4.3.10_93012" TYPE="iso9660" 

# Or use the lsblk command
$ sudo lsblk -o NAME,TYPE,SIZE,LABEL,MOUNTPOINT,MODEL
NAME   TYPE   SIZE LABEL                      MOUNTPOINT MODEL
sda    disk     8G                                       VBOX HARDDISK   
├─sda1 part     6G                            /          
├─sda2 part     1K                                       
└─sda5 part     2G                            [SWAP]     
sr0    rom   61.7M VBOXADDITIONS_4.3.10_93012            CD-ROM

Note down the device name which is "/dev/sr0" here. Next we have to mount this device (cdrom) to access the contents.

# create directory to mount
$ mkdir cdrom

# mount the cd
$ sudo mount /dev/sr0 ~/cdrom/
[sudo] password for silver: 
mount: block device /dev/sr0 is write-protected, mounting read-only

# get inside the mounted directory
$ cd cdrom/
~/cdrom$ ls
32Bit        cert                    VBoxSolarisAdditions.pkg
64Bit        OS2                     VBoxWindowsAdditions-amd64.exe
AUTORUN.INF  runasroot.sh            VBoxWindowsAdditions.exe
autorun.sh   VBoxLinuxAdditions.run  VBoxWindowsAdditions-x86.exe

Start compiling

Navigate to the directory and run the script named VBoxLinuxAdditions.run

/media/silver/VBOXADDITIONS_4.3.10_93012$ ls
32Bit        cert                    VBoxSolarisAdditions.pkg
64Bit        OS2                     VBoxWindowsAdditions-amd64.exe
AUTORUN.INF  runasroot.sh            VBoxWindowsAdditions.exe
autorun.sh   VBoxLinuxAdditions.run  VBoxWindowsAdditions-x86.exe


/media/silver/VBOXADDITIONS_4.3.10_93012$ sudo ./VBoxLinuxAdditions.run 
[sudo] password for silver: 
Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.10 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
Starting the VirtualBox Guest Additions ...done.
Installing the Window System drivers
Installing X.Org Server 1.15 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the hal service and the Window System (or just restart
the guest system) to enable the Guest Additions.

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

Note the line

Building the VirtualBox Guest Additions kernel modules ...done.

If it shows done, then virtualbox guest additions are compiled successfully.
Now restart the guest OS.

3. Verify that guest additions are working

After rebooting the OS, the screen resolution of the guest OS should adjust with the window size of virtualbox. Other things like mouse scroller, copy paste from guest to host should also work.

You can verify that the guest additions are loaded with the following command

# check loaded modules
$ lsmod | grep -io vboxguest
vboxguest

# check module 
$ modinfo vboxguest
filename:       /lib/modules/3.13.0-24-generic/updates/dkms/vboxguest.ko
version:        4.3.10
license:        GPL
description:    Oracle VM VirtualBox Guest Additions for Linux Module
author:         Oracle Corporation
.....

$ lsmod | grep -io vboxguest | xargs modinfo | grep -iw version
version:        4.3.10

4. Configure Shared folders

After installing guest additions you can share folders across the guest and host OS, allowing each of them to access each other's files. The folder exists on the host OS and is shared to the guest OS. The guest may or may not be given the permission to write to the shared folder.

Click Devices > Shared folder settings on the virtualbox window. Click the plus icon on the right side and select the directory from the host OS that you want to share with the guest OS.

If you choose "Make permanent" it becomes a Machine folder, else it is a Transient folder. You also have the option to make it read only, so that the guest OS cannot make modifications to the folder.

Once you have specified the shared directory, its time to mount it inside the guest OS. The list of shared folders would show you the name and path of the shared directory. Note down the name, and mount it using the following command

# create a directory in your home directory
$ mkdir shared

# mount using the mount command. SHARENAME is the name of the shared directory
$ sudo mount -t vboxsf SHARENAME ~/shared

# or
$ sudo mount.vboxsf SHARENAME ~/shared

You might comes across the following error message - "mount: wrong fs type, bad option".
Or "The program 'mount.vboxsf' is currently not installed."

This error is caused by a bug in VirtualBox due to which /sbin/mount.vboxsf points to a wrong path.

To fix this, you have to use the full path to the mount.vboxsf command

$ sudo /usr/lib/x86_64-linux-gnu/VBoxGuestAdditions/mount.vboxsf SHARENAME ~/shared

The bug will be fixed in upcoming releases of VirtualBox.







Last Updated On : 16th June 2014

Subscribe to get updates delivered to your inbox

About Silver Moon

Php developer, blogger and Linux enthusiast. He can be reached at m00n.silv3r@gmail.com. Or find him on

  • phipix01

    thank god finally someone wrote a newb-friendly tutorial!
    couldn’t be written better ;) i appreciate you work sir!

    one simple addition: is there a way to access ubuntu’s guest file system via my windows host?

  • dc

    first post on this that could be followed and made sense. Thanks! Nice to get shared folders working in 10 minutes after trying for hours.

  • william_sv

    Thank you for this article. It was very helpful!

  • freddi3k

    sudo apt-get install virtualbox-guest-dkms seems absolutely sufficient;)

  • kuki

    Thanks, its works in Ubuntu Server 14.04.

  • Charlie

    This worked for me and resolved my issue with changing resolution in my VM. Thanks!

  • Mirzet Kadic

    Why not:
    sudo apt-get install virtualbox-guest-dkms ?

  • Mirzet Kadic

    And why not:
    sudo apt-get install virualbox-guest-dkms ?

  • Boing

    Ubuntus still shit

  • Bin

    I tried many other suggestions which did not solve my problem until find yours. Thanks so much!!! Now i can use shared folders.

  • Cristian

    Thank you.
    This helped me with full screen

  • setuart

    Worded perfectly and solved my screen resolution issues. Thanks.

  • http://enria.org/ maastrix

    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package build-essential
    E: Unable to locate package module-assistant

    What’s the issue? Any idea?

    • http://www.binarytides.com/ Silver Moon

      try updating the package cache first
      sudo apt-get update

  • https://schwartzmeyer.com/ Andrew Schwartzmeyer

    Also, do you have a link to the official bug report? I couldn’t find it.

  • https://schwartzmeyer.com/ Andrew Schwartzmeyer

    That last line there, `sudo /usr/lib/x86_64-linux-gnu/VBoxGuestAdditions/mount.vboxsf backup /mnt/backup`, was exactly what I needed after updating my kernel and installing the latest guest additions. Thank you for the post.

    Out of curiosity, is there anyway to make that a permanent fix? Right now my box hangs on boot because it fails to mount the share and wants me to type something to skip trying to mount it, and there is no timeout.

    • http://www.binarytides.com/ Silver Moon

      To make the fix permanent, point the /sbin/mount.vboxsf binary to the right executable

      Something like this should work, but I have not tested
      sudo ln -sf /usr/lib/x86_64-linux-gnu/VBoxGuestAdditions/mount.vboxsf /sbin/mount.vboxsf

      • https://schwartzmeyer.com/ Andrew Schwartzmeyer

        Ah, close! To repair the, according to the bug report, do ‘sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions’. That puts it back in place so the original ‘/sbin/mount.vboxsf’ works.

11 Flares Twitter 3 Facebook 0 Google+ 8 LinkedIn 0 StumbleUpon 0 Pin It Share 0 Filament.io 11 Flares ×