VirtualBox kernel driver is not installed

I have NixOS installed on an Intel i5-11600K with 16 GB memory using the integrated GPU (not a VM). The current channel is 24.05 stable and is up to date. When attempting to start any virtual machine in VirtualBox, I get the following error:

VirtualBox kernel driver not Installed. The vboxdrv kernel module was either not loaded, /dev/vboxdrv is not set up properly, or you are using EFI Secure Boot and the module is not signed in the right way for your system. If necessary, try setting up the kernel module again by executing ‘/sbin/vboxconfig’ as root (VERR_VM_DRIVER_NOT_INSTALLED).
Result Code:
NS_ERROR_FAILURE (0X80004005)
Component:
ConsoleWrap
Interface:
IConsole {6ac83d89-6ee7-4e33-8ae6-b257b2e81be8}

I have tried live iso’s of Linux Mint Mate, Manjaro, and NixOS. I also downloaded and imported the NixOS.ova file, and got the same error.

A system reboot does not fix the problem. Secure Boot is disabled. I have not been able to install vboxconfig.

System info:

$ nix-shell -p nix-info --run “nix-info -m”
system: "x86_64-linux"
host os: Linux 6.6.45, NixOS, 24.05 (Uakari), 24.05.3914.c3d4ac725177
multi-user?: yes
sandbox: yes
version: nix-env (Nix) 2.18.5
channels(root): "nixos-24.05"
nixpkgs: /nix/var/nix/profiles/per-user/root/channels/nixos

How did you install virtualbox?
Did you do virtualisation.virtualbox.host.enable = true; or something else.

packages = with pkgs; [ virtualbox ]
virtualisation.virtualbox.host.enable = true;
users.extraGroups.vboxusers.members = [ “djw” ];
virtualisation.virtualbox.guest.enable = true;
virtualisation.virtualbox.guest.draganddrop = true;

VirtualBox launches and runs; I can configure it and create new vm’s. It just doesn’t let me actually run one. There are more programs in the "packages =" statement.

Strange, virtualisation.virtualbox.host.enable = true; should do everything neccesary.

Could you share your whole config? Maybe something else is interfering here.

By the way you can remove these lines:

packages = with pkgs; [ virtualbox ]
virtualisation.virtualbox.guest.enable = true;
virtualisation.virtualbox.guest.draganddrop = true;

virtualisation.virtualbox.host.enable = true; already adds virtualbox to your system, and virtualisation.virtualbox.guest is only usefull when running nixos as a guest inside virtualbox.

1 Like

I removed virtualbox from the packages statement and now the vm’s run. Thank you for your help.

1 Like

You’d need to reboot after enabling boot kernel modules (which virtualisation.virtualbox.host.enable = true does).