22

platform: OS : Ubuntu 22.04
Kernel v.: 6.5.0.14-generic

After upgrading the kernel from 6.2 to 6.5, i encountered an error from VirtualBox which is shown in the picture below about virtualbox-dkms missing.

enter image description here

I tried reinstalling the linux-headers-generic and virtualbox-dkms and reactivating it, even rebooted the system with the kernel v. 6.2 and still didn't work out.
more logs:

sudo apt install virtualbox-dkms

sudo apt install virtualbox-dkms (output)

journalctl -xeu virtualbox.service

journalctl -xeu virtualbox.service (output)

stumblebee
  • 4,379

7 Answers7

32

It is a bug, VirtualBox 6 isn't compatible with the new kernel. You have to revert-back to the old kernel or install the VirtualBox 7 from oracle:

Stop the virtualbox service:

sudo systemctl stop virtualbox.service

then:

echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] https://download.virtualbox.org/virtualbox/debian jammy contrib" |
sudo tee /etc/apt/sources.list.d/vbox.list
wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | 
sudo gpg --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg --dearmor
sudo apt-get update
sudo apt-get install virtualbox-7.0

Bug #2048956 : virtualbox-dkms 6.1.38-dfsg-3~ubuntu1.22.04.1: virtualbox kernel module failed to build

Update

As said @ArryBbolt3 A fix has been released solving the kernel module failed to build error.

The new VirtualBox 6.1.48-dfsg-1~ubuntu1.22.04.1 and its dependencies is available from jammy-updates. You should have the following line in your /etc/apt/sources.list ( sudo apt edit-sources):

deb http://cz.archive.ubuntu.com/ubuntu jammy-updates main multiverse

@ArrayBolt3 Thank you for this update.

GAD3R
  • 3,748
9

I had the exact same issue.

I downloaded the VirtualBox 7.0.12 DEB package directly from Oracle, uninstalled virtualbox-dkms from the system and then installed the deb with sudo dpkg -i /path/to/downloaded/deb.

All working perfectly so far.

2

Instead of completely re-installing, you could also try to reconfigure virtualbox and re-load the virtualbox kernel module:

dpkg-reconfigure virtualbox-dkms
dpkg-reconfigure virtualbox
modprobe vboxdrv

This worked for me when virtualbox broke after a kernel update (although in my case, it was an earlier version).

1

I just had a similar problem. I purge virtual box and dkms. then I installed the latest version.

0

Got this problem when I tried to start a Windows 10 VM under Virtualbox 7.0. Tried the accepted answer but still had the problem. Answer by TehPeGaSuS solved my problem. The Windows VM was still there, working. So just:

  • sudo apt remove virtualbox-dkms
  • sudo dpkg -i 'path to VB 7.0 .deb file downloaded from Oracle'
kente2t
  • 1
  • 1
0

I have same error, i try everything, ugrade kernel, downgrade kernel, upgrade VB from 6.1 to 7, reinstall dkms lot of times and can not run VM. Something weird: i install 7.0 and when reboot open VB and is 6.1... i don't know what else i can do.

Updating my comment: problem was kernel version, VB has a bug with newer kernel versions, downgrade kernel even more, to 6.2, and everything work again. About the weird VB switching version, it happened when install virtualbox-dkms, automatically change linux headers and VB versión.

Juan_P
  • 1
0

I just dealt with this issue with kernel version 6.5.0-44-generic. In this case the problem is of a different nature, VirtualBox fails to install properly (hence the error message) because the gcc version installed by default (11) differs from the one used to compile the kernel (12).

Therefore, the solution is to install gcc 12 and then install the .deb file from ORACLE. If you already tried installing, you can just run the config: sudo /sbin/vboxconfig.