Tuesday, March 4, 2014

[SOLVED] NVIDIA - "Can't access Secondary GPU" with Bumblebee in Ubuntu 14.04 LTS

I recently installed Ubuntu 14.04 GNOME Beta1 on my Asus K55VM laptop with NVIDIA GeForce 630M graphics. Like the previous release (Ubuntu 13.10), the LTS version beta1 release also ships with nouveau drivers for NVIDIA. Now I encountered problems of laptop overheating as the hybrid graphics are always on, which I don't require.

Hence, the best option for me was to install bumblebee. I ran the following codes in the terminal to install bumblebee:
$ lspci | egrep 'VGA|3D'
To check your drivers if you are not sure of your graphic card.

In case NVIDIA is present, proceed with the following steps.

$ sudo add-apt-repository ppa:bumblebee/stable
$ sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic
$ sudo apt-get install bbswitch-dkms
$ sudo apt-get install mesa-utils

Post installation of all, I added myself to the bumblebee group.
$ sudo gpasswd -a arindam bumblebee

A reboot and after that I wanted to check if bumblebee was working or not.
$ optirun glxgears

I got error something like this:
[ERROR]Cannot access secondary GPU - error: [XORG] (EE) NVIDIA(0): Failed to initialize the NVIDIA GPU at PCI:1:0:0.
Please[ERROR]Aborting because fallback start is disabled.

Now I did a fair amount of research on it, trying to find out a solution. After a lot of trial and errors, here's the solution that worked for me.

Step 1: Download the nvidia-331-updates
$ sudo apt-get install nvidia-331-updates

Step 2: Once installed open the bumblebee configuration file
$ sudo gedit /etc/bumblebee/bumblebee.conf

I had gedit as my text editor and hence, put gedit there. In case you are using leafpad, replace gedit with leafpad. In case you don't know, simply use nano - sudo nano /etc/bumblebee/bumblebee.conf

Now edit to make it look exactly the same as mine for the section on nvidia.


# Configuration file for Bumblebee. Values should **not** be put between quotes

## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d

## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=auto
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false


# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
#         bbswitch - new in BB 3, recommended if available
#       switcheroo - vga_switcheroo method, use at your own risk
#             none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods

## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia-331-updates
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-331-updates:/usr/lib32/nvidia-331-updates
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-331-updates/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia


## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau

Once done, save it and reboot.

Now check optirun glxgears or optirun glxheads in terminal. You'll see the output shown below and withe optirun, glxgears and glxheads work 4 times faster than with Intel graphics. Also, my laptop stays ice cool even after using for 12-14 hours. I hope it helps those who are facing the same issue as I was facing.



35 comments:

  1. Ah -!

    `$optirun glxspheres64`

    250+ fps

    =)

    Thank you! I've been looking for this -!

    ReplyDelete
  2. Arindam I followed all your steps except installing mesa utils and bbswitch , however I am getting an error
    Unable to load drivers plz help.
    Regards

    ReplyDelete
    Replies
    1. Have you replaced the entire content of bumblebee.conf with the content I provided in the article? Mesa utils are to check if bumblebee is working and won't impact even if you don't install. But, I guess bbswitch will be required to switch between Intel and Nvidia graphics. Please check.

      Delete
  3. Replacing the entire bumblebee.conf file with what you have worked for me. Thanks I was going to give up and use windows for gaming.

    ReplyDelete
  4. Thank you very much, it worked excellent solution

    ReplyDelete
  5. Awesome! I was having the same issue and now it's resolved! Thanks so much!

    ReplyDelete
  6. After following all the steps bar none, I still get the same error: "[ERROR] Cannot access secondary GPU - error: Could not load driver
    [Error]Aborting because fallback start is disabled"

    Is there any way to diagnose why this still isn't working?

    Thank you

    ReplyDelete
    Replies
    1. lspci | egrep 'VGA|3D'
      00:02.0 VGA compatible controller: Intel Corporation 4th Gen Core Processor Integrated Graphics Controller (rev 06)
      01:00.0 3D controller: NVIDIA Corporation GK107M [GeForce GT 745M] (rev a1)

      Delete
    2. Have you replaced the entire content of bumblebee.conf with the text given here?

      Delete
    3. Yes I did :( Any other way around the issue?

      Delete
  7. I only got less than 60 fps while run
    $ optirun glxgears
    294 frames in 5.0 seconds = 58.746 FPS
    300 frames in 5.0 seconds = 59.987 FPS

    ReplyDelete
    Replies
    1. You can try glxspheres.

      From: http://www.upubuntu.com/2013/11/how-to-check-3d-acceleration-fps-in.html

      "Via the terminal, issue these commands:

      cd /tmp
      wget http://goo.gl/L7rsGZ -O virtualgl_2.3.3_amd64.deb
      sudo dpkg -i --force-depends virtualgl_2.3.3_amd64.deb
      sudo apt-get -f install

      Then run it with this command:

      /opt/VirtualGL/bin/glxspheres64"

      You can test Bumblebee by simply typing "optirun /opt/VirtualGL/bin/glxspheres64".

      Delete
    2. I agree, bumblebee doesn't work good with Ubuntu 14.04. I had a terrible experience with games. However, Nvidia Prime worked pretty good and to my satisfaction.

      Delete
  8. I have two questions.

    1. Is there any way to use Bumblebee on 14.04 with Nvidia 337 drivers?

    2. This is a little bit Off-Topic but what's the name of Interface/Theme on screenshots?

    ReplyDelete
    Replies
    1. I need to check for Nvidia 337 drivers. I'll keep you posted in this blog.
      The screenshot is from Ubuntu GNOME with some of the tweaks activated.

      Delete
  9. for this ERROR
    "[ERROR] Cannot access secondary GPU - error: Could not load driver
    [Error]Aborting because fallback start is disabled"

    i found solution here http://ubuntuforums.org/showthread.php?t=2043971

    ReplyDelete
  10. REALLY thanks!
    Work perfectly on Dell XPS 15 L502X!

    ReplyDelete
  11. thank you so much, works like charm in a N73SV Asus notebook

    ReplyDelete
  12. THANKS!!
    Works on ACER Aspire V3 571G

    ReplyDelete
  13. thanks dude
    its worked on my laptop Lenovo g400s

    ReplyDelete
  14. Will it break in next nvidia drivers updates?

    ReplyDelete
    Replies
    1. It should not break if you update the kerneldriver name and library path. Anyway, the best option is to install LDM and replace GDM in gnome distros and use Nvidia-Prime. Bumblebee performs pretty poor in Ubuntu compared to Arch Linux.

      Delete
    2. Hello Mr. Arindam, thanks for the great tutorial.
      I had tried this earlier in April with Ubuntu 14.04 and battery performance improved heavily after this on my Asus K55VM laptop.

      However, now after recent updates Nvidia prime v331.38 works well for graphics, tested with games on Steam.

      But, unfortunately the battery life is hardly 2 hours now and glxgears also show shows 60 fps.
      Still I didn't notice any issue with the graphics.

      Will you recommend me to switch to Bumblebee now to improve battery backup time? Or should we stick to Nvidia prime proprietary drivers only?

      Delete
    3. Hi Prateek:

      Nvidia Prime works pretty good with me on Kubuntu 14.04 and I get about 4 to 5 hours of battery life on Asus K55VM. Can you check if installing CPUfreq and TLP improves power usage or not? By the by, how is the laptop heat?

      Delete
  15. Nvidia Prime still works well in Ubuntu. I've noticed similar levels of temperature in both Windows 8.1 and Ubuntu 14.04. Temp ranges from 55 deg C to 72 deg C.
    CPUfreq helps by slightly controlling the CPU states using governors (used enough in Android) but doesn't contribute more than 30 minutes of battery time. The best can be 2 hour 40 mins. But earlier when bumblebee was configured in 13.04 battery times were indeed 4-5 hours.
    Surprisingly even Windows 8.1 gets me only 3 hours so I feel that my battery has degraded slightly, though power stats doesn't indicate the same.
    I'm afraid of using bumblebee again as it has disrupted my Elementary OS setup recently.

    ReplyDelete
  16. Hello. I followed exactly the same instructions (same package installation order and same bumblebeed.conf configuration).

    However, I am having issues. If I try to run with "optirun", I have errors like:

    sarroutbi@parsemad2:~$ optirun glxgears -info
    [ 1155.590905] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver

    [ 1155.590974] [ERROR]Aborting because fallback start is disabled.

    I get errors like next ones in "dmesg":

    [ 301.089086] nvidia: disagrees about version of symbol drm_pci_init
    [ 301.089093] nvidia: Unknown symbol drm_pci_init (err -22)
    [ 301.089191] nvidia: disagrees about version of symbol drm_gem_prime_handle_to_fd
    [ 301.089194] nvidia: Unknown symbol drm_gem_prime_handle_to_fd (err -22)
    [ 301.089233] nvidia: disagrees about version of symbol drm_gem_private_object_init
    [ 301.089235] nvidia: Unknown symbol drm_gem_private_object_init (err -22)
    [ 301.089382] nvidia: disagrees about version of symbol drm_gem_handle_create
    [ 301.089384] nvidia: Unknown symbol drm_gem_handle_create (err -22)
    [ 301.089490] nvidia: disagrees about version of symbol drm_pci_exit
    [ 301.089492] nvidia: Unknown symbol drm_pci_exit (err -22)
    [ 301.089544] nvidia: disagrees about version of symbol drm_gem_prime_export
    [ 301.089546] nvidia: Unknown symbol drm_gem_prime_export (err -22)

    Is anyone having same issues? Could you please post your kernel versions for comparing?

    Thanks.

    ReplyDelete
    Replies
    1. Yes, I have this issue too on my Lenovo ThinkPad E440 with Ubuntu 14.04 (kernel 3.13.0-34), NVIDIA GT740M :-(

      Delete
    2. I replaced the kernel from version 3.13.0.34 to version 3.14.1 and the driver began working. Kernel PPA with fresh kernels: http://kernel.ubuntu.com/~kernel-ppa/mainline/v3.14.1-trusty/

      Delete
  17. @arindam sen

    Dell Inspiron 17-5748

    Thanks very much for these instructions, they worked perfectly on my LinuxMint 17 Mate.
    (Linux 3.13.0-24-generic #46-Ubuntu SMP x86_64 GNU/Linux)

    ReplyDelete
  18. Thankyou bro, it works. (y) Lenovo G480

    ReplyDelete
  19. Works but I advise also taking a look at the boot settings. For my laptop (Dell 15z), edit grub:

    sudo gedit /etc/default/grub

    Remove or comment any instance similar to this one:

    GRUB_CMDLINE_LINUX="acpi=off"

    and replace with this:

    GRUB_CMDLINE_LINUX="acpi_backlight=vendor dell_laptop.backlight=0"

    or just:

    GRUB_CMDLINE_LINUX="acpi_backlight=vendor"

    depending on your laptop make and model.

    Save and close then run:

    sudo update-grub

    Then reboot

    Also, if you've tried a whole bunch of things before getting here I recommend purging existing nvidia installations:

    sudo apt-get remove --purge nvidia-*

    Do that before anything. If you don't then the install of nvidia-331-updates might fail.

    Good work arindam! :-)

    ReplyDelete
  20. Hello, I am getting a related error after following all of your instructions. However, there are no specific error messages after "Cannot access secondary GPU"...Anyone that could help?

    jared@hyperion:~$ optirun -vv glxgears
    [ 121.559131] [DEBUG]Reading file: /etc/bumblebee/bumblebee.conf
    [ 121.559477] [DEBUG]optirun version 3.2.1 starting...
    [ 121.559483] [DEBUG]Active configuration:
    [ 121.559485] [DEBUG] bumblebeed config file: /etc/bumblebee/bumblebee.conf
    [ 121.559487] [DEBUG] X display: :8
    [ 121.559489] [DEBUG] LD_LIBRARY_PATH: /usr/lib/nvidia-331-updates:/usr/lib32/nvidia-331-updates
    [ 121.559491] [DEBUG] Socket path: /var/run/bumblebee.socket
    [ 121.559493] [DEBUG] Accel/display bridge: auto
    [ 121.559494] [DEBUG] VGL Compression: proxy
    [ 121.559496] [DEBUG] VGLrun extra options:
    [ 121.559507] [DEBUG] Primus LD Path: /usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
    [ 121.559530] [DEBUG]Using auto-detected bridge primus
    [ 121.561473] [INFO]Response: No - error: [XORG] (EE)

    [ 121.561482] [ERROR]Cannot access secondary GPU - error: [XORG] (EE)

    [ 121.561485] [DEBUG]Socket closed.
    [ 121.561494] [ERROR]Aborting because fallback start is disabled.
    [ 121.561497] [DEBUG]Killing all remaining processes.

    ReplyDelete
  21. Worked perfectly on elementary OS Freya (Ubuntu 12.04) with Intel/Nvidia Geforce GT 650M. I also recommend installing bumblebee-indicator.

    Thanks :)!

    ReplyDelete
  22. Thanks for this informative stuff. I was looking for information something like this. I have bookmarked your blog.
    graphics card prices

    ReplyDelete