15

Yesterday I received a kernel upgrade and after reboot, VirtualBox stopped working.

Here is my system info (after kernel upgrade):

matteo@workstation:~$ cat /etc/lsb-release 
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.3 LTS"
matteo@workstation:~$ uname -a
Linux workstation 4.4.0-116-generic #140-Ubuntu SMP Mon Feb 12 21:23:04 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I installed VirtualBox long ago with

sudo apt install linux-headers-$(uname -r)
sudo apt install virtualbox-dkms virtualbox virtualbox-qt

used on daily basis and never had problems with kernel updates. The error I receive now is

matteo@workstation:~$ sudo modprobe vboxdrv
modprobe: ERROR: could not insert 'vboxdrv': Exec format error
matteo@workstation:~$ dmesg | tail -n 1
[ 1413.167311] vboxdrv: version magic '4.4.0-116-generic SMP mod_unload modversions ' should be '4.4.0-116-generic SMP mod_unload modversions retpoline '

I found a forum post with this error message here from three days ago, unfortunately without resolution. Therfore I tried to remove the VirtualBox packeges from the Ubuntu repo, and install the latest 5.2 using this procedure. However, even after rebooting the machine, the error remains.

What can I do in this case?

matpen
  • 331
  • This is happening with other modules too (e.g. https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1750937 and https://answers.launchpad.net/ubuntu/+question/664826) – ricab Feb 23 '18 at 00:52
  • 2
    A workaround for the moment is to load the previous kernel (4.4.0-112) in grub. – ricab Feb 23 '18 at 00:52
  • For those wondering how to perform the suggestion by @ricab: simply hold shift while booting, select "Advanced options for Ubuntu" and select an older kernel version from the menu, as explained here. I can confirm that my previous kernel version (4.4.0-112) does not have the problem described in the question, so that is a viable workaround until a solution is released. – matpen Feb 23 '18 at 22:24
  • In 16.04 it's the Esc key. – D.Bugger Feb 26 '18 at 08:47
  • @D.Bugger on my 16.04 shift does work. It is not my case, but I have read of some people getting it to work only with "right shift" or "left shift". – matpen Feb 26 '18 at 15:34
  • @matpen Left-shift didn't stop the boot process, Esc did, and I didn't bother to try right-shift (yet). By the way, how can one find out if there's an update that solves this issue? – D.Bugger Feb 26 '18 at 20:04

3 Answers3

9

I was facing the same problem. After kernel upgrade my gcc version was showing as 5.4.1. Downgrading this version to 5.4.0 helped me to have retpoline for vboxdrv kernel module.

Following steps from this link helped me solve my issue:

sudo apt-get install ppa-purge
sudo ppa-purge ppa:ubuntu-toolchain-r/test
#Select gcc version 5 using update-alternatives manually
sudo update-alternatives --config gcc

After these steps gcc --version should be (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609

Then purge all the new linux headers (4.4.0-116)

sudo apt-get purge linux-headers-4.4.0-116 linux-headers-4.4.0-116-generic linux-image-4.4.0-116-generic linux-image-extra-4.4.0-116-generic linux-signed-image-4.4.0-116-generic

Again install them

sudo apt-get install linux-generic linux-signed-generic

Then re-install virtualbox, I installed latest virtualbox-5.2 this time, but default 5.0 version of virtualbox should also work fine.

sudo apt-get purge virtualbox-dkms virtualbox virtualbox-qt
sudo apt-get install virtualbox-5.2

And, we have retpoline support in latest module

anirudh@AHDRMD34579:~$ modinfo vboxdrv 
filename:       /lib/modules/4.4.0-116-generic/misc/vboxdrv.ko
version:        5.2.6 r120293 (0x00290000)
license:        GPL
description:    Oracle VM VirtualBox Support Driver
author:         Oracle Corporation
srcversion:     4880B21EFF1B605D6402982
depends:        
vermagic:       4.4.0-116-generic SMP mod_unload modversions retpoline 
parm:           force_async_tsc:force the asynchronous TSC mode (int)
4

The related problem listed in @ricab 's comment has been traced down to a problem with the new kernel requiring a certain version level of gcc to successfully compile kernel modules.

On my system the gcc update was pushed out AFTER the kernel update, causing the recompiles to fail.

Once the root cause was discovered, I was able to fix the system by uninistalling and reinstalling the new kernel. That fixed my graphics drivers, but I had to issue sudo /sbin/vboxconfig to fix virtualbox after booting into the new kernel.

My system is 14.04 so I cannot advise you as to the proper version of gcc for your 16.04 system, but this is discussed at https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1750937

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
-1

I also had this problem recently and posted a question here about it. I did some digging and this is indeed a known issue.

The bug report is in my link.

Virtualbox has suddenly stopped working

I think the general concensus is to boot into the 4.4 kernel until the issue is fixed. (It is certainly the easiest solution for me.)

hatterman
  • 2,280
  • 2
  • 22
  • 33