VirtualBox not starting after kernel upgrade

10,435

Solution 1

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)

Solution 2

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

Share:
10,435

Related videos on Youtube

matpen
Author by

matpen

Updated on September 18, 2022

Comments

  • matpen
    matpen over 1 year

    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?

    • ricab
      ricab about 6 years
    • ricab
      ricab about 6 years
      A workaround for the moment is to load the previous kernel (4.4.0-112) in grub.
    • matpen
      matpen about 6 years
      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.
    • D.Bugger
      D.Bugger about 6 years
      In 16.04 it's the Esc key.
    • matpen
      matpen about 6 years
      @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".
    • D.Bugger
      D.Bugger about 6 years
      @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?
  • matpen
    matpen about 6 years
    Thank you for the link. Unfortunately, it does not seem to work in my case for Xenail (and I am not alone). I received no gcc upgrade recently, but I am already on gcc 5.4.1, and even tried with gcc 7.2.0.
  • jfs
    jfs about 6 years
  • matpen
    matpen about 6 years
    @jfs right, however I need the ppa gcc so I am not able to test right now.
  • David Foerster
    David Foerster about 6 years
    If your answer is essentially a referral to another question, it would be better to flag this question as a duplicate of the other once you earned 15 reputation. If you have the reputation don’t forget to vote for the answer(s) there that you found useful!
  • hatterman
    hatterman about 6 years
    Understood. Will do.
  • George Udosen
    George Udosen about 6 years
    Excellent work helped me after 6months with no access to my machines
  • shawty
    shawty almost 5 years
    I WANT TO GIVE YOU ALL THE POINTS IN THE WORLD!!!!! :-) But I can only upvote you once unfortunately.