"The vboxdrv kernel module is not loaded" error after upgrading kernel

Dear Forum User,

Does anyone have an issue using Virtualbox after upgrading the kernel?

  gnome-shell-extension-desktop-icons-40.7-2.el9.noarch         grub2-tools-efi-1:2.06-46.el9.rocky.0.1.x86_64
  grub2-tools-extra-1:2.06-46.el9.rocky.0.1.x86_64              kernel-5.14.0-162.6.1.el9_1.x86_64
  kernel-core-5.14.0-162.6.1.el9_1.x86_64                       kernel-devel-5.14.0-162.6.1.el9_1.x86_64
  kernel-modules-5.14.0-162.6.1.el9_1.x86_64                    libnvme-1.0-5.el9.x86_64
  nginx-core-1:1.20.1-13.el9.x86_64                             python3-gobject-base-noarch-3.40.1-6.el9.noarch
  kernel-5.14.0-70.13.1.el9_0.x86_64 kernel-core-5.14.0-70.13.1.el9_0.x86_64 kernel-modules-5.14.0-70.13.1.el9_0.x86_64

vboxdrv.sh: Stopping VirtualBox services.
vboxdrv.sh: Starting VirtualBox services.
vboxdrv.sh: Building VirtualBox kernel modules.
vboxdrv.sh: failed: Look at /var/log/vbox-setup.log to find out what went wrong.

There were problems setting up VirtualBox.  To re-start the set-up process, run
as root.  If your system is using EFI Secure Boot you may need to sign the
kernel modules (vboxdrv, vboxnetflt, vboxnetadp, vboxpci) before you can load
them. Please see your Linux system's documentation for more information.

I’d upgraded the Rocky Linux kernel, and there was a compilation error in “vboxdrv”.
Could anyone let me know how to fix it?

Thanks for the reply in advance.

This is a VirtualBox problem due to the compile errors of their module being thrown.

See this on Fedora 36. virtualbox.org • View topic - VirtualBox-6.1 on Fedora 36 - Installation failed

If that doesn’t help, suggest asking on the VirtualBox forums since they need to fix their code.

Hi, iwalker

Thanks to your reply, I could solve the issue.

  • Please remove VirtualBox installed first.
  1. Download the Virtualbox development release
  2. sudo dnf install qt5-qtx11extras
  3. sudo dnf install qt5-qttools-libs-help.x86_64
  4. sudo rpm -i VirtualBox-7.0-7.0.5_154733_el9-1.x86_64.rpm

then I confirmed VirtualBox working as normal.