Solve VirtualBox problems after upgrading to latest Linux kernel on Ubuntu 22.04

Akriotis Kyriakos
3 min readJul 2, 2023

--

Solve the “Kernel driver not installed (rc=-1908)” issue that blocks virtual machines from starting after a kernel upgrade

One side-effect that I discover immediately after upgrading to the latest Linux kernel on my Ubuntu 22.04 (from 5.19 to 6.2) was a persistent error that was prohibiting me from starting any virtual machine due to the event that the VirtualBox Linux kernel driver (vboxdrv) was either not loaded or certain permission was blocking it from doing so.

There are lots of recommendations out there guiding you how to mitigate this rather annoying, most of them are not working or are not realistic as they tend to instruct you installing a different version of VirtualBox or fiddle with its kernel modules. Just don’t, the solution is rather simpler, so let’s go for it. Thing is you need to just reconfigure VirtualBox. Issue the following command:

sudo /sbin/vboxconfig 

Chances are — although thin — that it will run smoothly and then you will see in your console:

but most probably — given that you have done a major patch upgrade to your kernel — it will not fly and you will get an error message like this:

In that case let’s follow the recommendation and have a look in the log file:

sudo cat /var/log/vbox-setup.log

Most probable reason of failure is that the new kernel is being compiled with a newer version of gcc than the VirtualBox kernel modules:

In my case, I had gcc-11 and the obvious way to go is to install gcc-12 and then set it as the default one. You will find gcc in /usr/bin:

First thing you need to do is to install gcc-12:

sudo apt install gcc-12 -y

and then recreate the gcc symlink to point to gcc-12 instead of gcc-11.

sudo rm /usr/bin/gcc
sudo ln -s /usr/bin/gcc-12 /usr/bin/gcc

Check now the default version of gcc in your box:

gcc --version

and if all went well, you should see the following output:

Now go ahead and repeat the VirtualBox reconfiguration step:

sudo /sbin/vboxconfig

the reconfiguration process should now run smoothly:

You are now set, your VirtualBox is functionable and you can spin virtual machines again.

If you found this information useful, don’t forget to 👏 under this article and follow my account. Stay tuned…

--

--

Akriotis Kyriakos

talking about: kubernetes, golang, open telekom cloud, aws, openstack, sustainability, software carbon emissions