23

I received the updates through normal Software Updater, 10-Jan-2018. After this VirtualBox would not start any VM, complaining about dkms and asking to make modprobe vboxdrv. Following the advice I reinstalled virtualbox-dkms with:

sudo apt-get --reinstall install virtualbox-dkms

After this and a reboot I tried to start a VM which freezed the whole machine and a hard reboot was necessary.

Is there a way to make VirtualBox work with the latest kernels?

EDIT:

As suggested by N0rbert, the command:

apt-cache policy `dpkg -S VirtualBox | head -n1 | sed -e 's/://g' | awk '{print $1}'`

gives:

virtualbox-qt:
  Installed: 5.0.40-dfsg-0ubuntu1.16.04.2
  Candidate: 5.0.40-dfsg-0ubuntu1.16.04.2
  Version table:
 *** 5.0.40-dfsg-0ubuntu1.16.04.2 500
        500 http://fr.archive.ubuntu.com/ubuntu xenial-updates/multiverse amd64 Packages
        100 /var/lib/dpkg/status
     5.0.18-dfsg-2build1 500
        500 http://fr.archive.ubuntu.com/ubuntu xenial/multiverse amd64 Packages

EDIT (on 29-Mar-2018): Issue is resolved for me, with the Ubuntu Ubdate from today. I have seen that it had some virtualbox-updates, therefore I tried to boot with the most recent kernel again. Then I had to run

sudo apt-get --reinstall install virtualbox-dkms

And after this my virtual machines in VirtualBox started working without crashing the whole computer. Finally!

  • Try to upgrade virtualbox to current release 5.2.4. Some kernel issue for newer kernels were resolved in the meantime. – Takkat Jan 11 '18 at 8:25
  • 1
    @Takkat: But I VirtualBox 5.2.4 is not part of Ubuntu 16.04 - I just looked up with synaptic!? I have chosen on purpose the VirtualBox from the Ubuntu distribution to be in sync with the kernel and to avoid headaches like these. – Max von Anon Jan 11 '18 at 10:40
  • 2
    Please update your post with output of: apt-cache policy `dpkg -S VirtualBox | head -n1 | sed -e 's/://g' | awk '{print $1}'`. – N0rbert Jan 11 '18 at 18:03
  • 2
    I have found KVM/QEMU to be much more stable across kernel updates - the price that I pay for this is that there is not yet support for 3D graphics acceleration. – Charles Green Jan 12 '18 at 1:21
20

Upgrading to VirtualBox 5.2 using oracle repository worked for me.

Here are the steps (legacy doc here):

1) Add oracle repository :

sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian xenial contrib"

Modify this command to suit your ubuntu version if you are not using Ubuntu 16.04 (xenial).

2) Add GPG keys for repository :

wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

3) Check GPG keys :

sudo apt-key finger Oracle

should give show the following fingerprints :

B9F8 D658 297A F3EF C18D  5CDF A2F6 83C5 2980 AECF
Oracle Corporation (VirtualBox archive signing key) 

7B0F AB3A 13B9 0743 5925  D9C9 5442 2A4B 98AB 5139
Oracle Corporation (VirtualBox archive signing key)

4) Install VirtualBox 5.2

sudo apt update && sudo apt install virtualbox-5.2

In my case I had errors and I had to remove virtualbox-dkms package and run /sbin/vboxconfig :

sudo apt remove --purge virtualbox-dkms
sudo  /sbin/vboxconfig

Depending on your desktop environment, the launcher menu icon may have disappeared. In that case, recreate it manually; the command is simply virtualbox.

  • 1
    I also had to install the 5.2 extension pack, like this: curl -O http://download.virtualbox.org/virtualbox/5.2.0/Oracle_VM_VirtualBox_Extension_Pack-5.2.0-118431.vbox-extpack ; sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.2.0-118431.vbox-extpack – user207863 Jan 12 '18 at 15:01
  • 1
    This works for me. Still, if you rather not spend time downloading, installing and configuring, see @therefriedbean post. – twnaing Jan 16 '18 at 5:04
  • For the first step, sudo echo "..." > /etc/.. won't work when run as a normal user because only the echo runs under sudo. IMO the best way to handle this is probably echo "..." | tee -a /etc/... – EvanED Jan 19 '18 at 19:16
  • @EvanED Thanks, I edited my answer to use add-apt-repository which I think is more self explanatory. For those who want to use sources.list.d the command is echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" | sudo tee /etc/apt/sources.list.d/oracle-virtualbox.list. – Max Jan 23 '18 at 8:45
  • 1
    After installing the newer version, my VMs still wouldn't start. See Andy's answer on how to fix this. – MakisH Jan 31 '18 at 9:16
4

Cross referencing:

Official bug tracking this issue is:

https://bugs.launchpad.net/bugs/1736116

There are solutions there for installing VB 5.1.30 as well as 5.2.4. Some users are reporting QT dependency issues with 5.2.4, so 5.1.30 might be a safer bet.

Several options for installing either version are listed there, and the discussion is ongoing, so I am not going to reproduce here.

3

When you boot your machine change which kernel you boot into by going into "Advanced options for Ubuntu".

Pick the version number like 4.10 -- Should start working until this gets fixed.

  • 1
    This is indeed what I did. I booted in the previous kernel and am waiting until Ubuntu updates it's virtualbox to work with their latest kernel. – Max von Anon Jan 12 '18 at 19:18
  • 1
    that might work, but the newer kernels (that don't work together with virtualbox) bring fixes for meltdown/spectre! – Jeno Feb 6 '18 at 13:45
3

So, in my case, the kernel modules were not removed properly.

Here are the details:

root@Dell5280 [~]# cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS

root@Dell5280 [~]# uname -r
4.13.0-31-generic

Problem:

root@Dell5280 [~]# modinfo vboxdrv
filename: /lib/modules/4.13.0-31-generic/updates/dkms/vboxdrv.ko
version: 5.0.40_Ubuntu r115130 (0x00240000)
license: GPL
description: Oracle VM VirtualBox Support Driver
author: Oracle Corporation
srcversion: 6D8B4900A693FC50489A130
depends:
name: vboxdrv
vermagic: 4.13.0-31-generic SMP mod_unload

FIX:

root@Dell5280 [~]# rm /lib/modules/4.13.0-31-generic/updates/dkms/vboxdrv.ko

root@Dell5280 [~]# modinfo vboxdrv
filename: /lib/modules/4.13.0-31-generic/updates/dkms/vboxdrv.ko
modinfo: ERROR: could not get modinfo from 'vboxdrv': No such file or directory
[1] root@Dell5280 [~]# /sbin/vboxconfig
vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: Starting VirtualBox services.

root@Dell5280 [~]# modinfo vboxdrv
filename: /lib/modules/4.13.0-31-generic/misc/vboxdrv.ko
version: 5.2.7 r120349 (0x00290000)
license: GPL
description: Oracle VM VirtualBox Support Driver
author: Oracle Corporation
srcversion: 4880B21EFF1B605D6402982
depends:
name: vboxdrv
vermagic: 4.13.0-31-generic SMP mod_unload
parm: force_async_tsc:force the asynchronous TSC mode (int)

After this, everything works (at least in my case)

Hope it helps.

I posted the reply at https://bugs.launchpad.net/ubuntu/+source/virtualbox/+bug/1736116

  • This helped me too after downloading virtualbox 5.2.6 from the website. – Gideon Maina Feb 22 '18 at 7:25

protected by Community Jan 12 '18 at 19:36

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.