VirtualBox on Host Running Kernel 4.12

Upgrading to Linux kernel 4.12 will break VirtualBox. Attempting to re-install VirtualBox 5.1.22 (either from the Ubuntu repositories or by downloading the binaries directly from virtualbox.org) will not help – the installation will fail.

Thankfully, there is a patch available that can be applied – but only to the version of VirtualBox from virtualbox.org. If you have installed VirtualBox from the repositories, you need to uninstall it, then install the .deb from virtualbox.org, then apply the patch, then run vboxconfig.

The steps are as follows:

  1. Uninstall VirtualBox

    This step is only required if you have installed VirtualBox from the Ubuntu repositories.

    sudo apt remove --purge virtualbox*
  2. Download VirtualBox

    Download the latest version of VirtualBox (at time of writing, 5.1.22) from virtualbox.org.

  3. Install the Patch

    cd /usr/share/virtualbox/src
    sudo wget http://paste.siduction.org/20170629003423
    sudo patch -Np0 < 20170629003423
    sudo /sbin/vboxconfig

You’re good to go!