Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Installation and configuration of Bumblebee on Kali Linux.


This is a Bumblebee installation and configuration procedure. It runs on a fully updated Kali Linux 2018.2. To avoid possible errors, I started with a new installation. You must have a laptop computer with a Nvidia graphics card that supports Optimus technology.


On Windows, Nvidia drivers allow Optimus technology to be exploited: when you are not using graphic resources that are too greedy, it is the CPU's 3D chipset that performs the calculations leaving the graphics card at rest. When you start a game, 3D calculations are then supported by the GPU. Among other things, this reduces electricity consumption and reduces the ventilation of your laptop. On GNU/Linux, it's more complicated. Nvidia's proprietary drivers do not support Optimus on this operating system. You must therefore use a third party software to have the same behavior as on Windows.

How it works?

The Bumblebee server disables the discrete video card if no client is detected (if power management is enabled which is the default setting). This is done by keeping track of programs that request Bumblebee to run themselves on the discrete nvidia card. On such requests, a X server is started which makes use of the nvidia card. Because the frames cannot directly be displayed on the display due to the Optimus design, VirtualGL was used to copy frames to the visible display which runs on the integrated GPU. It has now been replaced by a more adapted solutions, primus.

Logo of Bumblebee



We're checking to see if the nouveau module is loaded. This is the open driver for Nvidia GPUs.

lsmod | grep -i 'nouveau'

We try to disable it but it's impossible because it's in use.

modprobe -r nouveau

We prevent it from starting during the machine start-up. Create the file if needed.

nano /etc/modprobe.d/blacklist-nouveau.conf
    blacklist nouveau
    options nouveau modeset=0

The modules nouveau and nvidia are also blacklisted in the GRUB configuration.

nano /etc/default/grub
    GRUB_CMDLINE_LINUX_DEFAULT="quiet modprobe.blacklist=nvidia-modeset,nvidia-uvm,nvidia,nouveau"

We regenerate GRUB and initramfs.

update-initramfs -u

The module nouveau is no longer loaded. We check which driver is used.

lspci -nnk | grep -i vga -A3 | grep 'in use'

Install the following packages. bbswitch is available in the repositories.

apt install gcc make linux-headers-amd64 dkms bbswitch-dkms

We launch bbswitch module.

modprobe bbswitch

We check if if launched well. If anything comes up, it's okay.

lsmod | grep 'bbswitch'

We install the Nvidia stack.

apt install nvidia-kernel-dkms nvidia-xconfig nvidia-settings nvidia-vdpau-driver vdpau-va-driver mesa-utils bumblebee-nvidia primus xserver-xorg-video-nvidia libgl1-nvidia-glx

We check that the proprietary driver is launched.

lspci -nnk | grep -i vga -A3 | grep 'in use'

Download virtualgl then install it because it is not present in the repositories.

dpkg -i virtualgl_2.5.90_amd64

We add root to bumblebee group.

adduser root bumblebee

We launch the bumblebee service.

service bumblebeed start

We disable the Nvidia graphics card.

tee /proc/acpi/bbswitch <<< OFF

Somme checks.

lsmod | grep nouveau # Should returns nothing
lsmod | grep nvidia # Should returns nothing
optirun lsmod | grep nvidia # Should returns three lines
cat /proc/acpi/bbswitch # Should returns OFF

To launch a 3D software with GPU rendering.

optirun <program>

In another shell while the above program is running.

cat /proc/acpi/bbswitch # Should returns ON

Another option to launch a 3D software with GPU rendering.

vblank_mode=0 primusrun <programme> #vblank_mode allows to remove the laptop screen limit mostly 60 Hz. You will get more than 60 fps.

Autostart bumblebeed service.

systemctl enable bumblebeed.service

Switch off Intel Turbo Boost at login which heats my computer and therefore ventilates for nothing.

cd ~
vi .profile
    echo "1" >/sys/devices/system/cpu/intel_pstate/no_turbo #add this line at the end of the file.

To switch on Intel Turbo Boost back.

echo "0" >/sys/devices/system/cpu/intel_pstate/no_turbo


Launch glxgears with the integrated Intel chipset. The framerate should be approximately the same as the monitor refresh rate.


Launch glxgears with the integrated Intel chipset without framerate restriction.

vblank_mode=0 glxgears

Launch glxgears with the Nvidia GPU. The framerate should be approximately the same as the monitor refresh rate.

primusrun glxgears

Launch glxgears with the Nvidia GPU without framerate restriction.

vblank_mode=0 primusrun glxgears

Check if bbswitch is working while Nvidia GPU is running.

cat /proc/acpi/bbswitch
# You should see 0000:01:00.0 ON

Note : use primusrun instead of optirun. Optirun uses VirtualGL backend but it does not play nice with some applications. In addition, performance is improved. In my case, with optirun 2500 FPS against 4000 FPS with primusrun.

Enable HDMI video output

Create the following file.

vi /usr/share/X11/xorg.conf.d/20-intel.conf
    Section "Device"
        Identifier "intelgpu0"
        Driver "intel"
        Option "VirtualHeads" "2"

Modify the following file like this.

vi /etc/bumblebee/xorg.conf.nvidia
    Section "ServerLayout"
        Identifier  "Layout0"
        Option      "AutoAddDevices" "true"
        Option      "AutoAddGPU" "false"

    Section "Device"
        Identifier  "DiscreteNvidia"
        Driver      "nvidia"
        VendorName  "NVIDIA Corporation"
        Option "ProbeAllGpus" "false"
        Option "NoLogo" "true"
        #Option "UseEDID" "false"
        #Option "UseDisplayDevice" "none"
        Option "AllowEmptyInitialConfiguration"

    Section "Screen"
	    Identifier "Screen0"
	    Device "DiscreteNvidia"

Connect the HDMI wire then run.

intel-virtual-output -f #To let the process attached to the terminal
intel-virtual-output #To detach the process

List the available screens (main screen + virtual). A virtual screen is an external screen.

xrandr --listactivemonitors

To set up the HDMI display (VIRTUAL1), as a copy of the laptop main screen (LVDS).

xrandr --output LVDS1 <or other main screen name> --mode 1600x900 <changing the resolution of the main screen> --output VIRTUAL1 <or other virtual screen name> --mode VIRTUAL1.637-1920x1080 <or virtual screen mode obtained with xrandr without options when the cable is connected> --same-as LVDS1 <or other main screen name>

In some cases, the default resolution proposed for virtual output is not the maximum resolution. The problem can be overcome by defining a variable containing this resolution.

mode_max=$(xrandr |grep "VIRTUAL1\." |awk '{print $1}'|head -1) #Replace VIRTUAL1 by your virtual screen name.

This variable can be used to automate the launch of an HDMI device whose maximum resolution is unknown.

xrandr --output VIRTUAL1  <or other virtual screen name> --mode $mode_max --same-as LVDS1 <or other main screen name>

Stop screen sharing.

pkill -e intel-virtual-output

To do

  • Enable HDMI audio output

This comment has been minimized.

Copy link

@itsgovindjs itsgovindjs commented Dec 20, 2019

I followed the steps as mentioned everything went smoothly except (optirun lsmod | grep nvidia) this command throws error could not load GPU drivers to this I followed the procedure of debian bumblebee wiki page by changing the bumblebee.conf file by that steps. The troubleshoot page said to check the nvidia kernel and driver version and the sys.log file. The sys.log file has an error stating "The nvidia 820m supports legacy 390.xx version the installed driver 430.64 will be ignored".
Any help to get this to work with legacy 390.xx


This comment has been minimized.

Copy link

@GMANNMODS GMANNMODS commented Apr 19, 2020


Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment