(Guide) Installing Nvidia + Bumblebee + CUDA for Optimus enabled Laptops
Updated for Kali 2.0 Sana
Hey guys, I'm rewriting this to use the repo as Kali Sana looks to have up-to-date nvidia drivers straight out of the gate.
Code:
NVIDIA Driver 352.21
CUDA 7.5.18 (the repo has 6.0.37-5, it's a bit old so I'm manually installing 7.5.18)
VirtualGL 2.4.90
Pyrit v308 (optional)
cudaHashcat (optional)
Couple of points
1. This guide and all GPU passthrough software such as cuda_pyrit and cudahashcat will never work if run from within a Virtual Machine. Please don't post that it does not work for you in a VM because you should have read this.
2. I'm going to assume that you are either on a fresh install of Kali or have the skills to clean up any conflicting software.
3. I run 64bit software. If you don't, change the files you download to match what you use. (Edit: CUDA does not support 32bit anymore)
4. If you have any issues or if something does not work, follow the template linked here and post the results of all commands.
Lets get started.
1. Update Kali
Code:
apt-get update && apt-get upgrade && apt-get dist-upgrade
2. Download VirtualGL and install it. Grab the latest non-beta
Code:
http://sourceforge.net/projects/virtualgl/files/
Install with:
cd ~
dpkg -i virtualgl*.deb
3. Download CUDA 7.5. Grab the x64 or 14.04 *.run file (should be 1.1gb)
Code:
https://developer.nvidia.com/cuda-downloads
5. Install linux headers for your kernel
Code:
apt-get install linux-headers-$(uname -r)
6. Install dependencies we will need later. The first two are for CUDA and the last is for pyrit
Code:
apt-get install freeglut3-dev libxmu-dev libpcap-dev
7. Update system PATH. Notice that the PATH references CUDA 7.5. If you have a different version, change it to match.
Code:
nano ~/.bashrc
Add the following line and then save and close bashrc
export PATH=$PATH:/opt/VirtualGL/bin:/usr/local/cuda-7.5/bin
8. Export the system path. We export the path from terminal so we can take advantage of it without restart. Run the following in terminal
Code:
export PATH=$PATH:/opt/VirtualGL/bin:/usr/local/cuda-7.5/bin
9. Install bumblebee-nvidia and primus. Just press enter when the messages appear and ignore the warning about rrmod.
Code:
apt-get install bumblebee-nvidia primus
10. Edit the bumblebee config file so bumblebee knows we are using the NVIDIA driver. Change the 'Driver=' value. Should be line 22. The module from the repo driver is 'nvidia-current' but we set 'nvidia' here so that the nvidia section of bumblebee.conf is called.
Code:
nano +22 /etc/bumblebee/bumblebee.conf
Make it read:
Driver=nvidia
check line 55 and make sure it reads:
KernelDriver=nvidia-current
Save and close
11. Run the following and record the PCI address of your video card. It will look similar to 03:00.0
Code:
lspci | egrep 'VGA|3D'
12. Edit the xorg.conf.nvidia file so it knows the PCI address of your video card. Note that the last group of numbers is now seperated with a ":" instead of a ".". We are editing under the area 'Section "Device"'
Code:
nano /etc/bumblebee/xorg.conf.nvidia
Section "Device"
Identifier "DiscreteNvidia"
Driver "nvidia"
VendorName "NVIDIA Corporation"
BusID "PCI:03:00:0"
14. Reboot
15. Now we have restarted, test the driver. glxsheres64 will test the driver and modinfo nvidia will show the version loaded.
Code:
optirun glxspheres64
modinfo nvidia
16. Prepare CUDA for install
Code:
cd ~
chmod +x cuda*.run
17. Run the CUDA install
Code:
./cuda*.run
Accept the EULA
Select yes to unsupported configuration
No to graphics driver
Yes to the toolkit
Accept default location
Yes to symbolic link
Yes to samples
Yes to default samples location
The toolkit will install
18. Set up the dynamic linker for CUDA. Notice that this is slightly different than the path added for .bashrc
Code:
nano /etc/ld.so.conf
Match the contents below
include /etc/ld.so.conf.d/*.conf
/usr/local/cuda-7.5/lib64
19. Excute the following to load our changes
20. Install libcuda1. You will get an incorrect driver version error if you don't.
Code:
apt-get install libcuda1
21. Build the NVIDIA samples so we can confirm CUDA is working with optirun
Code:
cd /root/NVIDIA_CUDA-7.5_Samples/1_Utilities/deviceQuery/
make
22. Run deviceQuery and then post your pass! If you see a pass, it all worked out! If not, follow the link at the start of the guide and post everything asked.
Code:
optirun ./deviceQuery
Links for OFF-Line installation
Great guide staticn0de!
- This post edited with download links for an OFF-Line installation on Kali 1.1.0 -
Download CUDA, VirtualGL, Nvidia, CudaHashcat, from previous posts above.
This does not include Kali Linux updates or Headers. Just the extra packs required for this guide.
All links point to Debian wheezy(stable) packages whenever possible or equivalent/default.
- Scroll down the page at Debian and choose your architecture under "Download".
- Choose a server to download from.
All packs go in Home, the /root directory. Remove them when installation is done.
Install from root with
(6.) Download and Install dependencies for CUDA and Pyrit.
freeglut3-dev
https://packages.debian.org/wheezy/freeglut3-dev
libxmu-headers
https://packages.debian.org/wheezy/libxmu-headers
libxmu-dev
https://packages.debian.org/wheezy/libxmu-dev
libpcap-dev
https://packages.debian.org/wheezy/libpcap-dev
(9.) Download and Install bumblebee and primus.
linux-headers (another "linux headers")(mine was linux-headers-amd64_3.18+63+kali2.1_amd64.deb)
http://ftp.tku.edu.tw/kali/pool/main/l/linux-latest/
dkms
https://packages.debian.org/wheezy/dkms
bbswitch-dkms
https://packages.debian.org/wheezy-b.../bbswitch-dkms
bumblebee
https://packages.debian.org/wheezy-backports/bumblebee
primus-libs
https://packages.debian.org/wheezy-b...ts/primus-libs
primus
https://packages.debian.org/wheezy-backports/primus
Optional. Download and Install Pyrit and add-on for Nvidia CUDA.
pyrit_svn 0.4.1-dev svn r308
From Linux, enter in a console;
Code:
svn checkout http://pyrit.googlecode.com/svn/trunk/ pyrit_svn
That will download a folder in /root (Home) named, pyrit_svn
That folder is pyrit 0.4.1 svn r308. You can then save that folder for later off-line installations.
Built and install Pyrit and add CUDA support.
Code:
cd pyrit_svn/pyrit/
Code:
python setup.py build
Code:
python setup.py install
Code:
python setup.py build
Code:
python setup.py install
Total: 11 packs. 2,05 Mb