4

(I already tried things from answers in similar questions to this one)

Fedora Linux 37 (Workstation Edition) x86_64, kernel: 6.0.7-301.fc37.x86_64

I installed VirtualBox with sudo dnf install VirtualBox

After I start Virtual Box with VirtualBox, I'm getting error:

WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (6.0.7-301.fc37.x86_64) or it failed to
         load. Please try load the kernel module by executing as root

           dnf install akmod-VirtualBox kernel-devel-6.0.7-301.fc37.x86_64
           akmods --kernels 6.0.7-301.fc37.x86_64 && systemctl restart vboxdrv.service

         You will not be able to start VMs until this problem is fixed.

Recommended commands works fine, except the last one, after systemctl restart vboxdrv.service I'm getting:

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.

systemctl status vboxdrv.service:

× vboxdrv.service - Linux kernel module init script
     Loaded: loaded (/usr/lib/systemd/system/vboxdrv.service; enabled; preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-02-27 21:25:49 EET; 9s ago
    Process: 73393 ExecStart=/sbin/modprobe vboxdrv (code=exited, status=1/FAILURE)
   Main PID: 73393 (code=exited, status=1/FAILURE)
        CPU: 23ms

Feb 27 21:25:49 fedora systemd[1]: Starting vboxdrv.service - Linux kernel module init script...
Feb 27 21:25:49 fedora modprobe[73393]: modprobe: ERROR: could not insert 'vboxdrv': Exec format error
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Main process exited, code=exited, status=1/FAILURE
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Failed with result 'exit-code'.
Feb 27 21:25:49 fedora systemd[1]: Failed to start vboxdrv.service - Linux kernel module init script.

journalctl -xeu vboxdrv.service:

Feb 27 21:25:49 fedora systemd[1]: Starting vboxdrv.service - Linux kernel module init script...
░░ Subject: A start job for unit vboxdrv.service has begun execution
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit vboxdrv.service has begun execution.
░░ 
░░ The job identifier is 5095.
Feb 27 21:25:49 fedora modprobe[73393]: modprobe: ERROR: could not insert 'vboxdrv': Exec format error
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Main process exited, code=exited, status=1/FAILURE
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ An ExecStart= process belonging to unit vboxdrv.service has exited.
░░ 
░░ The process' exit code is 'exited' and its exit status is 1.
Feb 27 21:25:49 fedora systemd[1]: vboxdrv.service: Failed with result 'exit-code'.
░░ Subject: Unit failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ The unit vboxdrv.service has entered the 'failed' state with result 'exit-code'.
Feb 27 21:25:49 fedora systemd[1]: Failed to start vboxdrv.service - Linux kernel module init script.
░░ Subject: A start job for unit vboxdrv.service has failed
░░ Defined-By: systemd
░░ Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
░░ 
░░ A start job for unit vboxdrv.service has finished with a failure.
░░ 
░░ The job identifier is 5095 and the job result is failed.

After trying to run any virtual box, I'm getting error Kernel driver not installed (rc=-1908)

enter image description here

(akmod-VirtualBox and kernel-devel for my kernel version is installed)

I will be grateful for any help or suggestions. Also, I have problems with booting on higher kernel versions, so it may be a reason of this issue.

3
  • 1
    Try these answers.
    – harrymc
    Commented Feb 27, 2023 at 19:43
  • As commented above, indeed. It's either unsigned drivers (you want to sign them manually -or- disable Secure Boot if doable) or missing headers, or a combination of this two. Commented Feb 27, 2023 at 19:45
  • 1
    Secure boot is disabled, installed kernel-headers has version 6.1.5-200. After dnf install kernel-headers-6.0.7-301.fc37.x86_64 or dnf install kernel-headers-uname -r` i'm getting message Error: Unable to find a match: kernel-headers-6.0.7-301.fc37.x86_64
    – metramarta
    Commented Feb 27, 2023 at 21:28

2 Answers 2

4

Unfortunately, the kernel module that's required to run VirtualBox has a history of breaking on almost every update, especially on Fedora where new kernel versions are often shipped before matching kmod packages are available.

On Fedora 37, this error can occur even if the right kernel module is already installed from the repository.

$ virtualbox &
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (6.2.15-200.fc37.x86_64) or it failed to
         load. Please try load the kernel module by executing as root

           dnf install akmod-VirtualBox kernel-devel-6.2.15-200.fc37.x86_64
           akmods --kernels 6.2.15-200.fc37.x86_64 && systemctl restart vboxdrv.service

         You will not be able to start VMs until this problem is fixed.

$ cat /etc/fedora-release 
Fedora release 37 (Thirty Seven)
$ uname -r
6.2.15-200.fc37.x86_64

# dnf install kmod-VirtualBox-6.2.15-200.fc37.x86_64.x86_64
Package kmod-VirtualBox-6.2.15-200.fc37.x86_64-7.0.8-1.fc37.x86_64 is already installed.

So you can run the akmods command successfully because it just checks if the kernel module is there and it is there because it has been installed from the repository (it being the precompiled kernel module).

$ sudo akmods --kernels 6.2.15-200.fc37.x86_64
Checking kmods exist for 6.2.15-200.fc37.x86_64            [  OK  ]

Note that akmods just checks if it's there and that's all.

Although I have not seen that error: Exec format error
But that does not seem to make any difference.

You should try to remove the precompiled kernel module and then build it yourself (not manually, but on your machine, specifically for your environment). That approach has worked best in recent years for most variations of this VirtualBox error.

  1. Make sure you have akmods installed, as well as the required kernel build dependencies. The minimum would be:
    # dnf install akmods kernel-devel

  2. Remove whichever precompiled VirtualBox kernel module you have installed, but be careful not to remove all of VirtualBox along the way (read the output of dnf carefully).
    # dnf erase kmod-VirtualBox-$(uname -r)
    Since you specifically mention that you are stuck with the current kernel version, it should be sufficient to remove that version only, otherwise you could even run dnf erase kmod-VirtualBox-*.

  3. Now run akmods to build that kernel module on and for your machine. # akmods --kernels $(uname -r)
    That tool also has a "force" option: akmods --force

The last command should now print two lines instead of one, the second line indicating that it's building (recreating) the missing kernel module for VirtualBox:

# akmods --kernels 6.2.15-200.fc37.x86_64
Checking kmods exist for 6.2.15-200.fc37.x86_64            [  OK  ]
Building and installing VirtualBox-kmod                    [  OK  ]

If that has worked, you still need to reload the module (or reboot):

# systemctl restart vboxdrv.service

Then restart VirtualBox. It should work now.

3
  • Thanks for the answer! At this point I moved to nobara where I have not encountered this problem, but I hope your answer will be useful to other users who have it.
    – metramarta
    Commented Aug 26, 2023 at 6:15
  • Thanks a lot! Just tried this, it worked also after upgrading to Fedora 39.
    – Attila123
    Commented Dec 21, 2023 at 21:04
  • Excellent instructions. Just worked finally now with my Fedora 40 that's been available for 3 months already.
    – Pysis
    Commented Jul 16 at 22:11
2

I have faced the same issue and the I used the following to solve the issue

my Kernel version is: 6.0.7-301.fc37.x86_64

dnf -y install @development-tools
dnf -y install kernel-headers kernel-devel-6.0.7-301.fc37.x86_64 dkms elfutils-libelf-devel qt5-qtx11extras

Then run the following command to build/load the vboxdrv kernel module

 sudo /sbin/vboxconfig

Good Luck

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .