Skip to content

[Bug]: VirtualBox cannot detect the Linux headers in the WSL distribution #478

@linghengqian

Description

@linghengqian

Version

7.2.4

Host OS Type

Linux

Host OS name + version

Ubuntu 24.04.1 LTS

Host Architecture

x86

Guest OS Type

all

Guest Architecture

x86

Guest OS name + version

In fact, no virtual machine was installed.

Component

Unspecified

What happened?

  • VirtualBox cannot detect the Linux headers in the WSL distribution.
  • I'm not sure which component this problem belongs to.
  • Additional software information: I'm using AMD Ryzen Chipset Drivers 7.11.26.2142, WSL version: 2.6.3.0, kernel version: 6.6.87.2-1. Hardware information: AMD Ryzen 7 7840HS. No GPU or NPU, only iGPU is used.
  • Executing VirtualBox will produce the following log,
WARNING: The vboxdrv kernel module is not loaded. Either there is no module
         available for the current kernel (6.6.87.2-microsoft-standard-WSL2) 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.

How can we reproduce this?

  • Execute the following command in PowerShell 7 on Windows 11,
wsl --install Ubuntu-24.04
  • Execute the following command in the login shell of Ubuntu 24.04 WSL,
sudo apt update && sudo apt upgrade --assume-yes
curl --location --output /tmp/virtualbox.deb https://download.virtualbox.org/virtualbox/7.2.4/virtualbox-7.2_7.2.4-170995~Ubuntu~noble_amd64.deb
sudo apt install --assume-yes --fix-broken /tmp/virtualbox.deb
sudo apt install --assume-yes build-essential flex bison dwarves libssl-dev libelf-dev cpio qemu-utils
curl --location --output /tmp/linux-msft-wsl.tar.gz https://github.com/microsoft/WSL2-Linux-Kernel/archive/refs/tags/linux-msft-wsl-6.6.87.2.tar.gz
tar --get --verbose --file=/tmp/linux-msft-wsl.tar.gz --directory=/tmp/
cd /tmp/WSL2-Linux-Kernel-linux-msft-wsl-6.6.87.2/
sudo make headers_install INSTALL_HDR_PATH=/usr/lib/modules/6.6.87.2-microsoft-standard-WSL2/build
sudo /sbin/vboxconfig
  • The following Error Log exists at this time.
lingh@DESKTOP-58BHAE6:/tmp/WSL2-Linux-Kernel-linux-msft-wsl-6.6.87.2$ sudo /sbin/vboxconfig
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.
  • The content of /var/log/vbox-setup.log is as follows:
lingh@DESKTOP-58BHAE6:/tmp/WSL2-Linux-Kernel-linux-msft-wsl-6.6.87.2$ cat /var/log/vbox-setup.log
Building the main VirtualBox module.
Error building the module:
make V=1 CONFIG_MODULE_SIG= CONFIG_MODULE_SIG_ALL= -C /lib/modules/6.6.87.2-microsoft-standard-WSL2/build M=/tmp/vbox.0 SRCROOT=/tmp/vbox.0 -j16 modules
make[1]: warning: -j16 forced in submake: resetting jobserver mode.
make[1]: *** No rule to make target 'modules'.  Stop.
make: *** [/tmp/vbox.0/Makefile-footer.gmk:146: vboxdrv] Error 2
  • Image

Did you upload all of your necessary log files, screenshots, etc.?

  • Yes, I've uploaded all pertinent files to this issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions