Alright man, NVidia is always annoying and on any linux distro you face installing an extra repository to keep NVidia updated but sometimes that repository simply does not work for your device. This happens alot with Maxwell- current generation optimus laptops a ton. Not all laptops are effected but some are.
This is the only fool proof old fashioned one shot method to installing that basically cannot go wrong. I have one such device that particularly likes this better on Fedora (my main distribution). That device is the ASUS ROG STRIX GL502VT-DS74. Not sure why but both the negativo (the best NVidia repository in existence) and RPMFusion () do not like this laptop very well.
So lets do this. This is a device agnostic guide however package naming will generally follow fedora named packages. This being said the build requirements should be similar on other distributions.
A good thing to identify head on is your GPU
Execute the following commands to find out:
lspci |grep -E "VGA|3D"
Here was my output:
[eayers@gjallarhorn ~]$ lspci |grep -E "VGA|3D"
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
01:00.0 3D controller: NVIDIA Corporation GM204M [GeForce GTX 970M] (rev a1)
[eayers@gjallarhorn ~]$
Before we move on, I suggest you disabled secure boot. If the system has an inability to do so then refer to NVidiaās section on how to sign the drivers using your distributions key. Refer to your distro specific information on how secure boot signing work. Fedora for example has beautiful documentation. For the purposes of example here are both NVidia docs and Fedoraās docs for reference.
http://download.nvidia.com/XFree86/Linux-x86_64/410.104/README/installdriver.html#modulesigning
Seriously RTFM. Secure boot is a good thing. I have used it to secure my own laptop and put a password on the EFI. If the password is reset so are the keys and despite full disk encryption as wellā¦ that means fedora will not be trusted to boot. I have also set that should keys get reset or SB disabled then Fedora will not boot anywaysā¦
Download and acquire the run files for Linux. If you use CUDA like I do then I have provided the link to acquire it as well. Make sure you are acquiring the run files.
https://www.nvidia.com/Download/Find.aspx?lang=en-us
https://developer.nvidia.com/cuda-downloads
Then make it executable
sudo -i
chmod +x (nvidia run files path)
Now for your system you will want to make sure you are up to date.
<package manager> update
For the rest of the installation the following packages will be needed for NVidia building and compiling. Each distro has their variant. Please install them per the directions of your distro. Often some distros will come with distro specific instructions
For RHEL/CENTOS/Fedora I would advise these packages
- kernel-devel
- kernel-headers
- gcc
- make
- dkms
- acpid
- libglvnd-glx
- libglvnd-opengl
- libglvnd-devel
- pkgconfig
For Debian you will need to add the non free repos. I will provide the debian sources However you will need to find the sources for Ubuntu and other debian based distributions.
#------------------------------------------------------------------------------#
# OFFICIAL DEBIAN REPOS
#------------------------------------------------------------------------------#
deb http://mirrors.syringanetworks.net/debian/ stable main contrib non-free
deb-src http://mirrors.syringanetworks.net/debian/ stable main contrib non-free
deb http://mirrors.syringanetworks.net/debian/ stable-updates main contrib non-free
deb-src http://mirrors.syringanetworks.net/debian/ stable-updates main contrib non-free
deb http://security.debian.org/ stable/updates main
deb-src http://security.debian.org/ stable/updates main
deb http://mirrors.syringanetworks.net/debian/ buster-backports main
deb-src http://mirrors.syringanetworks.net/debian/ buster-backports main
I would run the following commands on a debian based distro after getting the sources:
# Setup proper kernel Build Environments (Most people will need this in some form)
# Install microcode depending on your system architecture
sudo apt install build-essential cmake g++ dkms acpid lshw software-properties-common llvm clang firmware-linux firmware-linux amd64-microcode gcc-multilib
# Install kernel headers
sudo apt install linux-headers-$(uname -r)
# Build some dependencies
sudo apt build-dep linux
It is essential that even with optimus that you blacklist nouveau. It will cause issues if you do not.
echo "blacklist nouveau" >> /etc/modprobe.d/blacklist.conf
Now the next step is append rd.driver.blacklist=nouveau to the end of your grub file. This command may vary from distro to distro but this one is effective.
Add it to the end of
GRUB_CMDLINE_LINUX="****"
Now assuming you have a modern system update the grub2-efi.
grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
I remove the nouveau X11 driver just to be really sure though it maybe unnecessary for some.
dnf remove xorg-x11-drv-nouveau
Now some people have excluded package updates for xorg-x11* Do not do this if your going this route. I would update to the latest distro specific xorg-x11 drivers for your system first.
After doing so we need to backup and generate a new initramfs. This is how I do so on any RHEL/Novell based distro. These instructions though on Fedora should work for RHEL, CENTOS, OPENSUSE LEAP, SLES etc
mv /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r)-nouveau.img
dracut /boot/initramfs-$(uname -r).img $(uname -r)
Now here is where you need to make sure you have a phone or another computer to follow the rest of the guide. We are going to reboot into System Run Level 3 which is the command line only for the remainder of the steps. When you are ready:
systemctl set-default multi-user.target
Now reboot and login as your user and execute access to su again.
sudo -i
This is where you are going to run the NVidia binaries that you downloaded. Here is an example from my process.
[eayers@gjallarhorn ~]$./home/eayers/NVIDIA-Linux-x86_64-430.26.run
Let us walk through this installation. Answer YES to registering the module sources with DKMS if you do not want to have to redo this every time the kernel upgrades. If you want steam to work then answer YES to NVIDIAās 32 bit library installation. From here on out the installation should go without issue It will not ask you to backup XORG on any recent distro but if it does I suggest you say yes and if your installing CUDA and the installation above went well do the same for CUDA (instructions self explanatory)
If you do CUDA you must maintain the same driver specified by CUDA
[eayers@gjallarhorn ~]$ ./home/eayers/cuda_10.1.168_418.67_linux.run
Alright cool so that went well. Now reset your run level to level 5 aka the graphical interface by executing:
systemctl set-default graphical.target
and reboot. Now we want video acceleration support for VLC and other things so make sure you install these packages on your system.
- vdpauinfo
- libva-vdpau-driver
- libva-utils
That is basically it your all done. Questions an support will be done below.