How to fix and prevent VirtualBox Kernel driver not installed

I met the same issue after VirtualBox upgrade to 5.2.6 r120293

Linux kernel version 4.14.13-041413-generic

The following commands sequence helped for me:

$ sudo apt install --reinstall virtualbox-dkms && sudo apt install libelf-dev
$ sudo /sbin/vboxconfig

$ sudo apt install --reinstall virtualbox-dkms && sudo apt install libelf-dev

just this solved the same problem on my Kubuntu 18.4.2


After reinstalling virtualbox-dkms as above, you may also have to sudo modprobe vboxdrv to reload the kernel module.