External monitors not working, Dell XPS


#1

Summary:

Specs

NixOS 18.09
Laptop: Dell XPS 9570, NVIDIA GeForce GTX 1050Ti.
configuration.nix is pretty basic.
Default plasma 5 desktop.

Issue

No monitors are detected or can be connected too.

Long form

I’m quite new to NixOS and to Linux in general, but I’ve spent the last week or so setting up my system, and while most things are working as expected, there are a few issues. Most importantly: I can’t seem to connect to any external monitors. I have tried both through the HDMI port on the laptop itself and through the DisplayPort and thunderbolt ports on an external dock.

I think I’ve seen a comment somewhere that suggests it might be related to the graphics card and that the nvidia card in the laptop has to be active for it to work (I’m assuming it’s not by default?), but every attempt I’ve made at this has resulted in either a flickering screen that somehow fails to load the Desktop Environment (the X server?) and thus drops me into the startup shell, or the machine freezing.

The nvidia card is listed as a 3D controller in the output of lspci.

Anyway, as I am quite new to this, I’m thinking there might be something obvious I’m missing and would love some help. I’ve been through all the documentation and discussions I’ve been able to find on this, including the NixOS wiki entry, but to no avail.

I’d be more than happy to provide any further information if it could be of any help.

Also, side question: I’ve seen the nvidia-smi command floating around, but haven’t been able to figure out how I get it. Nix isn’t recommending me any packages for it. Could anyone tell me what package I need for it?

Thanks a lot!


#2

What does xrandr --listproviders say? Does is say the same thing if you use Nouveau drivers? Do you need any specific Nvidia-binary-driver-only features (e.g. CUDA)?

(I had a superficially similar situation with my Thinkpad, I use Nouveau and xrandr --setprovideroutputsource 1 0 ; xrandr --setprovideroffloadsink 1 0, which might be applicable or not to your situation)


#3

xrandr --listproviders says Providers: number: 0. Setting services.xserver.videoDrivers = [ "nouveau" ] caused the screen to flicker on boot, not letting me into the desktop environment (stuck in tty 1-6). The flickering also makes any keyboard input unreliable as the focus seems to change between different places, meaning trying to log in is practically impossible.

As far as features go, I don’t need anything specific as far as I know. I don’t really play games on this machine (though it would be nice to have the option), and the only things I really use it for is software development and web browsing.

Setting the xrandr provider output source to 1 doesn’t work as it can’t find the provider with said index, which makes sense if it can’t discover the monitors.


#4

xrandr --listproviders says Providers: number: 0. Setting services.xserver.videoDrivers = [ "nouveau" ]

Maybe videoDrivers should be [“intel” “modesetting”]; I guess in this case you would not add the unfree nvidia driver package to the list of kernel module packages.

Although flickering sounds like trying and failing to initialise something, so probably my Nouveau suggestion doesn’t fit your card, sorry.

As far as features go, I don’t need anything specific as far as I know. I don’t really play games on this machine (though it would be nice to have the option),

Nouveau does provide some 3D acceleration, enough for me… Card support, GPU feature support and performance are likely to be somewhat lower. (X11 extension support might be higher for Nouveau).

(also, depending on your usage pattern it might be that your BIOS allows setting an internal-only mode for the card and it might work well enough, at least as an intermediate solution)

Setting the xrandr provider output source to 1 doesn’t work as it can’t find the provider with said index, which makes sense if it can’t discover the monitors.

No, that’s about not being able to discover video cards with driver support for this interface. Doesn’t make a difference in your situation, of course.


#5

Maybe you could try the suggestions in https://wiki.archlinux.org/index.php/Dell_XPS_15_9570#Graphics


#6

Hmm, whenever I try to set videoDrivers in xserver, it invariably seems to mess things up. Most of the time now it keeps switching between a tty asking me to log in and a bunch of systemd messages strewn across the screen. Don’t know what that means, but I’m pretty sure it’s not the desired outcome, hah.

I thought because it was switching between two views that it might be the different cards ‘battling it out’, but I get the same switching even if I only put "intel", so that seems unlikely.

Ah, okay, thanks. Just in case it wasn’t clear, the nvidia card shows up as a 3D controller in lspci results, so it’s definitely there. Also, I’m not sure whether that is the cause or not, but it’s the only thing I’ve got to go off at the moment.

So if there’s something else I might be missing to make external monitors work (some other utility perhaps?), that might be the cause if this is a common thing (though it doesn’t seem like it).

Thanks, though I’ve already gone through them. The blacklisting bit made my system boot with bumblebee and made it slightly less prone to breakage whenever I’d try and touch anything related to the video drivers. I tried whatever else I could find on there now, but to no avail, I’m afraid.


#7

Update/solution

So I seem to have fixed the issues I was having. The big one seems to have been that sent nomodeset as a kernel parameter on boot. After removing this, I suddenly got much more sensible output from xrandr and was able to use ["nvidia" "intel"] as my xserver.videoDrivers argument.

Once I connected to my dock (I was tweaking these parameters on the go) the displays lit up and everything pretty much just worked. However, there was a terrible performance hit causing multi-second input lag at first. Turning off all but a single monitor mitigated it, but adding back the following bit to my config seems to have fixed it:

      extraModprobeConfig = ''
        options bbswitch load_state=-1 unload_state=1 nvidia-drm
      '';

Other resources

Might also be worth noting that I stole this bit from the Arch wiki

      blacklistedKernelModules = [
        "nouveau"
        "rivafb"
        "nvidiafb"
        "rivatv"
        "nv"
        "uvcvideo"
      ];

and that I’ve got this bit listed as well:

      extraModulePackages = [ config.boot.kernelPackages.nvidia_x11 ];

NixOS Nvidia

This section on Nvidia may be slightly out of date, as the pkgs.linuxPackages.nvidia_x11.lib32 listed in the ‘official’ solution doesn’t appear to exist anymore.

The end?

Anyway, I’ll try and write down all I’ve gone through to make this work for now. Hopefully it has been resolved and I won’t have to come back for more help on this particular subject. Thanks again for all the help I’ve gotten!