Ubuntu 20.4: Virtualbox not running after the last upgrade
When launching a VM in Virtualbox I got an error saying that it can’t be started because a required module isn’t loaded. It suggests to manually load it.
# modprobe vboxdrv [This outputs an error message] modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/5.8.0-34-generic
Re-installing Virtualbox also fails because the virtualbox-dkms package can’t be configured
# apt install virtualbox virtualbox-dkms [...] Removing old virtualbox-6.1.10 DKMS files... ------------------------------ Deleting module version: 6.1.10 completely from the DKMS tree. ------------------------------ Done. Loading new virtualbox-6.1.10 DKMS files... Building for 5.8.0-34-generic 5.8.0-36-generic Building initial module for 5.8.0-34-generic ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/virtualbox-dkms.0.crash' Error! Bad return status for module build on kernel: 5.8.0-34-generic (x86_64) Consult /var/lib/dkms/virtualbox/6.1.10/build/make.log for more information. [..] E: Sub-process /usr/bin/dpkg returned an error code (1)
The last system update upgraded the kernel from 5.4 to 5.8, and there is something in the new kernel that breaks Virtualbox.
There are two solutions:
Installing Virtualbox from source or downgrading to the previous kernel.
I have chosen the latter as I expect this to be a temporary issue, and a fix to be released soon.
The process to revert is simple.
Reboot and in the GRUB screen select Advanced Options.
Ubuntu 20.04.1 LTS *Advanced options for Ubuntu 20.04.1 LTS History for Ubuntu 20.04.1 LTS UEFI Firmware Settings
Select a trusted 5.4 version to boot from. Most likely the 3rd option in the list. Your exact version numbers might differ from mine.
Ubuntu 20.04.1 LTS, with Linux 5.8.0-34-generic Ubuntu 20.04.1 LTS, with Linux 5.8.0-34-generic (recovery mode) *Ubuntu 20.04.1 LTS, with Linux 5.4.0-59-generic Ubuntu 20.04.1 LTS, with Linux 5.4.0-59-generic (recovery mode) Ubuntu 20.04.1 LTS, with Linux 5.4.0-54-generic Ubuntu 20.04.1 LTS, with Linux 5.4.0-54-generic (recovery mode)
After the boot, check that you are running 5.4.
$ uname -r 5.4.0-59-generic
See which versions of 5.8 you have installed in your system.
$ apt list --installed | grep linux-image
Make a note of the 5.8 versions listed (or use grep again), and remove them manually.
# apt remove linux-image-unsigned-5.8.0-34-generic
Virtualbox should be working.
Linux 5.8 seems to have been removed for the time being, so if you run any updates you are safe.