VirtualBox kernel driver is not accessible

Configuration

I tried to install Virtualbox 7.0.14 with Nix OS 24.05 as host system and used the following configuration:

virtualisation.virtualbox.host.enable = true;
virtualisation.virtualbox.host.enableExtensionPack = true;
users.users.user.extraGroups = [ “vboxusers” ];

Error

I got the following error message:
VirtualBox kernel driver is not accessible, permission problem. If you have built VirtualBox yourself, make sure that you do not have the vboxdrv kernel module from a different build or installation loaded. Also, make sure the vboxdrv udev rule gives you the permission you need to access the device. (VERR_VM_DRIVER_NOT_ACCESSIBLE).

Debug Steps

  1. I restarted the pc because of the kernel change. There was no change after the reboot.

  2. I tested if the models can be loaded:
    sudo modprobe vboxdrv
    sudo modprobe vboxnetflt
    sudo modprobe vboxnetadp
    There was no error.

  3. I checked the groups of users with the following command:
    groups user
    user : users wheel networkmanager vboxusers
    The user is in the vboxusers group

  4. I tried to call vboxconfig, but it is not available.

Request for assistance

At this point, I am seeking advice on how to address and resolve this issue. Any insights or solutions would be greatly appreciated.

2 Likes

I had a similar problem. The difference for me was that modprobe threw errors:

modprobe: FATAL: Module vboxdrv not found in directory /run/booted-system/kernel-modules/lib/modules/6.6.35

In my case. switching from grub to systemd-boot in my configuration.nix fixed the problem.

1 Like

Well, I have the same problem. I am using systemd-boot and have no modprobe errors.

Not sure if it fits with your use-case, but you could use VirtualBox with KVM. That way the kernel driver is not needed.

https://search.nixos.org/options?channel=24.05&show=virtualisation.virtualbox.host.enableKvm&from=0&size=50&sort=relevance&type=packages&query=virtualbox

Have you got virtualbox under environment.systemPackages as well as virtualisation.virtualbox.host.enable = true.
Removing from sysPckgs fixed it for me.