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" EndSection
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,
Now update the grub configuration
Now restart the laptop and check again if optirun is delaying to start apps. Check if the new configuration took effect or not.
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.
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
modprobe -r command not working, then try the
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
acpi_backlight=vendor kernel parameter to grub configuration, this may help.
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.
Everyone is highly encouraged to leave their valuable comment/suggestion, it might solve someone else's nvidia optimus related problem.