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.
For an Ubuntu guest
Install the package virtualbox-guest-additions in the guest Ubuntu.
This is a precompiled version of the guest additions that may also be installed in the PUEL version of Virtual Box (or when running Virtual Box on another host OS). They may not be up to date but will usually run in later versions of Virtual Box too. This procedure may be useful when building the Guest Additions fail (e.g. in not yet fully supported new or pre-release kernels installed for testing in Virtual Box).
For another guest OS
The Guest Additions CD .iso file to mount and install in another OS (non-Ubuntu Linux distribution, Windows, Solaris, OS/2) is provided by the package virtualbox-guest-additions-iso to be installed in the host Ubuntu. After mounting in the guest install the additions by running the appropriate installation script from this CD.
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 tools in addition. It is also recommended to have dkms installed (see below - Note 4).
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 classic (10.04 LTS)
To install the Guest Additions we will have a CD icon on our desktop as soon as the virtual drive is mounted:
Next step is to run the autorun.sh script (as root) on this mounted CD either by opening the drive or by choosing "Open With Autorun Prompt" from the right-click context menu as depicted above. This will build and install the vbox kernel modules needed.
Unity (> 11.04)
The guest additions is mounted as a virtual CD visible on the launcher:
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)
After having entered your credentials for root access the guest additions will build as seen from the terminal output:
Press Return to close the terminal.
Guest Additions need a reboot of your guest OS to take effect.
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
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 guests we additionally need to install the GNU C compiler (gcc ) and the make utility in the guest system to be able to compile the guest additions.
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