VirtualBox Guest Additions Installation In Ubuntu, Linux Mint, Debian, Fedora And openSUSE [How-To]

VirtualBox

The VirtualBox Guest Additions are designed to be installed inside a virtual machine, after the guest operating system has been installed, and they include drivers and optimizations for better system performance and usability.

By installing the VirtualBox Guest Additions, the virtual machine should have better video support (including hardware-accelerated graphics), shared clipboard, drag and drop support between the guest and host machines, and shared folders, among others.

Debian (in the contrib repository), Ubuntu and Debian/Ubuntu based Linux distribution users can install the VirtualBox Guest Additions from the repositories (installing the virtualbox-guest-x11, virtualbox-guest-utils and virtualbox-guest-dkms packages), while Fedora 28 and newer ships with a Guest Additions package installed by default. This way of installing the VirtualBox Guest Additions is easier than installing the Guest Additions shipped with VirtualBox, but it may lack some features, like the ability to use the new file manager added in VirtualBox 6.0.

For example, in Fedora 29 which comes with the VirtualBox Guest Additions package installed by default, using VirtualBox 6.0 you can resize the machine window, and enable shared clipboard between the guest and host machines, but no shared files related actions work (can't add shared folders, the new VirtualBox 6.0 file manager doesn't work - it completely freezes the virtual machine, and dragging and dropping files between the guest and host doesn't work).

Another example. In Ubuntu 18.04, by installing the VirtualBox Guest Additions repository packages, you will get the ability to synchronize the clipboard between guest and host, and you'll be able to add a shared folder, but you won't be able to use the new VirtualBox 6.0 file manager, or use drag and drop to share folders between the host and guest machines.

It should be noted that using Ubuntu 19.04 in a virtual machine, and installing the repository-provided guest additions enables sharing folders between the guest and host machines as well using the new VirtualBox 6.0 file manager, so there's no need to install the built-in VirtualBox Guest Additions installer. All you have to do is install those packages and reboot (sudo apt install virtualbox-guest-x11 virtualbox-guest-utils virtualbox-guest-dkms).

This article explains installing the VirtualBox Guest Additions ISO using the built-in VirtualBox installer, for Ubuntu, Linux Mint, Debian, openSUSE, or Fedora guest virtual machines, which enables all the available guest additions features.

Related: VirtualBox 6.0 Released With Improved HiDPI Support, New Built-in File Manager, More

Installing VirtualBox Guest Additions ISO manually in Ubuntu, Linux Mint, Debian, openSUSE and Fedora


Virtualbox 6.0 file manager Fedora
Using the VirtualBox 6.0 file manager with Fedora guest

Terminology:

  • "Host" or host operating system: the physical computer on which Oracle VM VirtualBox was installed.
  • "Guest" or guest operating system: the operating system running inside the virtual machine.

1. Download and install the Oracle VM VirtualBox Extension Pack on the host.

On your computer (not on a VirtualBox guest), go to the VirtualBox downloads page and download the "VirtualBox N.N.N Oracle VM VirtualBox Extension Pack" - it's a single file for all supported platforms.

Double click the downloaded .vbox-extpack file and it should open with VirtualBox, allowing you to install it.

2. Install packages required to build the VirtualBox Guest Additions on the guest machine.

Fedora only:

sudo dnf update kernel*

Then reboot.

Without this, if you just installed Fedora in a virtual machine and you didn't install the available updates, you may run into issues (mismatch between kernel-devel and the current running kernel).

Now you can install the packages required to build the VirtualBox Guest Additions on the Fedora guest:

sudo dnf install gcc automake make kernel-headers kernel-devel perl dkms elfutils-libelf-devel

openSUSE:

sudo zypper install gcc make dkms kernel-devel kernel-default-devel

Ubuntu / Linux Mint / Debian:

sudo apt install gcc make perl dkms

3. Insert the VirtualBox Guest Additions ISO (VBoxGuestAdditions.iso).

VirtualBox insert guest additions cd image

From the VirtualBox machine menu select Devices > Insert Guest Additions CD image.

4. Install the VirtualBox Guest Additions ISO on the guest operating system (Ubuntu, Linux Mint, Debian, openSUSE or Fedora).

Fedora or openSUSE:

sudo /run/media/$USER/VBox_GAs*/VBoxLinuxAdditions.run

Ubuntu / Linux Mint:

sudo /media/$USER/VBox_GAs*/VBoxLinuxAdditions.run

Debian:

sudo sh /media/cdrom0/VBoxLinuxAdditions.run

In all three cases: type yes when prompted.

5. Optional if you plan on using shared folders: add your username to the vboxsf group on the guest OS.

For shared folders to work, add your guest machine username to the vboxsf group (on the guest machine):

sudo usermod -aG vboxsf $USER

Without this you won't be able to access the shared folder contents on the guest machine.

This is not required to use the new VirtualBox file manager, but only for the already existing VirtualBox shared folders feature.

6. Reboot the virtual machine.

VirtualBox file manager Ubuntu 18.04 guest
Using the VirtualBox 6.0 file manager with Ubuntu 18.04 guest

Now you should be able to use all the available VirtualBox Guest Additions features:

  • enable the shared clipboard feature from the machine Devices menu -> Shared Clipboard
  • enable shared folders from the machine Devices menu -> Shared Folders
  • enable drag and drop of file from the machine Devices menu -> Drag and Drop
  • start the new VirtualBox 6.0 file manager that allows browsing and copying files between guest and host from the Machine menu -> File manager, then click on the Session button, enter your username and password, and click Create Session

The drag and drop feature does not work with Wayland (which is default in Fedora). If you want to use this in Fedora, logout and select GNOME on Xorg from the login screen.