Install VirtualBox Guest Additions in Ubuntu, Linux Mint, Debian, Fedora and openSUSE [How-To]

VirtualBox Guest Additions is designed to be installed in the virtual machine after installing the Guest virtual machine operating system, and includes drivers and optimization programs to improve system performance and availability.
By installing VirtualBox Guest Additions, the virtual machine should have better video support (including hardware accelerated graphics), shared clipboard, drag and drop support between guest and host, and shared folders.
Debian (located in the contrib repository), Linux distribution users based on Ubuntu and Debian / Ubuntu can install VirtualBox Guest Additions from the repository (install virtualbox-guest-x11, virtualbox-guest-utils with virtualbox-guest-dkms packages), And Fedora 28 and later versions have the Guest Additions package installed by default. This method of installing VirtualBox Guest Additions is easier than installing the Guest Additions that come with VirtualBox, but it may lack certain features, such as using the new file manager added in VirtualBox 6.0.
For example, in Fedora 29 with the VirtualBox Guest Additions package installed by default, you can use VirtualBox 6.0 to adjust the size of the computer window and enable the shared clipboard between the guest computer and the host, but no operations related to shared files are effective After adding a shared folder, the new VirtualBox 6.0 file manager will be unavailable-it will completely freeze the virtual machine and will not be able to drag and drop files between the guest and host).

another example. In Ubuntu 18.04, by installing the VirtualBox Guest Additions repository software package, you will be able to synchronize the clipboard between the guest and the host, and be able to add shared folders, but you will not be able to use the new folders. VirtualBox 6.0 file manager, or use drag and drop to share folders between host and guest computers.
It should be noted that using Ubuntu 19.04 in a virtual machine, and installing guest additions provided by the repository, you can also use the new VirtualBox 6.0 file manager to share folders between the guest and the host, so there is no need to install the built-in VirtualBox Guest Additions installer. All you have to do is install these packages and restart (sudo apt install virtualbox-guest-x11 virtualbox-guest-utils virtualbox-guest-dkms). This article describes the ability to install VirtualBox guest additional ISOs using the built-in VirtualBox installer for Ubuntu, Linux Mint, Debian, openSUSE, or Fedora guest virtual machines, which enables all available guest additional features. Improved HiDPI support, new built-in file manager, more

Manually install VirtualBox Guest Additions ISO in Ubuntu, Linux Mint, Debian, openSUSE and Fedora

Fedora, Virtualbox 6.0 file manager
Use VirtualBox 6.0 file manager with Fedora guest virtual machine

the term:

  • “Host” or host operating system: A physical computer with Oracle VM VirtualBox installed.
  • “Guest” or guest operating system: An operating system running inside a virtual machine.

1. Download and install Oracle VM VirtualBox Extension Pack on the host.
On your computer (not on VirtualBox guests), go to VirtualBox Download Page and download “VirtualBox N.N.N Oracle VM VirtualBox Extension Pack”-this is a single file for all supported platforms.
Double-click the downloaded .vbox-extpack File, it should open with VirtualBox, allowing you to install it. 2. Install the software packages needed to build VirtualBox Guest Additions on the guest computer. Only for Fedora:

sudo dnf update kernel*

Then restart.
Otherwise, if you just installed Fedora in a virtual machine without installing the available updates, you may encounter problems (there is a mismatch between kernel-devel and the currently running kernel). Now you can install the software packages needed to build Linux. VirtualBox guests on Fedora guests add:

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


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

Ubuntu / Linux Mint / Debian:

sudo apt install gcc make perl dkms

3. Insert VirtualBox guest to add ISO (VBoxGuestAdditions.iso).VirtualBox inserts guest to add CD image

Choose from the VirtualBox machine menu 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*/

Ubuntu / Linux Mint:

sudo /media/$USER/VBox_GAs*/


sudo sh /media/cdrom0/

In all three cases: yes 5. When prompted Optional if you plan to use shared folders: add username to vboxsf Group on the guest operating system.
To use shared folders, add your guest computer username to vboxsf Group (on the guest computer):

sudo usermod -aG vboxsf $USER

Otherwise, you will not be able to access the contents of the shared folder on the guest computer.
The new VirtualBox file manager does not need to do this, but only for the existing VirtualBox shared folder function. 6. Restart the virtual machine.

VirtualBox file manager Ubuntu 18.04 guests
Use VirtualBox 6.0 file manager on Ubuntu 18.04 guest

You should now be able to use all available VirtualBox Guest Additions features:

  • Enable shared clipboard function from computer Devices menu -> Shared Clipboard
  • Enable shared folder from computer Devices menu -> Shared Folders
  • Enable drag and drop of files from the machine Devices menu -> Drag and Drop
  • Start the new VirtualBox 6.0 file manager, which allows browsing and copying files between guests and hosts in the following ways: Machine menu -> File manager,then click Session Button, enter your username and password and click Create Session

The drag and drop feature does not work with Wayland (the default setting in Fedora). If you want to use it in Fedora, please log out and select GNOME on Xorg From the login screen.