NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
17.36k stars 13.59k forks source link

NVIDIA freezes if xserver is not running #81359

Open GuillaumeDesforges opened 4 years ago

GuillaumeDesforges commented 4 years ago

Describe the bug I am trying to setup a server with a GPU for my computations. I am using this server remotely.

If I install nvidia using the settings

nixpkgs.config.allowUnfree = true;
services.xserver.videoDrivers = [ "nvidia" ];

And then run

nvidia-smi

I get a proper output but then the console freezes. I can open a new ssh connection so it does seem like the server crashes though.

If I setup with xserver enabled like this:

nixpkgs.config.allowUnfree = true;
services.xserver.enable = true;
services.xserver.layout = "fr";
services.xserver.xkbOptions = "eurosign:e";
services.xserver.videoDrivers = [ "nvidia" ];

then everything works fine, nothing hangs and I can use other GPU related processes like PyTorch.

To Reproduce Steps to reproduce the behavior:

  1. On unstable channel
  2. Set the /etc/nixos/configuration.nix as described above.

Expected behavior nvidia-smi and other GPU related processes should not hang.

Metadata

$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 5.4.22, NixOS, 20.09pre215024.e97dfe73bba (Nightingale)`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.3.3`
 - channels(root): `"nixos-20.09pre215024.e97dfe73bba"`
 - channels(arsleust): `""`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos`

Maintainer information:

# a list of nixpkgs attributes affected by the problem
attribute:
# a list of nixos modules affected by the problem
module:
kolbycrouch commented 4 years ago

Maybe this has something to do with hardware.opengl.enable. It's automatically set to true when you declare services.xserver.enable = true AFAIK.

GuillaumeDesforges commented 4 years ago

Would it help if I tried rebuilding NixOS with:

services.xserver.enable = false;
hardware.opengl.enable = true

?

kolbycrouch commented 4 years ago

@GuillaumeDesforges Try it, I don't think it could hurt.

I'm not very familiar with all of this, but the docs for hardware.opengl.enable say that it's needed for 3d acceleration and is automatically turn on as a dependency of certain modules ( x11 & wayland WM's ). I'm assuming that it's set as "false" in your case since your not using x11.

GuillaumeDesforges commented 4 years ago

This did not fix the issue.

stale[bot] commented 4 years ago

Hello, I'm a bot and I thank you in the name of the community for opening this issue.

To help our human contributors focus on the most-relevant reports, I check up on old issues to see if they're still relevant. This issue has had no activity for 180 days, and so I marked it as stale, but you can rest assured it will never be closed by a non-human.

The community would appreciate your effort in checking if the issue is still valid. If it isn't, please close it.

If the issue persists, and you'd like to remove the stale label, you simply need to leave a comment. Your comment can be as simple as "still important to me". If you'd like it to get more attention, you can ask for help by searching for maintainers and people that previously touched related code and @ mention them in a comment. You can use Git blame or GitHub's web interface on the relevant files to find them.

Lastly, you can always ask for help at our Discourse Forum or at #nixos' IRC channel.