NVIDIA Optimus troubleshooting in Debain, Kali Linux

Though bumblebee and NVIDIA Optimus drivers are stable enough now, still you may face some problem after successfully installing them in Debian.

This tutorial is an extension of the previous, configure NVIDIA optimus in Debian, Kali Linux , specially for troubleshooting purpose, this guide also applies on any Debian derivative like Kali Linux, LMDE, SolydXK and so on.

I never faced any major problem with recent non-free drivers, bumblebee packages and recent kernel, using a NVIDIA GEFORCE GT 540M card. Problems listed bellow are faced by some other guys, and they left comments on the previous tutorial. I really appreciate those comments.


1. optirun glxgears returns /dev/dri/card0 failed to set drm interface

Optirun may return errors sometime like this >  /dev/dri/card0 failed to set drm interface 1.4 permission denied . For this edit the /etc/bumblebee/xorg.conf.nvidia file, this is the X11 configuration file used by bumblebee. Add those extra configuration options there,

Section "Screen"
Identifier "Default Screen"
Device "DiscreteNvidia"

after this restart bumblebee and try again.

 sudo service bumblebeed restart 


2. Optirun taking longer time to access the NVIDIA graphics card

Optirun may take 6-10 seconds to initialize everything at first run, but next it should take 1.5 seconds to maximum 2 seconds to start an application using the discrete GPU. If you are facing the same delay like the first run, add the boot time kernel parameter bellow to the /etc/default/grub file just after the quiet word.


It should look like bellow,

GRUB_CMDLINE_LINUX_DEFAULT="quiet rcutree.rcu_idle_gp_delay=1"

Now update the grub configuration

 sudo update-grub 

Now restart the laptop and check again if optirun is delaying to start apps. Check if the new configuration took effect or not.

 cat /sys/module/rcutree/parameters/rcu_idle_gp_delay 

It should return 1 , this issue seems like to be fixed in recent Linux kernels.


3. modprobe failed to remove nouveau module

While running the command modprobe -r nouveau , the system may fail to remove the nouveau module, returning an error message like modprobe:FATAL:Module nouveau in use. For this, you need to tell the kernel that not to use nouveau for kernel mode setting(KMS). Read more about KMS here.

Easy workaround, first install bumblebee, it may take care of everything or may not.  Still if you are facing the same issue, add the kernel parameters, nouveau.modeset=0 and modprobe.blacklist=nouveau to /etc/default/grub , just like above, it should look like bellow,

GRUB_CMDLINE_LINUX_DEFAULT="quiet nouveau.modeset=0 modprobe.blacklist=nouveau bla bla bla" 

Wath out the bla bla bla, just example, update the grub configuration and reboot the system.

 sudo update-grub

Now reboot the laptop and  and  try to unload nouveau module again. If no luck still, delete/move the nouveau kernel module and reboot, stupid but this will definitely work.

sudo mv /lib/modules/4.2.0-16-generic/kernel/drivers/gpu/drm/nouveau/nouveau.ko /usr/src 

Note: If modprobe -r command not working, then try the rmmod command.


4. bbswitch failed to load and turn off discrete NVIDIA card

Sometimes  Make sure every nvidia related kernel modules like nouveau, nvidia, nvidia_uvm are unloaded and try to load bbswitch again.

sudo rmmod nvidia_uvm
sudo rmmod nvidia
sudo rmmod nouveau
sudo modprobe bbswitch load_state=0

Add the acpi_backlight=vendor kernel parameter to grub configuration, this may help.

 GRUB_CMDLINE_LINUX_DEFAULT="quiet acpi_backlight=vendor" 

Update the grub configuration with sudo update-grub and reboot and try again to insert the bbswitch module.


Those solutions/fixes listed above may or may not work, surely you will find some workaround by experimenting with different configurations.

Recommended readings

Everyone is highly encouraged to leave their valuable comment/suggestion, it might solve someone else’s nvidia optimus related problem.

Leave a Reply

Your email address will not be published. Required fields are marked *