Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NixOps - VirtualBox - "kernel driver not accessible" #370

Closed
ghost opened this issue Dec 7, 2015 · 6 comments
Closed

NixOps - VirtualBox - "kernel driver not accessible" #370

ghost opened this issue Dec 7, 2015 · 6 comments

Comments

@ghost
Copy link

ghost commented Dec 7, 2015

When I start VirtualBox without Nixops, I can create and use virtual machines without any problems.
But when I try to deploy a vm with nixops (as a not-root-user), I get the error "kernel driver not accessible".

My configuration.nix looks like this:

...
virtualisation = {
    virtualbox = {
      host.enable = true;
    };
    libvirtd.enable = true;
  };
...
  users.extraUsers.markus = {
    isNormalUser = true;
    uid = 1000;
    description = "Markus Wotringer";
    extraGroups = [
      "users"
      "wheel"
      "disk"
      "networkManager"
      "audio"
      "video"
      "libvirtd"
      "kvm"
      "vboxusers"
    ];
  };
  users.extraGroups.vboxusers.members = ["markus"];

My machine.nix looks like this:

{
  network.description = "Jenkins Server";
  jenkins = {config, pkgs, ...}:
  {
    services.jenkins = {
      enable = true;
    }; 
    networking.firewall.allowedTCPPorts = [ config.services.jenkins.port ];
    deployment = {
      targetEnv = "virtualbox";
      virtualbox.memorySize = 1024;
    };
  };
}

I do the following shell commands:

nixops create machine.nix -d machine
nixops deploy -d machine # <- ERROR

The same commands as root yield no errors.

@aszlig
Copy link
Member

aszlig commented Dec 8, 2015

@Markwot: Can you please paste the exact error message you get from NixOps?

@ghost
Copy link
Author

ghost commented Dec 8, 2015

@aszlig: here a screenshot. There is nothing in journal -xe or dmesg.

bildschirmfoto - 08 12 2015 - 07 10 35

no problem doing so as root:
bildschirmfoto - 08 12 2015 - 07 16 29

@aszlig
Copy link
Member

aszlig commented Dec 8, 2015

@Markwot: What do you get by issuing type VBoxManage?

@ghost
Copy link
Author

ghost commented Dec 8, 2015

[markus@y510p:~]$ type VBoxManage
VBoxManage ist /home/markus/.nix-profile/bin/VBoxManage
[markus@y510p:~]$ sudo su
[root@y510p:/home/markus]# type VBoxManage
VBoxManage ist /run/current-system/sw/bin/VBoxManage

@aszlig
Copy link
Member

aszlig commented Dec 8, 2015

@Markwot: You need to remove VirtualBox from your user environment, because if you're running in hardened mode on your host, only the store paths referenced by the suid wrappers can have access to the kernel modules.

@ghost
Copy link
Author

ghost commented Dec 8, 2015

Yes, it is resolved!!11!
I had it installed in the user-environment, in the system-environment and also used virtualisation.virtualbox.host.enable, after removing all traces of VBox, rebuilding and afterwards just using the latter, it works.

Thank you very much @aszlig .

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant