574

I've recently installed Ubuntu on Oracle's Virtualbox. Now I want to install the guest additions.

I started up my Ubuntu guest OS, clicked "Devices" and chose "Install Guest Additions". Nothing happened, and I don't see the CD icon on my desktop.

How can I make this work?

1

13 Answers 13

630

If you have trouble installing Ubuntu in a VirtualBox VM, because the installer window does not fit the low resolution screen size, you can move the window with Alt+F7.

Installing Guest additions from the repositories

In case we have installed the OSE edition of Virtual Box from the repositories we can add the guest additions from the repositories in the guest. This will install guest additions matching the Virtual Box version as obtained from the repositories. It is not recommended to install these in newer releases of Virtual Box as obtained from the Oracle repository (see below).

Alternatively we can install the package virtualbox-guest-additions-iso in the host Ubuntu.

sudo apt-get install virtualbox-guest-additions-iso

The .iso file with an image of the OSE edition of the guest additions CD will install in the host directory /usr/share/virtualbox/VBoxGuestAdditions.iso. Mount this .iso file as a CD in your virtual machine's settings. In the guest you will then have access to a CD-ROM with the installer.

Installing Guest Additions from Virtual Box Manager

In case the Guest Additions fail to build we may have to install the Linux kernel headers (see How do I install kernel header files?) or build-essential Install build-essential tools in addition. It is also recommended to have dkms Install dkms installed (see below - Note 4). You can run this command in a terminal to install both:

sudo apt install build-essential dkms

Selecting Devices -> Install Guest Additions (or press Host+D from the Virtual Box Manager) the Guest Additions CD .iso will be loaded but not installed in your guest OS. To install we need to run the installer script VBoxLinuxAdditions.run as root or from the Autorun Prompt (see below).


GNOME Shell

To install the Guest Additions we will have a CD icon on our desktop as soon as the virtual drive is mounted:

enter image description here

Next step is to run the autorun.sh script (as root) on this mounted CD by opening the drive and clicking on the "Run Software" button. This will build and install the vbox kernel modules needed.


Unity

The guest additions is mounted as a virtual CD visible on the launcher:

enter image description here

In case the system is set up to autorun a CD it should just open the following autorun dialogue (if not select the CD symbol, choose open, then choose Open Autorun Prompt)

enter image description here

After having entered your credentials for root access the guest additions will build as seen from the terminal output:

enter image description here

Press Return to close the terminal.


Note 1
Guest Additions need a reboot of your guest OS to take effect.

Note 2
In some systems the Virtual Box Guest Additions CD icon may not be shown on the desktop, but will be accessible from the Places menu. If the CD still was not there you may have to manually add the VBoxGuestAdditions.iso as a CD-ROM in the Virtual Box Manager Storage menu. In an Ubuntu host the disk image is in /usr/share/virtualbox/VBoxGuestAdditions.iso.

Note 3
In some systems (e.g. when running Xubuntu guests) we may not have an Autorun Prompt for the mounted CD. Then we can install the guest additions by opening a terminal on the mounted guest additions .iso to run sudo ./VBoxLinuxAdditions.run. In Lubuntu or Ubuntu Server guests we additionally need to install the GNU C compiler (gcc Install gcc) and the make Install make utility in the guest system to be able to compile the guest additions.

Note 4
Running DKMS in the guest OS will keep Guest Additions installed after a guest kernel update. It is not a prerequisite for Guest Additions but if used it should be installed before we install the Guest Additions.


Installing Guest Additions from a Terminal##

In case Guest Additions are not installed properly we may not be able to boot to the GUI. In this case we need to boot holding the Shift key to access the Grub menu where we access a root shell as depicted in the following question (we do need to mount the filesystem read/write to proceed):

The Guest Additions .iso file needs to be installed on /dev/cdrom from the Virtual Box Manager (see above). We then may install Guest Additions by typing the following commands:

mount /dev/cdrom /mnt              # or any other mountpoint
cd /mnt
./VBoxLinuxAdditions.run
reboot

Remove Guest Additions

In case something went wrong with installing the guest additions, or the guest OS can not boot after installing we may have to remove the additions. This can also be done from a root shell by running an uninstallation script located in the guest /opt directory.

cd /opt/<VirtualBoxAdditions-x.x.xx>/
sudo ./uninstall.sh

Replace x.x.xx with your current version of guest additions.

21
  • 14
    I came across this answer while trying to install Guest Additions on Ubuntu Server. One step is missing if you need to install on server: run sudo apt-get install dkms first. (ref virtualbox.org/manual/ch04.html#idp19765808) May 23, 2012 at 7:30
  • 1
    I tried your solution for ubuntu 12.10 server as guest and mac os x as host. Virtual box is 4.2.6. I am unable to to get the shared folders to work. somehow the guest additions are not working. Even Devices > Install Guest Additions did not work too. Not even the package virtualbox-guest-additions helped. Every attempt to run the iso GuestAdditions.iso does NOT lead to the iso showing up under /media/cdrom. Please advise.
    – Kim Stacks
    Jan 3, 2013 at 10:43
  • 1
    @kimsia: you need to mount the .iso in your server first. After that you can install the GA with sudo ./<mountpoint>/VBoxLinuxAdditions.run
    – Takkat
    Jan 3, 2013 at 11:16
  • 2
    @IIIIIllllllllIlllllIIIIIIIIlll: sure - covering everything is all a "canonical" Q&A. is about. Anything missing, anything outdated?
    – Takkat
    Aug 12, 2015 at 6:11
  • 1
    You don't need to install the ISO on the host. You can just do it on the guest then mount it with the mount command.
    – sudo
    Aug 2, 2017 at 16:53
119

You could also try the following (this worked for me after I had to reinstall the Guest Addtitions after Update Manager killed them). Solution found here:

http://www.unixmen.com/install-guest-addition-in-ubuntu-1010-maverick-meerkat-fix/

In summary:

sudo apt-get update
sudo apt-get install build-essential linux-headers-$(uname -r)
sudo apt-get install virtualbox-ose-guest-x11

This found and updated the correct version of the VirtualBox Guest Additions and my system seems to work properly again, and I'm assuming this will also work if Guest Additions are failing to install from the menu item.

One other thing of note. I originally tried to run this under the fish shell - make sure you're using bash (i.e. type "bash" into the terminal before you start).


Note on more recent systems, the command has been changed to

sudo apt-get install virtualbox-guest-x11
10
  • your answer helped even though i was installing in a fresh installation ubuntu server. thank you. superuser.com/questions/527507/…
    – Kim Stacks
    Jan 3, 2013 at 11:05
  • 18
    The package is called virtualbox-guest-x11 on more recent systems. I think this should be the accepted answer, because guest additions from ISO might not auto-update, in contrast to those installed using apt-get.
    – krlmlr
    Jan 21, 2014 at 12:33
  • 2
    Note that I didn't have to install build-essentials on a freshly installed 14.04, and linux-headers were already installed. So running sudo apt-get install virtualbox-guest-x11 on the guest system was all I had to do.
    – pcworld
    Apr 25, 2014 at 13:19
  • 1
    I liked to use this method for the mentioned reason. However, it didn't work for me on OSX host (10.9.3) and Ubuntu 12.04 guest on VirtualBox (4.3.12). I had to use ISO installation askubuntu.com/a/22745/24203 (otherwise got not such device error stackoverflow.com/questions/3492466/…)
    – IsaacS
    Jun 8, 2014 at 23:14
  • 1
    Ok this worked for me. ubuntu 32 and 64 versions 14.04
    – Kangarooo
    Jul 24, 2014 at 22:54
45

Within the guest operating system, install the package virtualbox-guest-dkms. For example, using the Terminal application, type sudo apt-get install virtualbox-guest-dkms.

7
  • 2
    Worked for me on Ubuntu 14 LTS.
    – Jongosi
    Jun 11, 2015 at 21:16
  • 2
    Worked for me for Ubuntu 16.04 Oct 20, 2016 at 1:51
  • Worked for me on Ubuntu 16.04.1. Make sure to reboot the machine after the installation. worked seemelessly. Jan 5, 2017 at 0:04
  • 3
    Worked for me on Ubuntu 18.0.4.1LTS. I still can't copy and paste things from the host to the guest though (also not with any of the other methods mentioned here); shouldn't that work after this?
    – Carlo Wood
    Nov 14, 2018 at 18:26
  • 1
    works on ubuntu 20.04 LTS Apr 7, 2021 at 13:40
27

Here are the manual steps to install VirtualBox Guest Additions kernel modules inside the VM:

  1. Download the ISO file, e.g.

    wget http://download.virtualbox.org/virtualbox/5.0.20/VBoxGuestAdditions_5.0.20.iso -P /tmp
    
  2. Mount the ISO file:

    sudo mount -o loop /tmp/VBoxGuestAdditions_5.0.20.iso /mnt
    
  3. Run installer (add -x after sh to debug):

    sudo sh /mnt/VBoxLinuxAdditions.run
    

To find the right version of ISO file, check it at: http://download.virtualbox.org/virtualbox/


If you're using Vagrant, installation is much simpler by following these commands:

vagrant plugin install vagrant-vbguest
vagrant up
vagrant vbguest
5
  • 1
    These steps finally allowed me to have a full screen terminal. My host OS is Windows 7, VirtualBox version 5.1. My guest OS is Ubuntu 16.04.1 LTS. I also have the following two lines in /etc/default/grub: GRUB_GFX_MODE=1600x1200 and GRUB_GFXPAYLOAD_LINUX=keep Jul 21, 2016 at 21:16
  • Definitely an underrated answer -- super straightforward and will allow you to install a newer version of the Guest Additions than may be available in your apt repo. Also, no need to add a virtual CD-ROM drive to your guest!
    – bonh
    Feb 23, 2017 at 21:00
  • 2
    Best answer. IDK why all the other answers take unnecessary steps like building from source or creating virtual drives.
    – sudo
    Aug 2, 2017 at 16:52
  • I added a variation of this to my Vagrant provisioning script. Works perfect.
    – ddoxey
    Jun 19, 2021 at 15:47
  • Great post! Using Vagrant I found I can specify vagrant-vbguest as a plugin in my Vagrantfile: Here's I've specified it as part of a list (so other plugins can be specified if needed), config.vagrant.plugins = [ "vagrant-vbguest", ] Oct 18, 2021 at 16:25
24

The standard "virtualbox-guest-additions" package on the .iso provided by Oracle, has general tools for different Guest Operating Systems...

However, Ubuntu has its own dedicated Ubuntu-specific Guest Addon package(s)...
named virtualbox-ose-guest-dkms and ..-x11 and ..-utils .

These 'virtualbox-ose-guest-*' packages are DKMS aware.. "(DKMS is a framework designed to allow individual kernel modules to be upgraded without changing the whole kernel.)"

Here is the link to a question I asked 5-6 months ago on this issue... How can I get Compiz to work in a VirtualBox VM

3
  • I get "Unable to locate package virtualbox-ose-guest-dkms". Do I need to add an apt repo? Dec 1, 2014 at 8:25
  • 1
    I think all you need to install on newer Ubuntus is the package virtualbox-guest-x11, which will draw in any other required dependencies.
    – Lambart
    Dec 11, 2014 at 22:45
  • 3
    It's now called virtualbox-guest-dkms. By the way, this is the only acceptable answer in this thread to me as this is the only way my guest additions worked in VBox. I've added my user to vboxusers group in advance, this might helped?
    – Erikas
    Jul 13, 2016 at 22:15
19

Here are the steps I ran which finally worked, but as user named 'pcworld' stated above it may have been the case that only the last command was actually required. I'll never know, but I want to share in case this helps anyone else:

sudo apt-get install virtualbox-guest-additions-iso
sudo apt-get update 
sudo apt-get dist-upgrade
sudo apt-get install virtualbox-guest-x11

And don't forget to set your VirtualBox instance to use like 128MB video ram and Enable 3D Acceleration under the "Display" settings section for your instance, for good performance.

1
  • After installing docker in vagrant I had that error with Guest Addition. sudo apt-get dist-upgrade did the trick. Thanks Clay. Feb 11, 2018 at 12:19
15

This worked for me for a Ubuntu Server 14.04 guest VM (no GUI):

Edit: also works with Ubuntu Server 15.04 and 16.04

1) Install dkms. From the guest run:

sudo apt-get install dkms

2) From the VirtualBox VM window menu select: Devices --> Insert Guest Additions CD image...

3) Use blkid to identify the CD-ROM device. From the guest run:

sudo blkid

One of the lines in the output should look like this:

/dev/sr0: LABEL="VBOXADDITIONS_4.3.16_95972" TYPE="iso9660"

The first part (/dev/sr0) is the name of the CD-ROM device.

4) Mount the CD (replace /dev/sr0 by the device name found above):

sudo mount /dev/sr0 /media/cdrom/

5) Run the Guest Additions installer:

sudo /media/cdrom/VBoxLinuxAdditions.run

6) Reboot the guest.

5
  • 3
    sudo sh /media/cdrom/VBoxLinuxAdditions.run The sh was needed because the CD had been mounted without execute permission. May 19, 2015 at 15:10
  • Hello @DavidLevesque , I've been tried in 16.04 but unfortunately I cannot get it run. Also I tried with --nox11 parameters. Do you have any idea?
    – efkan
    Sep 29, 2016 at 9:16
  • @efkan Unless you provide more details, I have no idea. It worked for me with Ubuntu 16.04. Sep 29, 2016 at 13:53
  • @DavidLevesque you're right :) I use VirtualBox v5.0.26 on Windows 10. And I install Ubuntu Server 16.04.1 in VirtualBox. (The server doesn't have X Window System) Then I followed the steps that are over here: en.ig.ma/notebook/2012/… . Then I reboot and try to perform copy-paste action but I cannot see any action. Thanks.
    – efkan
    Sep 29, 2016 at 14:09
  • @efkan I suppose it doesn't work on a real console.
    – Polluks
    Jan 27, 2022 at 11:45
12

The procedure is quite simple.

In Virtual Box menu select Devices > Insert Guest Additions CD Image....

The following popup will appear on your Ubuntu desktop :

guest addition popup

Select Run and Guest Additions will automatically be installed.

3
  • 2
    Worked for me on Ubuntu 14.04 LTS installed on Oracle VM 5.0 on Windows 10. Only 2 clicks..... thank you!
    – Sym-Sym
    Jul 13, 2016 at 19:04
  • 2
    This is the best answer, because it ensures that the Guest Additions are updated for and appropriate for your specific version of VirtualBox. Ubuntu's package and the wget URLs in the other answers can be outdated. Nov 18, 2016 at 20:51
  • 1
    Works for me in Ubuntu 18.04 Feb 2, 2019 at 23:48
10

I think the right way to do this right now (2020-Apr-27) with the newest stable Ubuntu (20.04) and the current Virtualbox (6.1.6) is to just do the following:

sudo apt install virtualbox-guest-dkms virtualbox-guest-x11 virtualbox-guest-utils

I just did that and it worked.

I guess this won't get a lot of attention down here but at least if somebody searches for 20.04 they might be able to find some more recent information. ;)

4
  • 1
    This is quite large: 457 newpackages with 154 MB to download, 867 MB of additional disk space, I suggest to add --no-install-recommends which results in just 30MB download and 300MB
    – rubo77
    Apr 27, 2020 at 23:00
  • 1
    and virtualbox-guest-utils is not needed
    – rubo77
    Apr 27, 2020 at 23:45
  • @rubo77 Might be true. Are you sure? What is it for? It seems mount.vboxsf might be required for mounting a shared folder? But the dependencies are mostly on the other two anyway.
    – Warkwark
    Apr 29, 2020 at 21:43
  • 1
    Not sure anymore, if it's needed
    – rubo77
    Apr 30, 2020 at 0:42
8

The virtualbox-guest-additions package has to be installed. Furthermore, it may appear that nothing has happened, but all the "Install Guest Additions" button do is mounting the cdrom. You should open the File manager (Nautilus / Dolphin), select the "CD device" and run the installer.

3

For Lubuntu 16.04 users inside Ubuntu 16.04 Virtualbox

After trying many of the main-stream generic instructions I found Lubuntu specific instructions:

Install Virtualbox Guest Additions onto a Lubuntu Virtual Machine

First step: Install required software

sudo apt-get update
sudo apt-get install make gcc

Next, use Virtualbox to download the Guest Additions, then select "Install Guest Additions" from the Virtualbox menu.

If the VBOXADDITIONS cd does not pop up in File Manager, Use File Manager to open the contents of the VBOXADDITIONS cd, then open a terminal there, by going to File Manager's menu and selecting 'Open Current Folder in Terminal'

sudo sh VBoxLinux*

reboot and enjoy!

2

If you have the guest additions .iso, mount it in VirtualBox via the guest OS settings. Then start the guest OS and run the vboxwindowsadditions-x86 or amd64 exe.

-1

Open Ubuntu in VirtualBox. Open FireFox and go here:
http://download.virtualbox.org/virtualbox/

Find your version of Virtualbox and click the link to open it.

Download your version of VBoxGuestAdditions (iso):

Open it in Archive manager and extract files.

Run: sudo VBoxLinuxAdditions.run

Reboot.

This works if you can't open the iso file in VirtualBox (ISO9660 error).

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .