VirtualBox
Among Linux users, VirtualBox has the best reputation as a free out-of-the-box virtualization solution for the desktop, because the software, which was developed in Germany and later acquired by Sun, then by Oracle, is particularly easy to set up and administer.
The earlier distinction between open source edition and commercial version has been dropped since VirtualBox 4. The program has been distributed freely and open source since then.
To activate USB support (from version 5 also USB 3.0), an extension pack must be downloaded from the manufacturer Oracle and then selected in the VirtualBox GUI under File->Global Settings->Additional Packs. This extension is still under a proprietary license, but is free for education and personal use.
The VirtualBox Guest Additions provide for a better integration of the guest with the host system – including better graphics support as well as a shared clipboard. They are included in an ISO file, which is to be installed in the host, so that it can be mounted in the guest system like a secondary drive. You don’t have to do that on the command line. Just click on devices in the VirtualBox graphical user interface and click “Insert Guest Additions CD Image …” to start the setup dialog.
Installation
sudo apt-get install virtualbox virtualbox-guest-additions-iso
Troubleshooting kernel modules and secure boot
VirtualBox requires three kernel modules that are not part of the Linux kernel and therefore have to be loaded separately. During kernel updates, dkms takes care of rebuilding and loading these modules. You can also initiate this process yourself in case of problems:
sudo apt install --reinstall virtualbox-dkms
Nevertheless, it can happen after upgrades of Ubuntu machines with Secure Boot that the kernel modules cannot be loaded anymore. The corresponsing systemd journal entry is:
modprobe vboxdrv failed. Please use ‘dmesg’ to find out why
If you follow the advice and sudo dmesg | tail
holds a line that complains about a missing signature, you have to sign the modules manually:
First, create a new password, which will later be used for the key creation, while we make sure, that the password is not recorded in .bash_history:
$ read -s SIGN_PIN
Now, type in the passwort and press enter to finish. Next we store the entered password and the kernel version in variables for later use:
$ export SIGN_PIN
$ VERSION="$(uname -r)"
Change into the directory, where dkms has created the modules, and use a loop to sign all of them:
$ cd /lib/modules/"$VERSION"/updates/dkms
$ for i in *.ko ; do sudo --preserve-env=SIGN_PIN /usr/src/"$VERSION"/scripts/sign-file sha256 /var/lib/shim-signed/mok/MOK.priv /var/lib/shim-signed/mok/MOK.der "$i" ; done
Afterwards, you should be able to load the signed modules:
$ modprobe vboxdrv
$ modprobe vboxnetadp
$ modprobe vboxnetflt
… and VirtualBox works again!
References: Bug ticket at VirtualBox, Debian wiki on SecureBoot
Alternatives
The commercial VMWare as well as the open source solutions Xen and KVM can also use CPU extensions for virtualization.