Skip to content

Instantly share code, notes, and snippets.

@Kreyren
Last active July 25, 2024 02:43
Show Gist options
  • Save Kreyren/cccf642ce672fd8f127ed128cf27749b to your computer and use it in GitHub Desktop.
Save Kreyren/cccf642ce672fd8f127ed128cf27749b to your computer and use it in GitHub Desktop.
How to properly setup and install nvidia on Debian/Devuan

OUTDATED: The pinning no longer works.


DISCLAIMER: This is provided as is without any warranty with hope to provide helpful informations

WARNING: Provided as reference to the configuration, you should use your own deduction for a proper configuration, DO NOT COPY-PASTE!

This is a short tutorial to install nvidia drivers on Debian/Devuan by adding non-free repository and then pinning to exclude all non-free packages excluding the one needed for Nvidia GPU to avoid their unexpected install.

  1. Add non-free repository in /etc/apt/sources.list
# For amd64
deb [arch=amd64] <url-to-deb-repository> <release> main non-free

<url-to-deb-repository> is:

<release> is output of lsb_release -cs or your desired release

You may need a contrib sub-repository on devuan so that would be for example:

deb [arch=amd64] http://deb.devuan.org/devuan/ beowulf main contrib non-free
  1. Invoke apt-get update to sync the new repository

  2. Create a new pinning file in /etc/apt/preferences.d/zz-nvidia

# NOTICE(kreyren): There has to be a newline (or comment) separating each pin for apt to recognize it
# Reference: https://manpages.debian.org/stretch/apt/apt_preferences.5.en.html

# Prevent all non-free packages from being installed
Package: *
Pin: release c=non-free
Pin-Priority: -1

# Nvidia
## Allow only these nvidia packages required for GPU to be processed by apt
Package: nvidia-driver nvidia-driver-bin xserver-xorg-video-nvidia nvidia-vdpau-driver nvidia-alternative nvidia-kernel-dkms nvidia-legacy-check nvidia-driver-libs nvidia-driver-libs-nonglvnd
Pin: release c=non-free, n=beowulf
Pin-Priority: 990

Replace beowulf with your release.

You may also need to cherrypick the Package: entries based on your system and requirements

  1. Verify the pinning

Invoke apt-cache policy nvidia-driver and make sure the pinning is correct:

You are expecting 990 on the highlighted for your target release (debian/buster in my case)

image

Invoke apt-cache policy unwanted-non-free-package (steam-devices in the example)

You are expecting -1 in the highlighted for the unwanted packages for target release

image

  1. Install the expected package

invoke apt-get install nvidia-driver


Where to get help

IRC

You may need to be registered in freenode https://freenode.net/kb/answer/registration (use /join #freenode in the chat window if you need help with registration)

See also https://gist.github.com/Kreyren/31528ba27efac3c3759394417cb9c325 if you still struggling with freenode registration

For devuan: https://webchat.freenode.net/#devuan

For debian: https://webchat.freenode.net/#debian

Or https://webchat.freenode.net/ and invoking /msg kreyren your message here if i am online else /msg MemoServ kreyren send your message here

Discord

https://discord.gg/w7ybpp (as of 14.06.2020 msg to Krey#3883)

Email

[email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment