Bumblebee

Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in GNU/Linux systems. Such feature involves two graphics cards with two different power consumption profiles plugged in a layered way sharing a single framebuffer.

Before installing Bumblebee, check your BIOS and activate Optimus (older laptops call it “switchable graphics”) if possible (BIOS does not have to provide this option). If neither “Optimus” or “switchable” is in the bios, still make sure both gpu’s will be enabled and that the integrated graphics (igfx) is initial display (primary display). The display should be connected to the onboard integrated graphics, not the discrete graphics card. If integrated graphics had previously been disabled and discrete graphics drivers installed, be sure to remove /etc/X11/xorg.conf or the conf file in /etc/X11/xorg.conf.d related to the discrete graphics card.

Install:

  • bumblebee – The main package providing the daemon and client programs.
  • mesa – An open-source implementation of the OpenGL specification.
  • An appropriate version of the NVIDIA driver, see NVIDIA#Installation.
  • Optionally install xf86-video-intel – Intel Xorg driver.

For 32-bit application support, enable the multilib repository and install:

In order to use Bumblebee, it is necessary to add your regular user to the bumblebee group:

# gpasswd -a user bumblebee

Also enable bumblebeed.service. Reboot your system and follow #Usage.

Usage

Test

Install mesa-demos and use glxgears to test if if Bumblebee works with your Optimus system:

$ optirun glxgears -info

If it fails, try the following commands:

  • 64 bit system:
$ optirun glxspheres64
  • 32 bit system:
$ optirun glxspheres32

If the window with animation shows up, Optimus with Bumblebee is working.

Note: If glxgears failed, but glxspheresXX worked, always replace “glxgears” with “glxspheresXX” in all cases.

General usage

$ optirun [options] application [application-parameters]

For example, start Windows applications with Optimus:

$ optirun wine application.exe

For another example, open NVIDIA Settings panel with Optimus:

$ optirun -b none nvidia-settings -c :8
Note: A patched version of nvdockAUR is available in the package nvdock-bumblebeeAUR

For a list of the options for optirun, view its manual page:

$ man optirun

Power management

The goal of the power management feature is to turn off the NVIDIA card when it is not used by Bumblebee any more. If bbswitch (for linux) or bbswitch-dkms (for linux-lts or custom kernels) is installed, it will be detected automatically when the Bumblebee daemon starts. No additional configuration is necessary. However, bbswitch is for Optimus laptops only and will not work on desktop computers. So, Bumblebee power management is not available for desktop computers, and there is no reason to install bbswitch on a desktop. (Nevertheless, the other features of Bumblebee do work on some desktop computers.)

Default power state of NVIDIA card using bbswitch

The default behavior of bbswitch is to leave the card power state unchanged. bumblebeed does disable the card when started, so the following is only necessary if you use bbswitch without bumblebeed.

Set load_state and unload_state module options according to your needs (see bbswitch documentation).

/etc/modprobe.d/bbswitch.conf
options bbswitch load_state=0 unload_state=1

To run bbswitch without bumblebeed on system startup, do not forget to add bbswitch to /etc/modules-load.d.

Enable NVIDIA card during shutdown

On some laptops, the NVIDIA card may not correctly initialize during boot if the card was powered off when the system was last shutdown. Therefore the Bumblebee daemon will power on the GPU when stopping the daemon (e.g. on shutdown) due to the (default) setting TurnCardOffAtExit=false in /etc/bumblebee/bumblebee.conf. Note that this setting does not influence power state while the daemon is running, so if all optirun or primusrun programs have exited, the GPU will still be powered off.

When you stop the daemon manually, you might want to keep the card powered off while still powering it on on shutdown. To achieve the latter, add the following systemd service (if using bbswitch):

/etc/systemd/system/nvidia-enable.service
[Unit]
Description=Enable NVIDIA card
DefaultDependencies=no

[Service]
Type=oneshot
ExecStart=/bin/sh -c 'echo ON > /proc/acpi/bbswitch'

[Install]
WantedBy=shutdown.target

Enable NVIDIA card after waking from suspend

The bumblebee daemon may fail to activate the graphics card after suspending. A possible fix involves setting bbswitch as the default method for power management in /etc/bumblebee/bumblebee.conf:

/etc/bumblebee/bumblebee.conf
[driver-nvidia]
PMMethod=bbswitch

[driver-nouveau]
PMMethod=bbswitch

 Note: This fix seems to work only after rebooting the system. Restarting the bumblebee service is not enough.

Calogero Scarnà
Calogero Scarnà
Articoli: 299

Newsletter

Inserisci il tuo nome e il tuo indirizzo email qui sotto e iscriviti alla nostra newsletter