Skip to content

Instantly share code, notes, and snippets.

@HasnSobhy
Forked from gallg/nvidia_drivers_ubuntu.txt
Created October 10, 2022 00:27
Show Gist options
  • Select an option

  • Save HasnSobhy/04e9066f77a3896e1cedb08ec04dfe57 to your computer and use it in GitHub Desktop.

Select an option

Save HasnSobhy/04e9066f77a3896e1cedb08ec04dfe57 to your computer and use it in GitHub Desktop.
install nvidia drivers for optimus GPU (Ubuntu)
# Nvidia drivers for optimus GPU;
How to install Nvidia drivers and configure bumblebee on Ubuntu 16.04 with optimus GPU.
It doesn't work with Ubuntu 18+ (I recommend manual switch between GPU in this case).
Tested on Ubuntu 16.04 with Geforce GT 750m and Intel HD graphic
_______________________________________________________________________________________________________________
- Step 1: remove all video drivers;
sudo apt-get remove --purge nvidia* bumblebee* xserver-xorg-video-nouveau
- Step 2: be sure to have all the headers;
sudo apt-get install linux-source && sudo apt-get install linux-headers-$(uname -r)
- Step 3: blacklist "nouveau" and "nvidia-current"
in "/etc/modprobe.d/blacklist.conf" add the following lines at the end of the file:
blacklist nouveau
blacklist lbm-nouveau
blacklist nvidia-173
blacklist nvidia-96
blacklist nvidia-current
blacklist nvidia-173-updates
blacklist nvidia-96-updates
alias nvidia nvidia_current_updates
alias nouveau off
alias lbm-nouveau off
options nouveau modeset=0
- Step 4: run "update" and stop the X server;
sudo apt-get update && sudo apt-get dist-upgrade -y
sudo service lightdm stop
open tty1 console with "ctrl+alt+F1"
- Step 5: install nvidia drivers and Bumblebee
sudo apt-get install nvidia-384
check the driver for your gpu on the nvidia site. I installed "nvidia-384" for my Geforce GT 750m.
reboot with:
sudo reboot
install Bumblebee:
sudo add-apt-repository ppa:bumblebee/testing
sudo apt update
sudo apt install bumblebee
install primus:
sudo apt-get install primus
- Step 6: Change bumblebee configuration;
sudo nano /etc/bumblebee/bumblebee.conf
Change line 22 "Driver=" to "Driver=nvidia"
Change line 55 "KernelDriver=nvidia-384" # or whatever your current nvidia driver is
Change line 58 to "LibraryPath=/usr/lib/nvidia-384-updates:/usr/lib32/nvidia-381-updates" #or whatever your current nvidia driver is
Change line 61 to "XorgModulePath=/usr/lib/nvidia-384-updates/xorg,/usr/lib/xorg/modules" #or whatever your current nvidia driver is
Than check that your "BUSID" in /etc/bumblebee/xorg.conf.nvidia is uncommented (without "#" at the beginning of the line)
1) Check if nvidia prime is set on "intel mode". If it is in nvidia mode switch gpu;
2) If the prime icon says "Current graphics card: Unknown" after installing primus is because you need to update your system. In this case, select "Install Updates" clicking of the prime icon on the panel. If you get "Current graphics card: Unknown" without an update warning you should probably switch to a newer nvidia driver;
3) To run applications using your nvidia GPU use "optirun 'application'" or "primusrun 'application'".
# Screen tearing fix
Create a file named 20-intel.conf and put this inside:
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "TearFree" "true"
EndSection
Place the file in "/etc/X11/xorg.conf.d" with:
sudo cp -R 20-intel.conf /etc/X11/xorg.conf.d
and reboot.
Enjoy!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment