Problem

After installing Fedora 34, I was getting an error with Virtualbox that the kernel driver was not installed.

 

Solution

Try restarting the virtual box driver:

systemctl restart vboxdrv

You might get an error:

[gokhan@fedora]~% systemctl restart vboxdrv
Job for vboxdrv.service failed because the control process exited with error code.
See "systemctl status vboxdrv.service" and "journalctl -xeu vboxdrv.service" for details.
[gokhan@fedora]~% 
[gokhan@fedora]~% systemctl status vboxdrv.service 
× vboxdrv.service - VirtualBox Linux kernel module
     Loaded: loaded (/usr/lib/virtualbox/vboxdrv.sh; enabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Thu 2021-10-28 10:55:57 CEST; 8s ago
    Process: 21590 ExecStart=/usr/lib/virtualbox/vboxdrv.sh start (code=exited, status=1/FAILURE)
        CPU: 333ms

Oct 28 10:55:57 fedora vboxdrv.sh[21590]: vboxdrv.sh: Building VirtualBox kernel modules.
Oct 28 10:55:57 fedora vboxdrv.sh[21626]: Building VirtualBox kernel modules.
Oct 28 10:55:57 fedora vboxdrv.sh[21653]: This system is currently not set up to build kernel modules.
Oct 28 10:55:57 fedora vboxdrv.sh[21653]: Please install the Linux kernel "header" files matching the current kernel
Oct 28 10:55:57 fedora vboxdrv.sh[21653]: for adding new hardware support to the system.
Oct 28 10:55:57 fedora vboxdrv.sh[21653]: The distribution packages containing the headers are probably:
Oct 28 10:55:57 fedora vboxdrv.sh[21653]:     kernel-devel kernel-devel-5.14.13-200.fc34.x86_64
Oct 28 10:55:57 fedora systemd[1]: vboxdrv.service: Control process exited, code=exited, status=1/FAILURE
Oct 28 10:55:57 fedora systemd[1]: vboxdrv.service: Failed with result 'exit-code'.
Oct 28 10:55:57 fedora systemd[1]: Failed to start VirtualBox Linux kernel module.

 

In my situation I was missing the linux kernel headers. So I had to install them

[gokhan@fedora]~% dnf install kernel-devel kernel-devel-5.14.13-200.fc34.x86_64

After installation of headers, restart the virtual box service again

[gokhan@fedora]~% systemctl restart vboxdrv