Skip to content

How to install NVidia drivers on BunsenLabs/Debian 8 to setup dual screens

Honestly, this post is mostly a personal memo. I will NOT go through this again!

The fun way¤

First, to save your time and mind, install the Linux headers!

sudo apt install linux-headers-$(uname -r)

I spent two painful hours this afternoon trying to figure out why it wouldn't work. It happens that I didn't install these headers!

Also install these requirements:

sudo apt install xserver-xorg xserver-xorg-core xserver-xorg-dev

Now, install the Nvidia Detect program. It will tell you where to get the driver from:

sudo apt install nvidia-detect

Run it:

$ nvidia-detect
Detected NVIDIA GPUs:
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation Device [10de:1402] (rev a1)
Your card is only supported by a newer driver that is available in jessie-backports.
See http://backports.debian.org for instructions how to use backports.
You may also find newer driver packages in experimental.
It is recommended to install the
    nvidia-driver/jessie-backports
package.

So, in my case, I have to install the driver from Jessie backports.

Beware!! It might not be your case! Pay attention to what nvidia-detect says, and do what it says :D!

So, for Jessie backports, you would install the driver like this:

sudo apt install -t jessie-backports nvidia-driver

But the driver is not the only thing you need to install. I'm gonna install the rest from Jessie backports as well, adapt to your needs!

sudo apt install -t jessie-backports nvidia-xconfig nvidia-settings xserver-xorg-video-nvidia

Reboot! At this point, it won't hurt your OS (it will actually help).

reboot

Rebooting...

Alright, you should now be able to run nvidia-xconfig without trouble:

sudo nvidia-xconfig

This command will create or update the file /etc/X11/xorg.conf.

You can now restart your X server and send me a not-positive comment below if nothing works and your system is broken.

sudo systemctl restart lightdm.service

Login, then finalize with:

sudo nvidia-settings

nvidia-settings

Set your screen(s) resolutions and everything, save the configuration into /etc/X11/xorg.conf, maybe reboot one last time, and you should be good to go!

The quick way¤

It's just a summary of the previous commands. Don't actually copy-paste-run it: have a break at the lonely nvidia-detect line.

sudo apt install linux-headers-$(uname -r)
sudo apt install xserver-xorg xserver-xorg-core xserver-xorg-dev
sudo apt install nvidia-detect

nvidia-detect  # update the apt commands after this

sudo apt install -t jessie-backports nvidia-driver
sudo apt install -t jessie-backports nvidia-xconfig nvidia-settings xserver-xorg-video-nvidia
# reboot
sudo nvidia-xconfig
sudo systemctl restart lightdm.service
sudo nvidia-settings  # update your config and save it
# reboot

~~If~~ When things go wrong¤

  • You should consider following another tutorial.
  • If the X server does not start, hit Ctrl-Alt-F1 to get a non-graphical terminal. From there, simply delete the bad /etc/X11/xorg.conf and run systemctl restart lightdm.service again to get back your beloved GUI.
  • If you installed the wrong things: it's pretty safe to purge all nvidia-* packages, but it is not safe to purge xserver-xorg-* ones. Except the specific xserver-xorg-video-nvidia. Or if you like the Linux (re)installation process.
  • After an update/upgrade: if you upgraded your system with apt update; apt upgrade and your X server does not start anymore, it might be because your Linux headers have not been updated. Remember to always update your Linux headers after the kernel has been upgraded! sudo apt install linux-headers-$(uname -r)

Appendix¤

Example of /etc/X11/xorg.conf for dual screen setup:

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 375.26  (buildd@debian)  Wed Jan 18 14:43:15 UTC 2017

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 340.46  (buildd@brahms)  Tue Oct  7 08:00:32 UTC 2014

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "InputDevice"

    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "HP LE2202x"
    HorizSync       24.0 - 94.0
    VertRefresh     50.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 950"
EndSection

Section "Screen"

# Removed Option "metamodes" "DVI-I-1: nvidia-auto-select +0+0, DVI-D-0: 640x480 +1920+0"
# Removed Option "metamodes" "DVI-I-1: nvidia-auto-select +0+0, DVI-D-0: 1440x900 +1920+128"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "DVI-I-1: nvidia-auto-select +0+0, DVI-D-0: 1440x900 +1920+90"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Comments