This tutorial is outdated, not guaranteed to work.
NVIDIA Optimus, the switchable graphics adaptation for laptops/notebooks by NVIDIA, still doesn't fit well with Linux.
That's why most Linux users having a laptop with optimus GPU faces problems like hot GPU(around 65° C), decreased battery life, roaring cooler fan etc. etc.So if you are one of those lucky person with a optimus laptop and want to use your discrete GPU rather than turn off it totally, this tutorial is for you. This guide is specially for Debian and other directly Debian based distro like Kali Linux, LMDE etc.
Here we are going to do this with bumblebee, bbswitch, and non-free debian nvidia optimus drivers.
For newbies, if you don't know what are these things, you may have a look at the bumblebee project . Bbswitch is the kernel module used to turn off and on the discrete nvidia GPU and non-free nvidia optimus linux drivers are the proprietary GPU drivers provided by nvidia.
Advantage of bumblebee over other solutions like nvidia prime is you can run one/many specific application using the discrete nvidia GPU without restarting the current X-session on the fly.
Contents
Analyze the system
First step is to know the system thoroughly, first check nvidia card.
lspci -v | egrep -i 'vga|3d|nvidia' | grep -i 'nvidia'
This should return something like bellow, which will give you a brief information about your nvidia GPU, some recent GPU shows them as 3D controllers.
01:00.0 VGA compatible controller: NVIDIA Corporation GF108M [GeForce GT 540M] (rev ff) (prog-if ff)
Now check the currently loaded nouveau (free nvidia driver) module and vga_switcheroo module,
lsmod | grep -i 'nouveau'
lsmod | grep -i 'vga_switcheroo'
Currently Debian loads them automatically if any discrete GPU is found.
Unload nouveau modules and install bbswitch
If your kernel is loaded with the nouveau and other related modules, its the time to unload them with the modprobe
command.
sudo modprobe -r nouveau sudo modprobe -r vga_switcheroo
Lets install bbswitch and related components to compile it. Installing bbswitch with dkms will automatically compile proper kernel module after any future kernel update.
At this point, you must enable the main, contrib and non-free repository, to do so, put the line bellow in the /etc/apt/sources.list file
deb http://ftp.debian.org/debian/ stretch main contrib non-free
Change the word stretch according to your disto, like if you are using the Debian stable jessie, replace it with jessie . If you are not sure what I'm talking about, have a look at there and check out the sources.list portion.
sudo apt-get update
sudo apt-get install gcc make linux-headers-amd64
sudo apt-get install dkms bbswitch-dkms
This will take some time to download and install the packages and compile kernel modules. when the installation is complete, load the bbswitch module.
sudo modprobe bbswitch load_state=0
Testing: Now test the if the bbswitch is working properly or not.
cat /proc/acpi/bbswitch
This should return a line with the word OFF along with the PCI bus id the nvidia GPU, the PCI bus id could vary machine by machine.
Another way to check it run the command lspci -v | grep -i 'vga' | grep -i 'nvidia'
(mentioned above, watch out the fancy quotes) and check the end of the result line, if the prog-if value is ff then the GPU is off, if the value is 00 then the GPU is on.
Blacklist the nouveau module
To avoid auto load of nouveau and related modules after every reboot, they should be blacklisted. Just create a file with your favorite text editor named nouveau-blacklist.conf under the /etc/modprobe.d/
folder and put this line blacklist nouveau inside it. It could also be done with a single line command.
su -c 'echo "blacklist nouveau" >> /etc/modprobe.d/nouveau-blacklist.conf'
Just enter the root password and you are done.
The bbswitch module is loaded automatically at every power up and turns off the discrete nvidia optimus GPU, no need to load it manually.
Install nvidia non-free drivers and bumblebee
Now we have to install the non-free nvidia drivers, bumblebee and some related extra packages.
sudo apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
sudo apt-get install nvidia-vdpau-driver vdpau-va-driver mesa-utils
This will install non-free nvidia drivers, nvidia kernel driver, nvidia specific OpenGL library etc. and other dependencies. Now install bumblebee,
sudo apt-get install bumblebee-nvidia
Wait some time to let the installation process finish.
Install VirtualGL
VirtualGL is required for the the optirun command as a bridge, but unfortunately Debian repository do not have the VirtualGL package, so we have to download it. Go to VirtualGL sourceforge repository and download the suitable package for your system. i.e. if you are using Debian 64 bit, download the latest amd64 package. Now install it with dpkg.
sudo dpkg -i ~/Downloads/virtualgl_2.4.1_amd64.deb
Also don't forget to change the path according to where you download the file.
Configure nvidia optimus with bumblebee
Fortunately bumblebee works fine with it's default configuration. But if you want to make any change to the settings, edit the /etc/bumblebee/bumblebee.conf
file as root with your favorite text editor and restart the bumblebee service with this command sudo service bumblebeed restart
.
Accessing the discrete nvidia GPU needs root privilege, so have to add your system's username to the bumblebee group.
sudo usermod -aG bumblebee $USER
Now restart the bumblebee daemon with sudo service bumblebeed restart
. Now you are done, reboot the system.
Optional: You may need to add some extra configuration to the xorg.conf.nvidia
file to avoid mouse module related error.
Open the /etc/bumblebee/xorg.conf.nvidia
file with your favorite text editor as root , then add the extra configuration there.
Section "Screen" Identifier "Default Screen" Device "DiscreteNvidia" EndSection
Save the file and exit the text editor, and restart bumblebee daemon.
Testing switchable graphics capability
After rebooting the system, you're ready to test the sample glxgears program.
optirun -vv glxgears
There should be some delay (around 3-4 sec.) before starting glxgears, if it returns around or over 1000 FPS performance, that means NVIDIA optimus is working properly.
This step is almost identical to check nvidia driver on ubuntu.
For more information about optirun command, see the man page, man optirun
,and run optirun with different arguments, like
optirun -v -b virtualgl -c jpeg glxgears
A more detailed testing and benchmarking the NVIDIA GPU could be done with furmark , which returns more accurate result than this simple glxgears test.
Troubleshooting
I didn't faced any problem during installation and testing with Debian stretch, kernel 4.1.0-amd64, nvidia-340.67 driver.
Just don't forget to add the apt non-free repository, install VirtualGL and add your user name to the bumblebee group.
Sometimes you might need to add some different GRUB parameters to block the automatic loading of nouveau driver. More on the link below.
UPDATE: As some readers are facing problems with debian nvidia optimus , I'hv written another tutorial specially for troubleshooting, based on reader feedback. I hope this will be helpful, here is the tutorial > NVIDIA Optimus troubleshooting in Debain .
Best practice: If your laptop's BIOS or UEFI allow to completely disable discrete nvidia GPU, then disable it before installing the OS and re-enable it after the installation is finished. By doing this, you could avoid some troubles caused by the vga_switcheroo kernel module. ( I did this many time 🙂 )
Conclusion
So, that's it, how to setup nvidia optimus debian, this tutorial also useful for any Debian derivative like Kali Linux, or SolydXK.
Use your nvidia GPU for something useful, like GPU computing with CUDA, NVIDIA OpenCL, fast password cracking with pyrit and many other computing extensive applications.
If you faced any problem during the installation, just leave a comment, and don't forget to share it with your friends.
Jason Yo says
Hello, I've followed these steps and getting stuck when trying to
~$ sudo apt install nvidia-kernel-dkms
Package nvidia-kernel-dkms is not available, but referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source.
I'm running Debian Bullseye.
uname -r
5.4.0-2-686-pae
My sources.list has bullseye main non-free contrib
I've read the linked Troubleshooting article as well as been searching and reading countless sites and forum posts.
https://www.pcsuggest.com/nvidia-optimus-troubleshooting-in-debain-kali-linux-ubuntu/
Do I need to add a PPA or is there a site to download this package?
Any assistance would be incredible! 🙂 Thank you
Arnab Satapathi says
Hi Jason, this tutorial is outdated, I don't even have a NVIDIA optimus laptop anymore.
But this package is still in the Debian repository.
May be you need to enable non-free repository, if not enabled already.
Peter bronsveld says
still working perfect happy with debian buster
Rhagho says
Hi! Followed the tutorial, and everything is working fine.
But, as info, I must say that I've encountered some issues as:
1- When trying to run command `lsmod | grep -i 'vga_switcheroo'`, this doesn't return anything.
2- When trying to run command `optirun -vv glxgears` I had errors like some that were posted here before (GPU driver not found, etc), and I fixed it with this `You must edit /etc/bumblebee/bumblebee.conf using your preferred editor as root, and change "KernelDriver=nvidia" to "KernelDriver=nvidia-current", then restart the bumblebee daemon, i.e.
sudo service bumblebeed restart `, found in this https://wiki.debian.org/Bumblebee#Reporting_bugs.2Fproblems page.
3- When running satisfactory the command `optirun -vv glxgears`, this shows me an average of 770 FPS. Is this normal? I have a Nvidia 940MX, maybe is a little lower due to it's age, right?
Anyway, good tutorial, and cheers!
Max says
This is doesn't work for me. Laptop: Dell XPS 15 9560, OS: Debian buster....
After all this steps i was unable to load X11... The solution was to add to the kernel parameters (when system is starting --> in Grub menu push 'e' --- and add) after 'quiet' ---acpi_rev_override=1. Then i tried everything (and troubleshoot article [NVIDIA Optimus troubleshooting in Debain]), but the result is 🙁
That's why i uninstalled all the bumblebee-nvidia....
Adam says
Yes this solution is works, but how to turn nvidia drivers to all X.org?
Glxgears show good value FPS but i need to use HDMI to connect monitor.
Arnab Satapathi says
That could be achieved with Synergy, try these links.
https://www.linuxquestions.org/questions/linux-desktop-74/multiple-x-servers-multiple-graphics-adapters-single-seat-kind-of-tutorial-864646/
https://wiki.gentoo.org/wiki/NVIDIA_Optimus_and_HDMI_Output_Configuration#Get_HDMI_to_work_with_laptops_using_the_Optimus_technology_under_Gentoo_using_Bumblebee_and_Synergy
Anunnaki says
Hello, why Im getting this error when I try check optirun ? I can check after run command "service bumblebee restart". But after reboot laptop I have to run that command again. What I'm doing wrong ?
optirun -vv glxgears
[ 49.452439] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ 49.452866] [ERROR]The Bumblebee daemon has not been started yet or the socket path /var/run/bumblebee.socket was incorrect.
[ 49.452872] [DEBUG]Socket closed.
[ 49.452882] [ERROR]Could not connect to bumblebee daemon - is it running?
Philip Vissenaekens says
Thank you, this guide works perfectly on Sparky rolling (Debian testing)!
Matin says
You are awesome!!
works fine even with virtualgl 2.6 in debian stretch & nvidia 1050
Thanks
Flow says
You are probably aware of little mistake in article name and hyperlink: Debain
Thanks for the tutorial!
Arnab Satapathi says
Unfortunately I'm not, would be helpful if you point out.
Alex says
lspci -v | egrep -i 'vga|3d|nvidia' | grep -i 'nvidia'
01:00.0 VGA compatible controller: NVIDIA Corporation GK107M [GeForce GT 755M] (rev a1) (prog-if 00 [VGA controller])
01:00.1 Audio device: NVIDIA Corporation GK107 HDMI Audio Controller (rev a1)
07:00.0 3D controller: NVIDIA Corporation GK107M [GeForce GT 755M] (rev a1)
:~# lsmod | grep nouveau
nouveau 2007040 7
ttm 131072 1 nouveau
drm_kms_helper 192512 1 nouveau
mxm_wmi 16384 1 nouveau
drm 462848 10 drm_kms_helper,ttm,nouveau
i2c_algo_bit 16384 1 nouveau
wmi 28672 3 ideapad_laptop,mxm_wmi,nouveau
video 45056 2 ideapad_laptop,nouveau
button 16384 1 nouveau
:~# sudo modprobe -r nouveau
modprobe: FATAL: Module nouveau is in use.
What do i do?
Arnab Satapathi says
You need to prevent loading nouveau during boot.
There's many way, one of them here.
https://www.pcsuggest.com/nvidia-optimus-troubleshooting-in-debain-kali-linux-ubuntu/#3_modprobe_failed_to_remove_nouveau_module
Rob Popovich says
I have an Asus EeePC 1215N that uses the Nvidia GT218 Ion GPU with Optimus. I have no problem until I get to the driver install when it attempts to install version 384.130-1 which doesn't support my card. According to the Debian site I need to install version 340.107-2 however downloading and installing the .deb package I get an error: "Dependency is not satisfiable". I've also downloaded all the packages which it says are required but no matter which sequence I try to install them I get the same error. I'm running MX 17.1 64bit which has an Nvidia driver installer but it too tries to install a later version driver that doesn't support my card. The website field shows the source of my information. At present I'm using the nouveau driver and wouldn't mind being able to switch back and forth with the Intel GPU. I don't know if I go and install Bumblebee from the repository whether or not that would help me. What do you think?
Arnab Satapathi says
So, if the driver package is complete, I mean it contains everything needed to properly run the NVIDIA GPU,
then you could unpack the deb file with
dpkg-deb --raw-extract
and edit the DEBIAN/control file to remove the dependencies.Then repack and install it.
Well, this is not very clear, but I hope you've got the idea.
Cuy says
Thanks Very Much! Works fine on MSI GT70-2PC nvidia 870m, around 3000 FPS.
Joe says
Thank you Arnab, after about 3 days of trying different guides and learning more about Optimus laptops, I stumbled across your guide. I have a MSI GS63VR with an nvidia 1060 in it. This guide worked great with Kali 2018! And now I can still use the nvidia card for hash cracking when I need it. Thanks again.
Mith says
Hi, I follow your howto on my Asus UX303UB, thanks for your help.
I'm on Debian Stretch, I launch 'optirun -b primus vlc' but this doesn't open the vlc interface and said:
' qt interface error: Xlib not initialized for threads
../include/vlc_xlib.h:46:vlc_xlib_init: Xlib not initialized for threads.
This process is probably using LibVLC incorrectly.
Pass "--no-xlib" to libvlc_new() to fix this.'
I should have to launch: 'optirun -b primus vlc /path/to/file.avi' so it works, but without graphic commands
Have I to use 'optirun vlc': this command works, but I don't know if it's the same? Or have I to do something different?
Thanks in advance!
Arnab Satapathi says
I don't think VLC can use nvidia optimus cards to decode videos with VDPAU.
At least it never worked for me.
Mith says
ok thanks
MANGA says
Thank you a lot man, if I ever see you in life I'll buy you a drink!
Out of 10 this is the only tutorial up to date that is working
Kali 2018 on i7 3rd gen. nvidia gt630m
Toni Tello says
Hola Arnab ... Very good tutorial, thanks. I managed to run the nvidia geforce 940M on an Asus laptop, i7 4 generation and on a laptop Slimbook _Excalibur the nvidia gefforce 940MX, i7 of 7 generation; both with Debian 9 64b, intel + nvidia graphics
Greetings and goodluck
Arnab Satapathi says
Glad to know!
Diosos says
Hi, I get the following bug reports when I try to install the nvidia drivers:
grave bugs of nvidia-driver (→ 390.48-3)
b1 - #902375 - xserver-xorg-video-abi: versions 6-23 missing from all repos
serious bugs of libdrm-radeon1:i386 (→ 2.4.92-1)
b2 - #892812 - [libdrm-radeon1] Periodic UI freezes
serious bugs of nvidia-driver (→ 390.48-3)
b3 - #901919 - nvidia-driver: black screen with the latest Linux kernel - general protection fault (Fixed: nvidia-graphics-drivers/390.67-2)
Is it still safe to proceed?
Arnab Satapathi says
I think it's absolutely safe as long as you can fix what you've broken.
Mark taylor says
I truly appreciste you taking the time to write this guide! However, I couldn't even get past installing the appropriate packages. It refuses to install nvidia-kernel-dkms , amongst the others, and states that a ton of libglxxxxx packages break , or conflict, with what were trying to install.
I've spent weeks trying to get my 1050m working and unfortunately no set of instructions or troubleshooting has worked. 🙁
Guess wete forever stuck with poor battery life and no dedicated gpu!
Arnab Satapathi says
First, this tutorial is not updated over a year.
Second, NVIDIA 1050M is too new hardware, probably it's optimus capability not tested by many, even the Debian package maintainers.
And thanks for the valuable feedback.
Jakub says
Hey, did you work out your problem, I'm about to give up after a week of repairing every night...
sean says
Hi, I followed your instructions above and I am still getting an error when trying to run glxgears. Here is the console output:
# optirun -vv glxgears
[ 496.535298] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ 496.536246] [DEBUG]optirun version 3.2.1 starting...
[ 496.536274] [DEBUG]Active configuration:
[ 496.536282] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf
[ 496.536291] [DEBUG] X display: :8
[ 496.536298] [DEBUG] LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu/nvidia:/usr/lib/i386-linux-gnu/nvidia:/usr/lib/nvidia
[ 496.536306] [DEBUG] Socket path: /var/run/bumblebee.socket
[ 496.536313] [DEBUG] Accel/display bridge: auto
[ 496.536320] [DEBUG] VGL Compression: proxy
[ 496.536330] [DEBUG] VGLrun extra options:
[ 496.536344] [DEBUG] Primus LD Path: /usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus:/usr/lib/primus:/usr/lib32/primus
[ 496.536419] [DEBUG]Using auto-detected bridge virtualgl
[ 497.322151] [INFO]Response: No - error: [XORG] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA GPU at PCI:2:0:0. Please
[ 497.322166] [ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(GPU-0): Failed to initialize the NVIDIA GPU at PCI:2:0:0. Please
[ 497.322168] [DEBUG]Socket closed.
[ 497.322197] [ERROR]Aborting because fallback start is disabled.
[ 497.322203] [DEBUG]Killing all remaining processes.
Arnab Satapathi says
Even after configuraung everything properly, still it may not work due to Kernel version and NVIDIA driver version incompatibility.
It's hard to tell which one is causing the incompatibility.
The only viable way to solve this is through trial and error, upgrade the kernel and the driver, that might help.
tanujdey says
12854 frames in 5.0 seconds = 2570.675 FPS
12968 frames in 5.0 seconds = 2593.552 FPS
I am not getting 1000FPS as You said.
Arnab Satapathi says
I said over 1000 FPS.
Fabrizzio says
Sir, i do the steps and i getting 60 fps.
300 frames in 5.0 seconds = 59.973 FPS
nef3sh@IP520:~$ optirun glxgears -info
GL_RENDERER = GeForce 940MX/PCIe/SSE2
GL_VERSION = 4.5.0 NVIDIA 375.82
GL_VENDOR = NVIDIA Corporation
Fresh Debian 9 Stretch Lenovo Ideapad 520.
This is for the videocard model or is a issuee on my driver installation?
Arnab Satapathi says
May be glxgears is not working properly, try
vblank_mode=0 optirun glxgears
.It doesn't matter as long as other applications like games, Pyrit can detect and use the NVIDIA card.
Philippe F says
Arnab Satapathi,
I would like to thank you a lot for this great tutorial and to ask you some quick questions:
1- It is my understanding that, on Windows, NVIDIA drivers automatically takes care of enabling or disabling the discrete GPU when needed, right? On Linux still there's no way of doing that automatically?
2- Debian has an article related to Bumblebee installation: https://wiki.debian.org/Bumblebee. Do we get the same result of your tutorial by following those steps (roughly doing "apt-get install bumblebee-nvidia primus")?
3- I have a 4k Dell Inspiron 7573 (NVIDIA GeForce 940MX) and I would like to take full advantage of all the hardware that it brings, specially the 4k display. Do you think I can get the best out of the GPU/display with Linux NVIDIA drivers or maybe it would be a better idea to run Windows?
4- Do you know any way of getting the HDMI output to work (as it is "managed" by the GPU)?
As a Debian user (for almost 10 year now) I would like to avoid going to Windows. So your answers will help me a lot!
I would like to thank you again for sharing your experience and knowledge with us!
Arnab Satapathi says
1. Yes, on Windows optimus switching is quite automatic. However on Linux, there's an application, prime indicator. https://github.com/andrebrait/prime-indicator
2. That's also yes, that article basically suggests to use Primus as optimus bridge. When I wrote this tutorial, primus was not very effective, so used VirtualGL.
3. You could use the nvidia GPU as effectively as on Windows for certain tasks as CUDA computing or AI training. However I'm not much hopeful about possibility of video output from the HDMI port, using the nvidia GPU to drive a 4K monitor.
4 . Basically I've no idea about the fourth point. Tried and failed. If you're able to figured it out, then please leave some feedback.
Also thanks for such a motivating comment.
Ricky Neff says
I have a problem, I guess I need to add myself to the group as well.
I will try that.
But I want to post this and see if you can suggest a fix to the public in the guide.
diveyez@alienware:~$ optirun
[ 327.123121] [ERROR]You've no permission to communicate with the Bumblebee daemon. Try adding yourself to the 'bumblebee' group
[ 327.123147] [ERROR]Could not connect to bumblebee daemon - is it running?
Arnab Satapathi says
This tutorial needs an update.
Ricky Neff says
Indeed
Ricky Neff says
If you update it, see my comment on the above threads about how to launch games.
Library>Game Properties> Launch Options> primusrun %command%
** WITH STEAM **
Arnab Satapathi says
Thanks!
Julian Arango says
GPU info not returned by command
lspci -v | egrep -i 'vga|3d|nvidia' | grep -i 'nvidia
'I faced a problem with a MSI GL62M 7REX laptop, the laptop have a Nvidia GTX 1050ti and the command return a 'generic' nvidia card in debian 8 and ubuntu 16.4, only in kali 2 the comand return the gpu info (with the version of the card 1050ti) the process only works in kali, but I have to blacklist nouveau before begin with the guide.
Thanks a lot, that was a helpfull guide.
Arnab Satapathi says
What's the generic name of the Nvidia GPU?
Anon says
Hi, I'm just getting start with Linux (Debian). I could follow all of the instructions without an error but when I try the "optirun -vv glxgears" command I receive an error:
[ 7378.346019] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ 7378.346718] [DEBUG]optirun version 3.2.1 starting...
[ 7378.346742] [DEBUG]Active configuration:
[ 7378.346750] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf
[ 7378.346757] [DEBUG] X display: :8
[ 7378.346763] [DEBUG] LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu/nvidia:/usr/lib/i386-linux-gnu/nvidia:/usr/lib/nvidia
[ 7378.346770] [DEBUG] Socket path: /var/run/bumblebee.socket
[ 7378.346777] [DEBUG] Accel/display bridge: auto
[ 7378.346786] [DEBUG] VGL Compression: proxy
[ 7378.346798] [DEBUG] VGLrun extra options:
[ 7378.346808] [DEBUG] Primus LD Path: /usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus:/usr/lib/primus:/usr/lib32/primus
[ 7378.346857] [DEBUG]Using auto-detected bridge virtualgl
[ 7378.347206] [INFO]Response: No - error: Could not enable discrete graphics card
[ 7378.347234] [ERROR]Cannot access secondary GPU - error: Could not enable discrete graphics card
[ 7378.347242] [DEBUG]Socket closed.
[ 7378.347272] [ERROR]Aborting because fallback start is disabled.
[ 7378.347288] [DEBUG]Killing all remaining processes.
This is a fresh install of Debian Stretch on Gigabyte Aero 15 with Nvidia GeForce GTX 1060.
Thank you!
Arnab Satapathi says
Can you manually turn on and off the GPU using the command
echo 'ON' > /proc/acpi/bbswitch
, of course as root.If yes then may be 32 bit shared libraries are messing around, have a look there, https://bbs.archlinux.org/viewtopic.php?id=218757
Though it's for Archlinux, yet helpful.
Most of the newer generation nvidia GPUs are not well supported on Linux or Bumblebee.
qdqw says
Hey, i did everything like you wrote, and it works on MSI GS60 2PL, using GTX 850M on Debian Sid. Only problem though is that it's not recognised by hashcat whether i use `optimus` before the command to benchmark or not its not detect (my cpu either).
Did i install it correctly and the issue is with hashcat or i did something wrong ? My Power led is blue when GPU is off and get orange (ON) when i run optirun with anything, but goes orange with hashcat for like one second and then go back to blue. Any advices appreciated thanks
Arnab Satapathi says
Didn't worked on my system either, checked few months ago, with the hashcat version 4.0.1.
I think it's not optimized for optimus GPUs.
Julian Arango says
*I had the same issue after complete the guide, that happen to me
The command
lspci -v | egrep -i 'vga|3d|nvidia' | grep -i 'nvidia'
not return the correct version of my gpu, i mean when i did it return a generic gpu and not the true version of the card.
I have a msi too (MSI GL62M 7REX) with a nvidia 1050ti and debian doesn't work for me, either ubuntu, but i did it in kali 2, i blacklist nouveau before beginin with the guide and everithing works fine.
Let me know if it works for you too
Linux O'Beardly says
Just a weird observation. I have a Dell XPS 15 (9560, 2017, Nvidia 1050GTX Mobile, Quad-Core I7 7thGen, 16GB RAM, Devuan Linux [Jessie]) and after installing the drivers using this method, when I run Steam, it tells me I'm using a VMWare video driver. When I run glxgears, I'm getting ~1600FPS, but if I try to run it via optirun, it tells me the GPU driver could not be loaded. Does this make sense to anyone? I'm trying to get my laptop to the point I can run Steam and use my HDMI to drive an external monitor. Steam may already be using the discrete GPU, but I have no idea how to verify this as it thinks it's using a VMWare driver. Is this how bumblebee tricks it into using the discrete vs primary video cards? Also, any idea why it won't drive my HDMI? If not, no worries, I'll keep looking, but I would appreciate any input. Thanks for the great write-up.
Arnab Satapathi says
1. Never installed Steam, even I don't know it's actual purpose.
2. I think the HDMI output is managed by the Intel graphics, nvidia GPU's HDMI output may not be connected to the HDMI port at all.
I was trying to do the same thing around Nov-2017, checked with two optimus laptops, both of them didn't worked.
It's great to know someone is actually using Devuan, also thanks for the informative comment. Please inform me about your success story with HDMI output from the nvidia card, I'll be looking forward on your blog.
Linux O'Beardly says
Steam is a gaming platform. It manages your games library and runs natively on Linux. It allows me to play games like Counter-Strike and Counter-Strike:Global Offensive. There are hundreds of native Linux games in the Steam library because they build a gaming system called SteamOS, which is build on Linux. I have verified the HDMI is controlled by the Nvidia GPU. There are a number of write ups on it. My specific issue is a lib conflict with libdrm in Devuan/Debian Jessie. If I can the packages I need to roll these back a version, I should be able to get it working. Thanks for the info!!! Also, I volunteer with the Devuan project and host hardware for them. I've also migrated my entire company to Devuan. We are systemd free.
Ricky Neff says
support.steampowered.com/kb_article.php?ref=6316-GJKC-7437
THIS WILL HELP, Tested. It works!
Alexandre says
I can't switch off discrete GPU witch bbswitch because the nvidia module is not turned off. I searched a lot on the forums but nothing worked 🙁
Failed to unload module 'nvidia'
device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF
Arnab Satapathi says
That's unfortunate 🙁
You should check the section 3 and 4 in this nvidia optimus troubleshooting guide, https://www.pcsuggest.com/nvidia-optimus-troubleshooting-in-debain-kali-linux-ubuntu/
Alexandre says
Already done. I feel like the Nvidia modules don't want to die x)
Mohamed says
Hi, before installing dkms should not the kernel headers be installed via sudo apt-get install linux-headers-$(uname -r)
??
Arnab Satapathi says
Yes, but if it's not installed previously, the dkms package will download the kernel header packages too as dependency.
Eric says
Hi Arnab, When I change the word stretch to jessie, does it affect my debian 9 stretch? Did I stop having debian 9 and I happened to have debian 8?
Arnab Satapathi says
I think not, if you install only few packages. But you should not run
sudo apt-get dist-upgrade
, but I also think Debian won't downgrade itself.agon says
hi.after 'Blacklist the nouveau module',I reboot my computer,the bbswitch module is not loaded automatically,but is loaded manually.is there some bug with it?
My system is Debian 9.3.
thanks
Arnab Satapathi says
May be there some bug, you can manually load the bbswitch module by editing the
/etc/modules
file and adding the entrybbswitch load_state=0
there.agon says
thank you for your reply.I have set it like this:
"Users of kmod should create /etc/modprobe.d/bbswitch.conf containing options bbswitch load_state=0 to set the default options. To load the module, systemd users should create /etc/modules-load.d/bbswitch.conf containing bbswitch."
but when rebooting,the screen is black and nothing on it.
I think this config is same as your advice.
any other thing to do?
Arnab Satapathi says
It's basically the same thing, you need to load the module. And it's loaded by the scripts in initramfs, may be you need to run
sudo update-initramfs -u
.Another problem, nvidia optimus is implemented on different laptops in different ways. I was unable to configure it on one of my friend's SONY vio laptop, tried almost every possible method, while on windows, it just works.
agon says
I have try to do it,but the error is still.now I have give up it and use only Nvidia card by setting from bios.
Thank you all the same.
tony says
Imet the smae problem on Debian Stretch.screen si balck and no display.And I cound not turn off my nvidia card in bios
Arnab Satapathi says
Then try to blacklist all nvidia related modules through kernel parameter, specially the nouveau module.
tl5k5 says
I'm also on an XPS 9560 and I've installed buster. I follow your setups up until my system locks up at: sudo apt-get install nvidia-kernel-dkms nvidia-xconfig nvidia-settings
Not sure what's going on, but it happened twice in a row. If I don't install the nvidia or bumblebee portion, will I just run off the Intel chipset exclusively?
What kind of battery life are you seeing when installing nvidia and bumblebee?
As is, it looks like I'll get just shy of 4 hrs.
Thnx!
agon says
hi,I have a trouble whit it.After I install bbswitch follow your steps,It isn't loaded automatically at every power up.some info like:
sudo lspci -v | grep -i 'vga'
00:02.0 VGA compatible controller: Intel Corporation HD Graphics P530 (rev 06) (prog-if 00 [VGA controller])
01:00.0 VGA compatible controller: NVIDIA Corporation GM204GLM [Quadro M4000M] (rev a1) (prog-if 00 [VGA controller])
uname -a
Linux debian 4.9.0-4-amd64 #1 SMP Debian 4.9.65-3 (2017-12-03) x86_64 GNU/Linux
nouveau,nvidia also is in blacklist.
please give some suggestion. thanks.
corey says
With Nvidia 960m and Debian 9, i had to add 'acpi_osi=! "acpi_osi=Windows 2009"' to kernel command line else it would hang on system boot when lightdm started
Arnab Satapathi says
Thanks for the tip, I'll add it in the troubleshooting section.
SashaNova says
Hello Thanks for the great guide!
I have two questions tho:
1. When i run (optirun -vv glxgears) in the terminal i get 1600+ fps. But i don't know if it's correct?
2. When i run (sudo service bumblebeed status) i get
[ 2286.084410] [ERROR]Failed to unload module 'nvidia' (ref count: 12).
I did edit the file /etc/bumblebee/xorg.conf.nvidia
Section "Screen"
Identifier "Default Screen"
Device "DiscreteNvidia"
EndSection
What is wrong?
Thanks!!
Arnab Satapathi says
You should use the
optirun glxinfo | grep -i 'opengl renderer'
commad to check if optirun is working or not.It's hard to tell exactly what's wrong, you should also check this article, https://www.pcsuggest.com/nvidia-optimus-troubleshooting-in-debain-kali-linux-ubuntu/
JetPro55 says
Hashcat not working
Arnab Satapathi says
With an Optimus GPU ? Unfortunately I can't check that right now.
chi says
Thank you for the great documentation. I am running kali 4.12.0, and the installation steps were performed without any errors. but if i try to run nvidia-smi: i am getting "NVIDIA_SMI has failed because it couldn't communicate with NVIDIA driver.Make sure that the latest NVIDIA driver is installed and running". I am sure i have the nvidia-driver 375.82-1.
one more thing if i do "hashcat -I" or "hashacat -b" i am getting: "no devices found"
appreciate any help on this.
detar says
thank you, it works with Kali Linux on Lenovo Z410 notebook.
additionally I need to blacklist nouveau first, reboot system and follow your guide.
redochka says
Thanks a lot. Great article with explanation. I just had to do this: askubuntu.com/questions/788532/kubuntu-16-04-bumblebee-failed-to-load-module-mouse-module-does-not-exist due to error with mouse module
Arnab Satapathi says
One of the much needed tweak to configure debian nvidia optimus, included in the main article. Thanks !
ksieben says
thx, nice work
fredwhileshaving says
Thank you dude you saved my life!
Ailton Freitas says
Thanks!!! 1000 times thanks!!! Perfect!!!!
Mhz says
I tried this and it worked in the beginning, however when I did a reboot, the kernel panicked. I tried to revert the installs by first uninstalling bumblebee then bbswitch, and I accidentally removed dkms!.
OK, re installed dkms, but now tty7 is hanging on a "started update UTMP" step, and the GUI never comes up.
Help!!!
Arnab Satapathi says
As tty7 is hanging, seems like X.org driver related problem, but kernel panicked ? How ?
First try to remove X.org related configuration from $HOME directory, and then from /etc/X11/ directory. Also don't forget to take backup of the
/etc/X11/
directory, while playing around there.Best of luck 🙂
abhi says
How to figure out which distribution is present in kali rolling .
when i run :lsb_release -a
No LSB modules are available.
Distributor ID: Kali
Description: Kali GNU/Linux Rolling
Release: kali-rolling
Codename: kali-rolling
Arnab Satapathi says
Currently Kali rolling is based on Stretch, if you want to use some upstream repo, use stretch related ones.
Josh says
This works great. The only problem with bumblebee is that hashcat doesn't detect my GPU when this is finished and I need hashcat for testing systems that I am hardening. Any Idea how to get hashcat to see the NVIDIA card when using bumblebee?
Arnab Satapathi says
Unfortunately I don't have that Debian setup anymore, but I'll try on Ubuntu.
Me says
> VirtualGL is required for the the optirun command as a bridge
Hm, VirtualGL is obsolete and got replaced by primus, right? Debian does offer and use it:
https://packages.debian.org/stretch/bumblebee
https://packages.debian.org/stretch/primus
Arnab Satapathi says
Yes, now virtualGL is obsolete, I've to update this tutorial.
I wrote another for Ubuntu, which uses primus, https://www.pcsuggest.com/nvidia-optimus-ubuntu/ .
Someone says
Hi there! Thanks for the guide! I'm looking to install Debian sid on my latop, which has a nvidia optimus.
You refered that the post needs to be updated due to virtualGL becoming obsolete. Should the only difference be replacing it with primus? Thanks
Arnab Satapathi says
Just install Primus or both. Use Primus as bridge instead of VirtualGL, a little performance improvement.
Colapsnux says
Following your tutoriel and using Debian Stretch 4.9.13-1 it works perfectly.
Thanks you very much!
A. Faruk says
Hi,
I did these steps successfully. Thanks for tutorial.
Now, I have a question. I want to active NVIDIA graphic card while I'm playing Counter Strike GO on STEAM. But, when I started the game, Intel graphic cards works.
Arnab Satapathi says
Thanks Faruk for dropping by.
First, I've no idea on STEAM and CS GO. But are you sure that you're starting STEAM with
optirun
?A. Faruk says
Yess, I found.
askubuntu.com/questions/633821/launching-csgo-via-steam-with-optirun-or-primusrun/637773#637773
The url above about this problem.
Just diffrenet for me, I added "primusrun" to three lines which start ${DEBUGGER} "${GAMEROOT}"/${GAMEEXE}
A. Faruk says
Thanks for reply,
Yes, I tried "optirun steam". While STEAM is loading, NVIDIA graphic card's led is on but when after STEAM is loaded, INTEL card's led is on.
I can play CS GO but, while I'm playing, INTEL's led is on so I'm not sure this is true? Maybe, this could hurt my PC.
Also, I have a question. What is diffrence between "optirun" and "primusrun"?
Arnab Satapathi says
Optirun uses VirtualGL as bridge by default and primusrun uses primus-libs as bridge. It's said to be prirmusrun delivers better performance.
And thanks Faruk, for informing me about the workaround.
Laggy says
Hi Arnab, very nice tutorial. I was trying to install nvidia drivers with bumblebee with no luck and many problems.I will give your tutorial a try but my only question is what is the point of doing all of this if there is no performance gains? Usually glxgears should be rendering a lot more frames then what you have. I get same result as you when only running on intel with nouveau drivers.
Arnab Satapathi says
I think glxgears is not a great benchmarking tool, can't utilise the NVIDIA GPU fully, try Furmark, some game, or even Pyrit.
If I use
vblank_mode=0
beforeglxgears
command, the intel GPU renders way more frame(above 8000) than the nVIDIA GPU.Mark H. says
Hi,
in the second step when I type this command: sudo modprobe -r vga_switcheroo
I got back this msg: modprobe: FATAL: Module vga_switcheroo not found.
Any idea what should I do?
Debian GNU/Linux 8 (jessie) 64-bit,
Graphics: Intel® Sandybridge Mobile & Nvidia GT555M
Arnab Satapathi says
Hi Mark, Just skip this step, that's all. Sometimes vga_switcheroo module is not loaded automatically at all.
Mark H. says
Thanks a lot, it is a really great and helpful description.
Is there any way to turn on constantly the nvidia when I start the computer? I would turn off or kill it the intel gpu. I have some trouble with the intel hardware.
Joe says
Totally appreciate this article. Thank you for writing this.
timefreedom says
Debian 8 (jessie) fresh install.
Hello Arnab, made the following modifications to your instructions and NVIDIA Optimus works like a charm for me:
Before step 4; installing nvidia and bumblebee, make sure and disable GUI mode { systemctl set-default multi-user.target } and reboot system into command-line.
Note: For convenience sake, before rebooting follow step 5 and download VirtualGL, don't install yet.
In step 4, Login as root and only install bumblebee { apt-get install bumblebee-nvidia }, all the drivers and dependencies are included in bumblebee-nvidia. Thanks.
After step 6, but before step 7 run { systemctl set-default graphical.target } to enable GUI again and follow the next steps.
Arnab says
These are great tips, thanks !
I'll update the tutorial after including them.
koni says
I did it to run something on my laptop.
But i am very confuse about some issues.
bbswitch doesn't load automatically at boot and bumblebee doesn't load automatically also.
Even if nvidia drivers said installed OK in GUI Nvidia X server say:
"You do not appear to be using the Nvidia X driver.
Please edit your X configuration file (just run 'nvidia-Xconfig' as root and restart the X server).
I did as how it said but i couldn't login in GUI after that.
On a clean install,again,if i run :
modprobe bbswitch load_state=0 ; service bumblebeed restart ; optirun -vv glxgears
it works ! 2600FPS (on Intel video integrated in CPU,right ????) BUT ... after a couple of seconds or
when i close the glxgears app with CTRL+C, my GPU fan it run at maximum speed and nothing can stop it , only shut down do it.If i restart the system GPU fan it continue to run at maximum speed.
Dont know what happen exactly.
How to switch on nvidia card ??
koni says
Thanks for answers arnab.
Anyway,i will continue to dig more deeply into problem.
I found that vga_shitcheroo in Ubuntu works only with nouveau drivers not proprietary drivers and only if the machine has a hardware mux. :(((
On the Ubuntu site said "you have to add-linux-generics otherwise the power saving module bbswitch cannot be built.
My laptop is a milestone indeed.
Arnab says
Best of luck buddy, yeah, the laptop is a milestone.
koni says
i have a asus rog laptop with nvidia gtx 950M discret video card and cpu I7 skylake 6700.
bbswitch was instaled but have no path /proc/acpi/bbswitch and bumblebee group doesnt exist in kali 2016.2
Arnab says
Perhaps the bbswitch module is not loaded at all !
Yes there are lots of problem with Debian/Kali on newer hardware like NVIDIA GTX 950M, and a skylate based CPU. You might want to run Ubuntu for better hardware compatibility, and install kali tools there.
koni says
i appreciate if you make a tutorial for kali 2016.2
Arnab says
At this moment it's a bit difficult, my laptops HDD is currently 40 GB only !
ivan says
Excellent work, works great. but I have a concern, I'm new using the kali linux system (which is where I've tried and done the steps of your post) and I get an average of 2700FPS. The question is, in ubuntu there is a module to load proprietary drivers and automatically installs all, why the difference is that in ubuntu average exceeds 12,000 FPS? Thank you very much.
My card is a GTX 660M
Arnab says
Thanks Ivan for your question.
Different drivers and kernel modules causes difference in performance, in my case Debian tends to perform better than Ubuntu. But FPS count really doesn't matter while actual things things, I mean GPU computing with CUDA, cracking with hashcat, running games or benchmarks.
You should try furmark benchmark on Ubuntu and Kali and spot the difference.
leland says
further information:
when runnig this command: service bumblebeed status, output:
● bumblebeed.service - Bumblebee C Daemon
Loaded: loaded (/lib/systemd/system/bumblebeed.service; disabled; vendor preset: disabled)
Active: active (running) since Wed 2016-08-31 16:45:20 IRDT; 1min 35s ago
Main PID: 1773 (bumblebeed)
Tasks: 2 (limit: 4915)
CGroup: /system.slice/bumblebeed.service
├─1773 /usr/sbin/bumblebeed
└─1782 /usr/lib/xorg/Xorg :8 -config /etc/bumblebee/xorg.conf.nvidia -configdir /etc/bumblebee/xorg.conf.d -sharevts -nolisten tcp -noreset -verbose 3 -isolateDevi
Aug 31 16:45:20 Mamali systemd[1]: Started Bumblebee C Daemon.
Aug 31 16:45:20 Mamali bumblebeed[1773]: libkmod: ERROR ../libkmod/libkmod-config.c:635 kmod_config_parse: /etc/modprobe.d/nouveau-blacklist.conf line 1: ignoring bad line st
Aug 31 16:45:20 Mamali bumblebeed[1773]: [ 257.865885] [WARN]Could not open configuration file: /etc/bumblebee/bumblebee.conf
Aug 31 16:45:20 Mamali bumblebeed[1773]: [ 257.865892] [WARN]Using default configuration
Aug 31 16:45:20 Mamali bumblebeed[1773]: [ 257.897911] [INFO]/usr/sbin/bumblebeed 3.2.1 started
Aug 31 16:45:22 Mamali bumblebeed[1773]: libkmod: ERROR ../libkmod/libkmod-config.c:635 kmod_config_parse: /etc/modprobe.d/nouveau-blacklist.conf line 1: ignoring bad line st
Aug 31 16:45:24 Mamali bumblebeed[1773]: [ 261.859426] [WARN][XORG] (WW) NVIDIA(0): Unable to get display device for DPI computation.
Arnab says
It's properly configured too !!!
leland says
Hey and thank you for this great tutorial. I successfully did everything you said, but in the last step where i run "optirun -vv glxgears", I get the following:
root@Mamali:~# optirun -vv glxgears
[ 146.138224] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ 146.151257] [WARN]Could not open configuration file: /etc/bumblebee/bumblebee.conf
[ 146.151269] [WARN]Using default configuration
[ 146.151304] [ERROR]The Bumblebee daemon has not been started yet or the socket path /var/run/bumblebee.socket was incorrect.
[ 146.151307] [DEBUG]Socket closed.
[ 146.151314] [ERROR]Could not connect to bumblebee daemon - is it running?
I'm on Kali Linux 2016.1.
edit: after restart bumblebee services, I get the following:
root@Mamali:~# optirun -vv glxgears
[ 619.125755] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ 619.125900] [WARN]Could not open configuration file: /etc/bumblebee/bumblebee.conf
[ 619.125915] [WARN]Using default configuration
[ 619.125984] [DEBUG]optirun version 3.2.1 starting...
[ 619.125988] [DEBUG]Active configuration:
[ 619.125989] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf
[ 619.125991] [DEBUG] X display: :8
[ 619.125992] [DEBUG] LD_LIBRARY_PATH: /usr/lib/x86_64-linux-gnu/nvidia:/usr/lib/i386-linux-gnu/nvidia:/usr/lib/nvidia
[ 619.125993] [DEBUG] Socket path: /var/run/bumblebee.socket
[ 619.125995] [DEBUG] Accel/display bridge: auto
[ 619.125996] [DEBUG] VGL Compression: proxy
[ 619.125997] [DEBUG] VGLrun extra options:
[ 619.125999] [DEBUG] Primus LD Path: /usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus:/usr/lib/primus:/usr/lib32/primus
[ 619.126015] [DEBUG]Using auto-detected bridge virtualgl
[ 619.126269] [INFO]Response: Yes. X is active.
[ 619.126274] [INFO]Running application using virtualgl.
[ 619.126356] [DEBUG]Process vglrun started, PID 1851.
4313 frames in 5.0 seconds = 862.563 FPS
4506 frames in 5.0 seconds = 900.942 FPS
6226 frames in 5.0 seconds = 1245.197 FPS
6718 frames in 5.0 seconds = 1343.505 FPS
12665 frames in 5.0 seconds = 2532.899 FPS
14561 frames in 5.0 seconds = 2912.002 FPS
13801 frames in 5.0 seconds = 2760.162 FPS
13088 frames in 5.0 seconds = 2617.469 FPS
is it OK?
thanks for reading
Arnab says
Congrats 😀 , you did it right, and it's absolutely OK, the FPS count says so.
Leland says
Thanks Arnab, and also special thanks for your extensive effort in making this helpful tutorial. This is the only working tutorial across the web.
BTW, is Ubunto just like Kali? I mean, finding tutorial and solving issues for latest version of Kali (Kali 2016) is not easy, at least for me. Been using it for a few weeks now and figured out many people seem to have unsolved problems. Or many packages are still not stable. If latest Ubunto is not like this, do you suggest me forget about Kali and get a fresh Ubunto install? Also, I'm a newbie in Linux world.
Arnab says
No, Ubuntu and Kali are not the same thing, but close enough. Kali is almost identical to Debian testing.
I think you don't need to uninstall Kali if you have enough time for troubleshooting.
Leland says
Oh, I see. I'll definitely stay on Kali then! Thanks again dude
Aamer says
If you are using kali sana 2016.1 , do not use apt-get upgrade in the starting steps. The latest packages are unstable, and do not allow bumblebeed services to autostart.
Do this,
A fresh install of kali sana 2016.1
apt-get update
To unload nouveau, hit ctl alt f1 to get a terminal screen at the login page of kali sana, and then enter modprobe -r nouveau.
apt-get install linux-image-4.6-amd64
apt-get install linux-header-4.6. ( not sure of the package name, hit TAB to see the options)
and then follow the remaining steps as provided on this page.
The packages installed during the upgrade are not stable, however if you really need to upgrade, I suggest you do so after you complete this entire guide, that is, at the end of all the steps mentioned.
BTW if you find any issues while building cpyrit cuda, install g++ and its supporting packages.
apt-get install g++.
Leland says
Thank you Aamer, I'll consider your points.
Arnab says
Great 🙂
Marcelo says
When I run "sudo modprobe -r nouveau" I get the following message:
modprobe: FATAL: Module nouveau is in use.
Arnab says
First Logout, then press Ctrl+Alt+F1 to access a tty, login there, if you're running a display manager, like GDM, SDDM, or Lightdm, stop it, sudo service sddm stop, now try to unload nouveau, if it doesnt works, have a look at the point 3 on this post: http://www.pcsuggest.com/nvidia-optimus-troubleshooting-in-debain-kali-linux-ubuntu/
Marco Sieben says
It works! Very good tutorial.
Using with a Dell XPS15 L50X running SparkyLinux
Arnab says
Thanks Marco ! Glad that it worked !!
attila says
optirun -vv glxgears
[ 1178.779316] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
[ 1178.779890] [ERROR]You've no permission to communicate with the Bumblebee daemon. Try adding yourself to the 'bumblebee' group
[ 1178.779918] [DEBUG]Socket closed.
[ 1178.779958] [ERROR]Could not connect to bumblebee daemon - is it running?
I added the user to the bumblebee group and restarted the daemon with your commands
Arnab says
So, is the GPU switching working now ?
attila says
I solved previous issue (but i don't know how). Now my Geforce635M works!!!!!
I post here some useful tips (kernel 4.6 and nvida 352.xx):
1)edit the bumblebe.conf with Driver=nvidia and KernelDriver=nvidia-current
2) install xserver-xorg-video-mouse (to prevent the mouse xorg driver error)
3)install xserver-xorg-video-nvidia and libgl1-nvidia-glx, REMOVE xserver-xorg-video-nouveau
DONE. Thank you 4 your useful guide!!!!!!!!!!!!!!!!!!!!!!!
Arnab says
I'll update the tutorial, that'll be helpful for many, thanks !
tomk says
ERROR: Module vga_switcheroo is not currently loaded
what can I do now?
Arnab says
Ignore it, that will be fine.
Alan Maulana Ruswa says
this guide is work for kali rolling base 2016
I follow this instruction, but in my case for make bumblebee work:
1. when you type "modprobe -r vga_switcheroo" and the result show "modprobe: FATAL: Module vga_switcheroo not found." just ignore it, it mean you dont have vga_switcheroo.
2. I use 'echo "blacklist nouveau" >> /etc/modprobe.d/nouveau-blacklist.conf' and reboot before use "modprobe -r nouveau".
3. after I install bumblebee, I need to enable bumblebee service with "systemctl enable bumblebeed" to make it work.
4. I use "adduser $USER bumblebee" for add user to bumblebee group instead "usermod -aG bumblebee $USER"
btw, thanks for this instruction
Arnab says
Surely you can do it in may way ! But in my case I don't have to enable the bumblebee daemon through systemctl, I'll add this too to the tutorial, if someone have to enable it like you.
And thanks a lot for your valuable feedback.
THC says
Thank you so much for your guide!!!!! tried bunch of others , none of them worked.
P.S.
Installed on kernel 4.6
GTX850M
Kali Rolling
Arnab says
Great to know that it's working with kernel 4.6 and GTX850M, thanks :), have a nice day.
Aamer says
A perfect guide. Works perfectly on kali sana as well as kali sana rolling. I have a nvidia gtx 980. Tested with kernel 4.3 and works perfectly. This is One of the few guides that actually works. Keep it up. And thanks a ton 🙂
Arnab says
Thanks buddy for informing me about it's workig with the 4.3 series kernel in Kali Linux , thanks a lot 🙂
raj says
How to remove this error
root@kali:~# modprobe -r nouveau
modprobe: FATAL: Module nouveau is in use.
Arnab says
Add nouveau.modeset=0 kernel parameter in grub configuration, update-grub and reboot, then try again. More here
http://www.pcsuggest.com/nvidia-optimus-troubleshooting-in-debain-kali-linux-ubuntu/
dnelub says
To test / figure out what is going on with bbswitch also, I tried following,
# /usr/sbin/dkms build -m bbswitch -v 0.8.0
Error! Could not find module source directory.
Directory: /usr/src/bbswitch-0.8.0 does not exist.
dnelub says
# modprobe bbswitch load_state=0
modprobe: FATAL: Module bbswitch not found in directory /lib/modules/4.5.0-1-amd64
All commands before this worked perfectly. what should I do now?
dnelub says
after "sudo apt-get dist-upgrade" and reboot, the problem is solved.
Now it is working! Thanks a lot.
Arnab says
Sorry for late reply, I'm glad to know you solved the problem.
Milinko says
Working like a charm! Best HOWTO on bumblebee nvidia setup available online.Thank yo!
Arnab says
Thanks Milinko 🙂
Sertac says
I just want to thank you because it was so clear for someone who knows basics of linux. Although i had some troubles according to this article, i found my solutions from comments under your article and the other sites. It was painful process which lasts 3 days for me. That one was the my last chance because i based all the other instructions from the other sites. Anyway, this is awesome. Thank you so much. Now, i'm gonna try to install CUDA and pyrit from your tutorial
Arnab says
Thanks for your reply 🙂 and glad to know that you solved the problems from the comments !
Sertac says
let me ask you something. What are the cons and pros between installing cuda from the .run file and installing it from repository? I see some samples on .run file but i don't know what can we do with these. And does the cuda-toolkit in the repository include them also?
Dist. > Kali Rolling
Arnab says
Installing CUDA from the run file requires a little more precaution, like you need a matching gcc version, libc version, matching NVIDIA drivers etc. etc. clearly mentioned on the CUDA download page.
Another advantage of installing CUDA from the Kali repository you have to download less, downloads exactly what it needs. I'd installed CUDA for this tutorial because I just don't have enough internet to download the run files, so installed CUDA from repo.
If you've installed CUDA from the repo, you don't need to install CUDA again to when a new major release is available. Using the repo is preferable, as you are running a rolling release distro, apt-get dist-upgrade will upgrade everything.
I personally prefer to install CUDA from the run files, it gives the latest features and also a little headache.
Mahan says
Hi, I have Kali Rolling.
I stock in 2nd step.
I installed the Bbswitch, but It have errors:
root@M-PC:~# sudo modprobe bbswitch load_state=0
modprobe: ERROR: could not insert 'bbswitch': No such device
root@M-PC:~# cat /proc/acpi/bbswitch
cat: /proc/acpi/bbswitch: No such file or directory
help me please 🙁
Sorry for my bad English.
Arnab says
I faced such problem once, rebooting the laptop solved.
By the way, which NVIDIA card you are using ? And is it turned off in BIOS by any chance ?
Mahan says
Hi again,
I don't have laptop , I have a Desktop Computer.
I rebooted it , but the problem not solved.
I have Zotac Geforce GTX 980 .
I checked my BIOS , but I don't see any button for turn off the GPU. 🙁
If i put my gpu out of my Mainboard , is it solve???
Arnab says
Hi Mahan, This tutorial is for laptops only, bbswitch detects only NVIDIA Optimus cards, you don't need to install bbswitch.
For desktops, Installing these will be sufficient
sudo apt-get install nvidia-kernel-dkms linux-headers-$(uname -r)
sudo apt-get install nvidia-settings nvidia-xconfig
Then run sudo nvidia-xconfig to setup the NVIDIA card.
https://mike632t.wordpress.com/2015/06/11/adding-nvidia-video-drivers-jessie/
Dinir says
Can't make it to build module of bbswitch. What should I do?
Building for 3.16.0-4-amd64 and 4.4.0-trunk-amd64
Building initial module for 3.16.0-4-amd64
Done.
bbswitch:
Running module version sanity check.
- Original module
- No original module exists within this kernel
- Installation
- Installing to /lib/modules/3.16.0-4-amd64/updates/dkms/
depmod....
DKMS: install completed.
Module build for the currently running kernel was skipped since the
kernel source for this kernel does not seem to be installed.
Arnab says
Hi, thanks your your feedback and sorry for late reply, it seems that you have to install proper kernel headers.
sudo apt-get install linux-headers-$(uname -r)
Then reinstall bbswitch.
WildPumpk1n says
Did i mention, i'm new on linux? no, so i will try to show you what i did.
For example if i do this :
# optirun glxspheres64
[ 4262.758443] [ERROR]Cannot access secondary GPU - error: [XORG] (EE)
[ 4262.758550] [ERROR]Aborting because fallback start is disabled.
Thats the answer, nothing more.
I can find file and log if you need, just let me know which file or command you need.
Arnab says
OK OK, I understand, I never faced this kind of errors, so a bit awkward with this.
There are many types of [ERROR]Cannot access secondary GPU error, so I asked there may be something more.
Possible workaround, make suere nouveau module is unloaded, edit /etc/bumblebee/bumblebee.conf and set Driver=nvidia than leaving it blank, and also ensure that you are using proper kernel driver, in my case > KernelDriver=nvidia-current .
Possibly you've tried the above workaround before, anyway happy troubleshooting and sorry for late reply !
WildPumpk1n says
Hello Arnab,
Thanks for your work, maybe you can help me. I dont find why it not work for me :
Always and always :
optirun glxgearss
[ 1548.090812] [ERROR]Cannot access secondary GPU - error: [XORG] (EE)
[ 1548.090844] [ERROR]Aborting because fallback start is disabled.
I fix my PCI bus in xorg.conf.nouveau. Try few things. The solution by andrei dont work for me, i dont un what sed do.
Thanks in advance if you can help me...
Arnab says
Hi there, It's good to get the feedback from you.
First which nvidia drivers you're using nouveau or non-free ?
If using the non-free drivers, you should fix PCI bus ID in xorg.conf.nvidia, not xorg.conf.nouveau .
Could you update the error message you are getting ? I think it's somewhat incomplete.
Have a look at this official bumblebee troubleshooting guide, this may help > https://github.com/Bumblebee-Project/Bumblebee/wiki/Troubleshooting
Please don't forget to update your comment with what exactly worked for you.
Andrei says
Unfortunately, it doesn't work. When I install Nvidia drivers and make a reboot, it shows me sad smile on grey background "Oh no, something went wrong...".
When I first started to install Nvidia drivers, I followed official instruction by Kali and disabled nouveau by command "sed 's/quiet/...". But in the end it showed me "Oh no something...", when I rebooted.
I deleted every nvidia file by "apt-get remove —purge nvidia*" and I could log in. Then I tried to install it following other guides, but after installing drivers, I get the same error every time.
But now when I type "lsmod | grep nvidia" or "lsmod | grep nouveau" it shows me nothing in both ways. maybe you know what could cause this kind of a problem? Thanks!
Arnab says
1. Which NVIDIA GPU and driver are you using ? Very recent GPUs may face driver related problems.
2. Are you using using the nouveau.modeset=0 kernel parameter. Paste the result of cat /proc/cmdline here.
3. Could bbswitch turn off your GPU sucessfully ?
Gnome shell is returning the error “Oh no something…” , as it can't be started without GPU acceleration. NVIDIA GPU shouldn't be used for running the desktop environment.
1. Make sure the kernel is 4.2.x or above.
2. Temporary solution, install LXDE, sudo apt-get install lxde .
Andrei says
Thanks for your reply. I just decided to delete all the things I installed from another guides and follow only yours. And its worked, I didn't get "Oh no..." message at the beginning!
But now I have another issue. I cannot make work command "optirun -vv glxgears", on the other hand command "glxgears" works fine.
I have this error:
[ 793.319377] [DEBUG]Using auto-detected bridge virtualgl
[ 793.326827] [INFO]Response: No - error: [XORG] (EE)
[ 793.326847] [ERROR]Cannot access secondary GPU - error: [XORG] (EE)
[ 793.326852] [DEBUG]Socket closed.
[ 793.326871] [ERROR]Aborting because fallback start is disabled.
[ 793.326876] [DEBUG]Killing all remaining processes.
I tried some tips from troubleshooting themes in my case, but nothing worked.
Also, I have strage error, that I didn't have before, when OS is loading, I get:
[ 7.229291] systemd[1]: Failed to start Load Kernel Modules.
[ 7.229578] systemd[1]: systemd-modules-load.service: Unit entered failed state.
Maybe it is somehow related?
I don't know is it needed, but here is an output from # cat /proc/cmdline:
BOOT_IMAGE=/boot/vmlinuz-4.3.0-kali1-amd64 root=UUID=78627f47-6716-49d5-a6ca-513bcd9d8956 ro acpi=force quiet nouveau.modeset=0 nouveau.modeset=0
Andrei says
Also I noticed, that I have this thing:
# modinfo nvidia
modinfo: ERROR: Module nvidia not found.
Arnab says
Hello Andrei, I like your feedback very much, I'm sorry for late reply.
1. Double check the PCI BusID at /etc/bumblebee/xorg.conf.nvidia with your cards real ID, they must match, and don't forget to uncomment it. (remove the leading # )
2. You may need a dummy X11 configuration file, more details here.
3. [ 7.229291] systemd[1]: Failed to start Load Kernel Modules. , remove bbswitch load_state=0 from /etc/modules , it's unnecessary with systemd.
4. There are two nouveau.modeset=0 , You wold like to remove remove one, just to be uncluttered.
Please let me know what actually worked for you, it may be helpful for others. Best of luck !
Andrei says
1. Yes, I've checked it for a number of times, also I've tried different inputs like "PCI:01:00:00", "PCI:10:00:00", "PCI:1:0:0", but none of them worked
2. I've tried some troubleshooting from this page, but again, nothing works. And I can't find anything related to dummy X11 on this page. Maybe you meant another source or I just didn't get your idea?
Steps 3 and 4 are done, now I don't have this Failed to start load Kernel, thanks!
Andrei says
And some more info, when I issue command "bumblebeed -vv", it seems like everything is OK. Here is the output:
[ 1021.665088] [DEBUG]Found card: 01:00.0 (discrete)
[ 1021.665147] [DEBUG]Found card: 00:02.0 (integrated)
[ 1021.665166] [DEBUG]Reading file: /**path**/bumblebee. conf
[ 1021.665441] [INFO]Configured driver: nvidia
[ 1021.665476] [DEBUG]Skipping auto-detection, using configured driver 'nvidia'
...
[ 1021.666812] [DEBUG]SIGCHILD received, but wait failed with No child processes
[ 1021.666927] [DEBUG]bbswitch has been detected.
[ 1021.666952] [INFO]Switching method 'bbswitch' is available and will be used.
...
[ 1021.667129] [DEBUG] Power method: auto
[ 1021.667145] [DEBUG] Stop X on exit: 1
[ 1021.667162] [DEBUG] Driver: nvidia
[ 1021.667177] [DEBUG] Driver module: nvidia
[ 1021.667193] [DEBUG] Card shutdown state: 1
[ 1021.667357] [DEBUG]Process /sbin/modprobe started, PID 1888.
[ 1021.667392] [DEBUG]Hiding stderr for execution of /sbin/modprobe
[ 1021.669042] [DEBUG]SIGCHILD received, but wait failed with No child processes
[ 1021.669101] [DEBUG]Configuration test passed.
[ 1021.669178] [ERROR]Daemon already running, pid 1632
Andrei says
I solved it! In my case it worked (link - https://forums.kali.org/showthread.php?21956-%28Guide%29-Installing-Nvidia-Bumblebee-CUDA-for-Optimus-enabled-Laptops&p=56454&viewfull=1#post56454). I hope my way of troubleshooting will help someone.
One more time, thanks Arnab for your tutorial and for your help!
Arnab says
Finally it worked ! The problem is a bit deeper than I thought.
Bunch of thanks to you too, for your valuable feedback.
Andrei says
Hi Arnab, thanks for your post, but unfortunately I can't see my nVidia 740m in the lspci -v | grep -i 'vga'. I have ASUS N56VB notebook also with Intel integrated video card, which is visible. What is the problem?
Arnab says
Hello Andrei, try lspci -v | grep -i 3d this may help. I'll update the tutorial very soon.
Andrei says
Yes, I see it there, but is it OK? I thought I have to see my Nvidia in VGA controllers. So, it is not a big deal and this tutorial is suitable for my situation, too?
Arnab says
yes, it's seems to be OK, some newer NVIDIA GPUs are likely to be show as 3D controller, this tutorial should work too on your system.
For your curiosity, search your graphics card here > http://pcidatabase.com/search.php?device_search_str=graphics
Katya says
Thanks for your tutorial!
Arnab says
You're welcome ! Hope it helped you.
Bijan Minaee says
Hi Arnab,
I have all the problems which you describe with overheating CPU , roaring fan on my Compaq machine running Debian jessie.
I have followed your instructions to the point of 'modprobe -r nouveau'.
My terminal return to this command is :
modprobe:FATAL:Module nouveau in use.
So further progress hampered. What now please.?
Arnab says
Hello Bijan, thanks for your feedback.
Sometime nouveau module is used by the KMS , you need to tell the kernel that not to use nouveau for mode setting. So add nouveau.modeset=0 kernel parameter to /etc/default/grub file , in the line GRUB_CMDLINE_LINUX_DEFAULT="quiet ...something ..." , Now update grub configuration, sudo update-grub and reboot. Hope this will solve your problem.
Bijan Minaee says
Hi Arnab
After numerous attempts, following your comments, I am no further forward.
Adding nouveau.modeset=0 outside the quotation marks just did not work returning error messages.
The same inside like "quiet nouveau.modeset=0" did not produce any error.
Have generated blacklist file but nouveau gets loaded every time after reboot.
Arnab says
Thanks for you feedback again, but I could not understand your first feedback, "Adding nouveau.modeset=0 outside th.... ".
First install bumblebee and bbswitch, it will generate a new initramfs, this may be helpful.
Yes you have to put everything inside the quotation marks, it should look like this > GRUB_CMDLINE_LINUX_DEFAULT="quiet nouveau.modeset=0" and be careful while editing the /etc/default/grub file.
As debian jessie uses systemd as startup daemon, blacklist file under /etc/modprobe.d/ or /etc/modules no longer works properly.
I'm writing another tutorial specially for troubleshooting NVIDIA optimus in Debian, check it out if possible.
Bijan Minaee says
Thanks again
Have installed bbswitch, but the following command and return show the state of affairs at the mo.
bijanminns@debian:~$ sudo modprobe bbswitch load_state=0
modprobe: ERROR: could not insert 'bbswitch': No such device
Look forward to your tutorial.
Kaivalya says
I have a Nvidia 840M graphics card, I'm trying to install bumblebee in kali since last 3 months, but failed every time with a black screen. So I have to start fresh again, with a clean install. I don't know what I'm doing incorrect. This time I using your guide to see if I can succeed. But before starting I would like to know if there are any per-requisites for it and is it just a step-by-step guide because I'm not familiar with linux so don't have a detailed knowledge about it, don't know about the modifications to be made. Please help me if I have to alter something.
Currently trying it without waiting for reply! Will reply back if stuck.
Kaivalya says
When i write this:
"sudo modprobe bbswitch load_state=0" the output is this "modprobe: FATAL: Module bbswitch not found." What should I do?
Kaivalya says
Unbelievable! It worked. I had changed a command in between. But I still don't believe, how can I check that is bumblebee installed and running?
Arnab says
So is the problem solved ? NVIDIA optimus working fine ?
To check the bumblebee service working or not run this command
sudo service bumblebeed status
know the nvidia card status, on or off, cat /proc/acpi/bbswitch
Hope this will help you, and best of luck buddy 🙂
Kaivalya says
Nope! I cant use cudaHashcat. Secondly this is the output.
root@kali:~# sudo service bumblebeed status
● bumblebeed.service - Bumblebee C Daemon
Loaded: loaded (/lib/systemd/system/bumblebeed.service; enabled)
Active: active (running) since Sat 2015-12-12 18:13:00 IST; 8min ago
Main PID: 1775 (bumblebeed)
CGroup: /system.slice/bumblebeed.service
└─1775 /usr/sbin/bumblebeed
root@kali:~# cat /proc/acpi/bbswitch
0000:08:00.0 OFF
Arnab says
Your NVIDIA card card is supported well, but there may be some config error, plese check the first connent.
Edit this file, /etc/bumblebee/xorg.conf.nvidia and but tose lines bellow, restart the system and check again.
Section "Screen"
Identifier "Default Screen"
Device "DiscreteNvidia"
EndSection
watch out the fancy quotes ( " ) This may help. Actually newer NVIDIA cards are behaves somewhat worried.
Arnab says
Currently I don't have the Hashcat 7z archive, and running out of internet, so I can't help you right now, now google is your friend. You have to run cudaHashcat with optirun, like this optirun ./cudahashcat --help
Thank you for your request, I'll add another tutorial about cudaHashcat soon.
mat says
Thank you. I'll try and will write you if i finally can configure the card.
mat says
Thank you for your tip. But I have this problem when i try optirun:
[ 2511.401556] [ERROR]Cannot access secondary GPU - error: [XORG] (EE)
- SMP Debian 4.2.6-1 (2015-11-10) x86_64 GNU/Linux
- lspci: 04:00.0 3D controller: NVIDIA Corporation GK208M [GeForce 920M] (rev a1)
- My bumblebee.conf has "KernelDriver=nvidia-current"
- My xorg.conf.nvidia has BusID "PCI:4:0:0"
Any idea??
Thank again.
Arnab says
sorry for a late reply, your
lspci
command shows the NVIDIA PCIbus id04:00.0
but
xorg.conf.nvidia
is configured withPCI:4:0:0
, you may want to change this, but this bus id parameter is not absolute necessary, have a look at the /etc/bumblebee/xorg.conf.nvidia file.You may have a look at this arch wiki article, very helpful for troubleshooting wiki.archlinux.org/index.php/Bumblebee .
Rowdy says
two issues:
1. i download virtualgl deb from sourceforge website but debian says it is not a debian package (exact same filename as you have in your article)
2. when i run optirun glxgears i get "error /dev/dri/card0 failed to set drm interface 1.4 permission denied" and i am in video and bunblebee groups
What is the solution to these issues?
Thanks
Arnab says
First, thank you for dropping your valueable comment,
file your_downloaded_package_name.deb
It should return Debian binary package (format 2.0) something like this, if not, probably you downloaded something wrong or downloaded deb package is corrupted.Section "Screen"
Identifier "Default Screen"
Device "DiscreteNvidia"
EndSection
Watch out the fancy quotes, got this from this wiki.archlinux.org/index.php/Bumblebee arch wiki article.