Skip to content

Instantly share code, notes, and snippets.

@nilreml
Last active May 17, 2025 12:41
Show Gist options
  • Save nilreml/e62b95878e6d8e1bd2fbd5facb0f45ec to your computer and use it in GitHub Desktop.
Save nilreml/e62b95878e6d8e1bd2fbd5facb0f45ec to your computer and use it in GitHub Desktop.
apt_preferences
# Pin *all* Nvidia apt packages to a specific version (including drivers, cuda, nvidia-docker-toolkit, etc.)
# Place this at /etc/apt/preferences.d/60-nvidia and run `apt update`
# NOTE: apparently, version and release pinning cannot be combined in a single section
# NOTE: version pinning doesn't work with Package: * (use regex instead)
Package: nsight*
Pin: release l=*Debian*
Pin-Priority: -1
Package: * # NOTE: includes other architectures by default (tested on apt 2.6.1, Debian 12)
Pin: release l=/NVIDIA/
Pin-Priority: 600
Package: //:any # Include other architectures (e.g. i386 for Steam support, etc.)
#Package: /nvidia/ /cuda/ /nvcuvid/ /nvctrl/ /libnv/ # Doesn't include some Nvidia libs
#Pin: version /565/, release l=/NVIDIA/ # Doesn't work, see notes above
Pin: version /565\.57/ # Works only as long as this version isn't used by non-Nvidia packages
Pin-Priority: 1000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment