Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Making Nvidia Drivers + CUDA 8 + Bumblebee work together on XPS 15 Early 2017 9560 kabylake.
1. disable secure boot
2. clean install windows (see
2.1 in case usb does not show on boot:
# Update kernel (is this mandatory?)
( mkdir /tmp/kernel-4.10.6
cd /tmp/kernel-4.10.6
sudo dpkg -i *.deb )
# Install KabyLake graphics patches
( cd /tmp;
tar xjvf kbldmcver101.tar.bz2; cd kbl_dmc_ver1_01/; sudo ./ )
( cd /tmp;
tar xvzf kblgucver914.tar.gz; cd firmware/kbl/guc/kbl_guc_ver/; chmod a+x; sudo ./ )
# Add Nvidia repository
sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update
# Install via ubuntu drivers
sudo ubuntu-drivers autoinstall
# Install CUDA 8 (if you're interested in using gpu for ML)
# This acts as repo so install it somewhere safe and do not delete
cd ~/Downloads
sudo dpkg -i cuda*.deb; sudo apt update; sudo apt install cuda
# The version of prime-select is BS. Patch prime select like this
cd /usr/bin
mv prime-select prime-select.bkup
sudo wget
sudo chmod 755 prime-select
sudo reboot now
# Testing cuda.
$ sudo prime-select intel
$ nvidia-smi
# This should give an error, no drivers found
# Try this
$ sudo prime-select nvidia
# displays CUDA info.
# You can leave it here if you're not worried about battery but if you are then continue with this.
# Install powertop and tlp
sudo apt install tlp powertop
# Run powertop:
sudo powertop
# You should see battery discharge around 20w +/- 5W, this eats up my battery 4 times faster.
# Add command line params:
sudo nano /etc/default/grub
# Make the following look like this, do not ask why.
GRUB_CMDLINE_LINUX_DEFAULT='pcie_port_pm=off acpi_backlight=vendor acpi_osi=Linux acpi_osi=! acpi_osi="Windows 2009"'
sudo update-grub2
# Install bumblebee - now this is the danger zone, this software has not been updated in a while and I am not sure when will this available.
# Avoid updating your system if you're fine with this.
sudo add-apt-repository ppa:bumblebee/testing
sudo apt update
sudo apt install bumblebee bumblebee-nvidia
# Add yourself to the bumblebee usergroup so you can make changes to the videocard.
sudo adduser $USER bumblebee
# Enable bumblebee service
sudo systemctl enable bumblebeed
# now you need to load the right driver in bumblebee because it's an old piece of software which has not been updated in a whie
# to know the nvidia driver currently loaded. Run:
lsmod | grep nvidia
# this should give you something like, nvidia-xxx
# at the time of writing this, the latest is nvidia-378 but cuda 8 requires the stable, which is nvidia-375
# add them to bumblebee config file.
sudo nano /etc/bumblebee/bumblebee.conf
# change 'Driver=' to 'Driver=nvidia'
# change all occurences of 'nvidia-current' to 'nvidia-xxx'
# Since the driver load will now be handled by bumblebee, we need to stop the OS from loading it.
sudo nano /etc/modprobe.d/bumblebee.conf
# add a new entry toward the end, with nvidia-xxx, in my case:
# nvidia-375
blacklist nvidia-375
blacklist nvidia-375-drm
blacklist nvidia-375-updates
blacklist nvidia-experimental-375
# once that is done, you'll need bbswitch dkms module
sudo apt-get install bbswitch-dkms
# Load this with the kernel.
sudo nano /etc/modules-load.d/modules.conf
# add following
# TLP is known to interfere with bumblebee, make it avoid using this
# Run powertop to see if battery consumption is in check: 10w +/- 5W
# Testing bumblebee
cat /proc/acpi/bbswitch # Ouput:0000:01:00.0 OFF
optirun glxgears -info # Runs the Gears demo
optirun nvidia-smi # Should give an error
sudo prime-select nvidia # Should select nvidia hardware for cuda
optirun nvidia-smi # Outputs:
Mon Feb 20 21:51:18 2017
| NVIDIA-SMI 375.39 Driver Version: 375.39 |
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| 0 GeForce GTX 1050 Off | 0000:01:00.0 Off | N/A |
| N/A 41C P3 N/A / N/A | 6MiB / 4041MiB | 0% Default |
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
| 0 3351 G /usr/lib/xorg/Xorg 6MiB |
cat /proc/acpi/bbswitch # Still Outputs:0000:01:00.0 OFF which means, we're using nvida hardware only when we run applications using optirun
# Getting mouse freezes, random misses?
dmesg -w | grep psmouse #check if your trackpad is out of sync frequently
# Add this boot flag:
# trackpad: +
sudo apt-get install xserver-xorg-input-libinput
sudo apt-get remove --purge xserver-xorg-input-synaptics
sudo reboot
sudo mkdir /etc/X11/xorg.conf.d
cat """Section "InputClass"
Identifier "libinput"
Driver "libinput"
MatchDevicePath "/dev/input/event*"
MatchIsTouchpad "true"
Option "Tapping" "True"
Option "TappingDragLock" "True"
Option "PalmDetection" "True"
Option "ButtonMapping" "1 3 2"
Option "DisableWhileTyping" "True"
Option "NaturalScrolling" "False"
Option "AccelProfile" "adaptive"
Option "AccelSpeed" "0.1"
Option "ClickMethod" "clickfinger"
Option "MiddleEmulation" "True"
Option "ScrollMethod" "twofinger"
Option "HorizontalScrolling" "True"
Option "SendEventsMode" "disabled-on-external-mouse"
""" > /etc/X11/xorg.conf.d/30-touchpad.conf
# Other Helpful links:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment