2013-01-28

openSUSE 12.2: How to install 'bumblebee' for NVIDIA Optimus VGA

The following is a description of how I installed Bumblebee 3.0 on my Dell laptop (with nVidia Optimus) running openSUSE 12.2.

NOTE TO USERS OF OPENSUSE 12.3
For a description of how I did this procedure on openSUSE 12.3, go to HERE, instead!

NOTE TO USERS OF OPENSUSE 13.1
For a description of how I did this procedure on openSUSE 13.1, go to HERE, instead!



Disclaimer: Bumblebee 3.0 is experimental. It is not supported by openSUSE 12.2. You should not assume that you will get any desired results by imitating this procedure. In fact, you may damage, hose, or otherwise foul up your system. If you are not willing to take that risk on yourself, please leave now and do not try to imitate this procedure. On the other hand, if you are willing and able, you are welcome to test this and provide your feedback, for example by noticing mistakes I made and putting your corrections in the comments.

(Here are the instructions I originally used (and subsequently modified) to arrive at this procedure: File README.md of Package bumblebee)
  1. Run the following command and make sure the output is as shown:
    # cat /etc/SuSE-release
    openSUSE 12.2 (x86_64)
    VERSION = 12.2
    CODENAME = Mantis
    
    Also make sure that I haven't done any weird, non-standard things to my 12.2 installation, like upgrade the kernel to 3.7, install the proprietary nVidia driver "the hard way" (or any other way), etc.
  2. Add the "Bumblebee nVidia" repository from "Factory"
    # zypper ar -f http://download.opensuse.org/repositories/home:/Bumblebee-\
    Project:/nVidia:/latest/openSUSE_Factory "Bumblebee nVidia"
  3. Add Overman79's Open Build Service repository
    # zypper ar -f http://download.opensuse.org/repositories/home:/Overman79\
    /openSUSE_12.2/ "Home:Overman79"
    
  4. Read carefully Overman79's repository description:
    Repository Description:
    Bumblebee brings Nvidia's Optimus Support for Linux through VirtualGL. To 
    use it in Opensuse, you will need to run the following command after 
    installing the bumblebee package inside this repo:
    
    # systemctl enable bumblebeed.service
    
    Remember to add yourself to the "bumblebee" group.
    
    If you want to be able to turn on/off the Nvidia card, i recommend install 
    the "dkms-bbswitch" package. If you use a standard kernel, install the 
    "bbswitch" package.
    
    To use the Nvidia proprietary drivers with bumblebee, add the Bumblebee 
    Project Team repo and install the packages "x11-video-nvidia" and 
    "dkms-nvidia"
    
    Until i add a proper systemctl service file for dkms, it will be necessary 
    to manually rebuild the modules after a kernel upgrade with this command:
    
    # dkms build -m module_name -v version
    
  5. Add myself to the "bumblebee" group. This can be done using YaST (Security and Users -> User and Group Management). Read more about YaST here. Or it can be done from the command line using this technique.
  6. Install the "Linux kernel development" pattern in YaST
  7. Install the "dkms-nvidia" package. (This may not go smoothly. Make sure the package really does install -- first it downloads the binary blob, then it installs it (DKMS kernel module build), and then it makes changes to GRUB2 and initrd. All of this must go well, or it won't work.)
    # zypper refresh
    # zypper install dkms-nvidia
    
  8. Enable the dkms system service by issuing the command systemctl enable dkms as root
  9. Install other NVIDIA-related packages:
    # zypper install x11-video-nvidia \
    x11-video-nvidia-devel \
    nvidia-compute \
    nvidia-compute-devel
    
    And, assuming you're running a 64-bit system
    # zypper install x11-video-nvidia-32bit \
    x11-video-nvidia-devel-32bit \
    nvidia-compute-devel-32bit
    
  10. At this point, you might reboot to test that the 'nvidia' driver really is installed and running. Try lsmod | grep nvidia, lsmod | grep nouveau, and glxgears.
  11. Install the "dkms-bbswitch" and "bumblebee" packages:
    # zypper install dkms-bbswitch
    # zypper install bumblebee
    
  12. Here's what I see at this point:
    # zypper info bumblebee    
    ...
    Repository: home:Overman79
    Name: bumblebee
    Version: 3.0.1-16.1
    Arch: x86_64
    ....
    # zypper info dkms-bbswitch
    ...
    Repository: home:Overman79
    Name: dkms-bbswitch
    Version: 0.5-2.1
    Arch: noarch
    ...
  13. Activate the "bumblebeed.service":
    # systemctl enable bumblebeed.service
    # systemctl start bumblebeed.service
    
  14. Reboot one more time, and try this:
    # lsmod | grep nvidia
    # lsmod | grep i915
    i915                  505525  4 
    drm_kms_helper         51052  1 i915
    drm                   272508  5 i915,drm_kms_helper
    i2c_algo_bit           13413  1 i915
    video                  19345  1 i915
    button                 13906  1 i915
    # lsmod | grep bbswitch
    bbswitch               13708  0 
    # # systemctl status bumblebeed.service
    bumblebeed.service - Bumblebee C Daemon
      Loaded: loaded (/usr/lib/systemd/system/bumblebeed.service; disabled)
      Active: active (running) since Mon, 28 Jan 2013 12:56:52 +0100; 4h 0min ago
    Main PID: 3548 (bumblebeed)
      CGroup: name=systemd:/system/bumblebeed.service
              └ 3548 /usr/sbin/bumblebeed
    
    Jan 28 12:56:52 wilbur bumblebeed[3548]: [  725.806621] [INFO]
    /usr/sbin/bumblebeed 3.0.1 started
    
  15. Read about the 'bbswitch' module -- this is really important:

    https://github.com/Bumblebee-Project/bbswitch
  16. Look at /var/log/messages and search for 'bbswitch':
    bbswitch: version 0.5
    bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.VID_
    bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.VID_
    bbswitch: detected an Optimus _DSM function
    bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
    bbswitch: disabling discrete graphics
    
  17. See if discrete graphics is enabled or disabled:
    # cat /proc/acpi/bbswitch  
    0000:01:00.0 ON
    
  18. Test the setup further:
    $ optirun glxspheres
    
    ... while waiting for the spheres to appear, start another terminal ...
    
    $ lsmod | grep nvidia
    nvidia          9385442  40
    $ sudo cat /var/log/messages | grep bbswitch
    
    ... notice that the last log entry shown is "bbswitch: enabling 
        discrete graphics" ...
    
  19. Another way to see the current status of the discrete graphics adapter:
    $ optirun --status
    
  20. Stop the test by pressing CTRL-C in the glxspheres window. After that, try lsmod | grep nvidia again and notice that the module has been switched back out.
  21. Submit bug reports concerning this documentation to me :-)
9.3.2013: oapeter asked some questions over on the forums regarding Bumblebee on openSUSE 12.2:
  • Q. I also see several options on software.opensuse.org for version 3.x. Is using one of these a better option?
    A. Yes, I believe version 3.x is a better option, though I have not tested version 2.x extensively.
  • Q. After bumblebee is installed and running, can I then install any of the drivers from the Nvidia repository? or do I need to get drivers from a specific place?
    A. The way I did it (see above), I installed the nvidia drivers first, and bumblebee second. Bumblebee seems to want to have nvidia installed and running before it will start.
  • Q. Is it possible to uninstall bumblebee afterward if things go wrong?
    A. Well, I don't know what you mean by things going wrong, but you can always remove ("zypper remove ...") all the nvidia and bumblebee-related packages if you like.
Miscellaneous notes: There's a nice Bumblebee/Optimus page over on the Russian-language opensuse.org. Here's a machine translation of same.

External links:

1 comment:

  1. a thumbs up; the Overman repository has changed to
    http://download.opensuse.org/repositories/home:/Overman79:/Laptop/openSUSE_12.2/

    Also, could you do a piece on primus as well and maybe using it for 'steam'...

    Great info though! thanks a lot...

    ReplyDelete