Fix Blank Screen Nvidia Optimus Laptop Linux and Cuda

Image for post
Image for post


Image for post
Image for post
Find your card’s compute capability at or check using their website
Image for post
Image for post
Go to and check which cuda version supports base on Nvidia driver version.
Image for post
Image for post
Go to and check which cuda version supports base on compute capability. If it is 2.x Fermi or lower, you have to try Cuda 8 and lower if it still does not work.

Restore Default

sudo su
apt install aptitude
aptitude search nvidia
aptitude search cuda
aptitude search bumblebee
aptitude search primus
apt-get purge 'nvidia.*'
apt-get purge 'cuda.*'
apt-get purge 'bumblebee.*'
apt-get purge 'primus.*'
apt-get install 'nouveau.*'

Install Nvidia Video Driver

apt update
apt full-upgrade
lspci -v
apt install nvidia-kernel-dkms
apt install nvidia-smi

Fixing Blank Screen After Nvidia Driver Installation

apt show nvidia-kernel-dkms
aptitude search nvidia
apt install nvidia-legacy-390xx-kernel-dkms
apt install mesa-opencl-icd
apt install nvidia-opencl-icd
apt install bbswitch-dkms bumblebee-nvidia
nano /etc/bumblebee/bumblebee.conf
nano /etc/bumblebee/xorg.conf.nvidia
lspci -v

Install Cuda Toolkit

apt show nvidia-cuda-toolkit
apt install nvidia-cuda-toolkit
nvcc -V
type nvcc
ls /usr/lib/nvidia-cuda-toolkit
dpkg -i [your deb package].deb
apt-key add /var/cuda...../[...].pub (which will be shown on your terminal)
apt update && apt install cuda-toolkit-8-0
nvcc -V
apt install gcc-5 g++-5
sudo ln -s $(which gcc-5) /usr/local/bin/gcc
sudo ln -s $(which g++-5) /usr/local/bin/g++
hash -r
sudo rm /usr/local/bin/gcc /usr/local/bin/g++
hash -r
sudo chmod +x
sudo sh --override
Follow the command-line prompts
Do you accept the previously read EULA?
accept/decline/quit: accept
You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: yes
Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?
(y)es/(n)o/(q)uit: no
Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: yes
Enter Toolkit Location
[ default is /usr/local/cuda-8.0 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: yes
Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: yes
Enter CUDA Samples Location
[ default is /home/fajarpurnama ]: /usr/local/cuda-8.0/samples
Edit /etc/environment, edit and add the following lines:PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/local/cuda/bin"

this blog contains all my articles licensed under creative commons attribution customized sharealike (cc-by-sa) where you can sell but mention the open one here

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store