I recently installed Ubuntu 20.04 LTS (Focal Fossa) (dated 23 April 2020), with the intention of creating a VM using VirtualBox 6.0.22 (released 15 May 2020). I had issues with VirtualBox guest additions, and this is how I solved it.

The Problem

In previous experience installing Ubuntu Server on a VirtualBox VM, I simply installed VirtualBox additions from the Devices > Install Guest Additions CD image... menu.

This time however, I got errors during the install - though it’s not very clear that there was a problem:

This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.

Initially I thought that is needed is to install the build-essential package. So:

  1. Install a brand new VirtualBox VM using ubuntu-20.04-live-server-amd64.iso, with on-line installer and security updates.

  2. After login, upgrade and install build-essentials and reboot. I’m also installing KDE using SDDM as the display manager, which you don’t have to!

    sudo apt upgrade
    sudo apt install build-essential kde-plasma-desktop
    reboot
  3. Install VirtualBox additions via the virtual CD per normal.

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

Now the VirtualBox Shared Clipboard is working, as is the display driver (I guess), but not the VirtualBox Shared Folder. My Shared Folder was configured as below:

VirtualBox Shared Folder Configuration

But, the KDE File Manager, Dolphin, displays an error banner: Could not enter folder /home/[user]/Shared:

VirtualBox Shared Folder Error in Ubuntu 20

So:

  1. To mount the shared folder manually (you know the drill, replace [user] with your login):

    mkdir /home/[user]/Shared 
    sudo mount -t vboxsf shared /home/[user]/Shared
  2. While this works, the mount is not permanent and is lost after a reboot. The solution is described in this GitHub Gist by Fortunato Estorgio.

    • First, edit /etc/fstab as root (sudo vi /etc/fstab) and add this line at the end - use either tab or space(s) to separate the parameters:
      shared  /home/[user]/shared vboxsf  defaults    0   0
    • Then edit /etc/modulesas root, and add this line at the end:
      vboxsf
  3. Restart, test! The Shared Folder will be accessible, as expected, if all the parameters above are correct.

This method hard-codes the Mount Point, so you can leave this field empty in the Virtual Box Shared Folder configuration, and ignore the Make Permanent checkbox. However, the Folder Name is critical, and must match the first parameter in the fstab line.

That’s all for now, ciao!