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.
- 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:
- For Debian http://deb.debian.org/debian/
- For Devuan http://deb.devuan.org/devuan/
<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
-
Invoke
apt-get update
to sync the new repository -
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
- 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)
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
- Install the expected package
invoke apt-get install nvidia-driver
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
https://discord.gg/w7ybpp (as of 14.06.2020 msg to Krey#3883)