0

I am very new to Linux and recently started using it (dual boot with Windows). I am trying to run Ansible which does not support Windows and thus here I am!

Currently using:

  • Ubuntu 22.04
  • VirtualBox 7.0.10 from official site
  • Kernel (uname -r): 6.2.0-33-generic

Problem:

  1. Running VBoxManage --version in terminal gives a warning message:
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (6.2.0-33-generic) or it failed to
         load. Please recompile the kernel module and install it by
       sudo /sbin/vboxconfig

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

7.0.10r158379

  1. Running sudo /sbin/vboxconfig gives this error message:
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 /sbin/vboxconfig 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.

What I have tried: Solutions offered here, I tried disabling secure boot and doing the mokutil package. The error message still persists afterwards.

Thank you for your time! Really appreciate it :D

P.S. I am trying to learn Ansible with Vagrant and VirtualBox. Ansible do not support Windows and VirtualBox does not support Mac with Apple Silicon. So I am really hoping I can make it work with Linux.

Sean
  • 11

4 Answers4

1

Install GCC v. 12, because VirtualBox needs it for building its kernel module for your Ubuntu:

sudo apt install gcc-12
Fofola
  • 11
0

I managed to resolve the issue by reinstalling the Linux headers using the following

sudo apt install --reinstall linux-headers-$(uname -r)

This command reinstalls the headers for the currently running kernel, which resolved the conflict or issue that was causing the problem. Hope this helps those who are facing similar issues :)

Sean
  • 11
0

Another point, you need to ensure that you have the GCC compiler version 12 and above, or else the VirtualBox installation will fail. And this is even for version 7.

0

I fixed this by installing gcc version 12 $ sudo add-apt-repository ppa:ubuntu-toolchain-r/ppa -y $ sudo apt update $ sudo apt install g++-12 gcc-12 $ sudo /sbin/vboxconfig

George Ulahannan
  • 89
  • 1
  • 7
  • 17