bumblebee needs configuration changes to work with nvidia-driver-390 and libglvnd0

Bug #1758243 reported by Rocko on 2018-03-23
176
This bug affects 36 people
Affects Status Importance Assigned to Milestone
bumblebee (Ubuntu)
Undecided
Unassigned

Bug Description

bumblebee fails to work in Ubuntu 18.04 with nvidia-driver-390 unless these configuration changes are made:

1. For optirun to work, /etc/bumblebee/bumblebee.conf needs two library paths changed (because of the changes for GLVND):

[driver-nvidia]
LibraryPath=/usr/lib/x86_64-linux-gnu:/usr/lib/i386-linux-gnu
XorgModulePath=/usr/lib/x86_64-linux-gnu/nvidia/xorg,/usr/lib/xorg/modules,/usr/lib/xorg/modules/input

With these changes, optirun works correctly on my laptop (using the primus bridge) but primusrun still fails.

2. For power management to work (ie turning the nvidia card off whilst not in use), the nouveau and nvidia modules need blacklisting so they don't load on boot, and nvidia_drm and nvidia_modeset need aliasing to off so they never load. Otherwise, nvidia_drm attaches to drm_kms_helper and then bumblebee can't unload the nvidia module and turn off the card. This configuration file in /etc/modprobe.d/nvidia-bl.conf works for me:

blacklist nouveau
blacklist nvidia
blacklist nvidia_drm
blacklist nvidia_modeset
alias nouveau off
alias nvidia_drm off
alias nvidia_modeset off

(The first two lines are already in bumblebee.conf. I found I also had to alias nouveau to off because gdm?/mutter? so desperately wants to load it.)

Update: aliasing nouveau to off doesn't stop the nvidia-fallback service from loading the nouveau module, so if nouveau is still loading, you could try running this command:

systemctl disable nvidia-fallback.service

You'll need to reboot because nouveau is already loaded, but the change should be permanent unless something else re-enables the nvidia-fallback service.

Finally, to run mesa applications, you need to set this variable:

export __GLVND_DISALLOW_PATCHING=1

ProblemType: Bug
DistroRelease: Ubuntu 18.04
Package: bumblebee 3.2.1-17
Uname: Linux 4.16.0-041600rc6-generic x86_64
ApportVersion: 2.20.8-0ubuntu10
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Fri Mar 23 12:18:02 2018
InstallationDate: Installed on 2017-08-16 (218 days ago)
InstallationMedia: Ubuntu 17.04 "Zesty Zapus" - Release amd64 (20170412)
SourcePackage: bumblebee
UpgradeStatus: Upgraded to bionic on 2017-11-17 (125 days ago)
modified.conffile..etc.bumblebee.xorg.conf.nouveau: [modified]
modified.conffile..etc.bumblebee.xorg.conf.nvidia: [modified]
mtime.conffile..etc.bumblebee.bumblebee.conf: 2018-03-23T12:17:54.683287
mtime.conffile..etc.bumblebee.xorg.conf.nouveau: 2018-03-22T14:01:52.732698
mtime.conffile..etc.bumblebee.xorg.conf.nvidia: 2018-03-22T14:57:34.141995

Rocko (rockorequin) wrote :
description: updated
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in bumblebee (Ubuntu):
status: New → Confirmed
Roman Dinga (roman-dinga) wrote :

For me it doesn't work even with setting all the stuff mentioned here. Neither with intalling nvidia-prime, which sets different blacklisting. The error is that Nvidia GPU could not be found.

Rocko (rockorequin) wrote :

@Roman: it might be the systemd nvidia-fallback, which loads nouveau if the nvidia driver isn't loaded. I'm seeing this problem now even with my 'alias nouveau off' setting:

$ systemctl status nvidia-fallback.service
● nvidia-fallback.service - Fall back on nouveau if nvidia is not loaded
   Loaded: loaded (/lib/systemd/system/nvidia-fallback.service; enabled; vendor preset: enabled)
   Active: active (exited) since Wed 2018-04-25 08:47:30 AWST; 16min ago
  Process: 1013 ExecStart=/sbin/modprobe nouveau --config / (code=exited, status=0/SUCCESS)
 Main PID: 1013 (code=exited, status=0/SUCCESS)

Apr 25 08:47:29 xps15-9560 systemd[1]: Starting Fall back on nouveau if nvidia is not loaded...
Apr 25 08:47:30 xps15-9560 systemd[1]: Started Fall back on nouveau if nvidia is not loaded.

You could try doing:

systemctl disable nvidia-fallback.service

and rebooting to see if that fixes the problem.

Rocko (rockorequin) on 2018-04-25
description: updated
Juan Montero (jjmonrod) wrote :

This solution worked for me, but I had to manually install nvidia-dkms-390.
I think bumblebee-nvidia should pull in this package automatically.

My steps were:
1. apt purge nvidia* bumblebee*
2. apt install bumblebee-nvidia nvidia-dkms-390
3. edit the config file exactly as provided by Rocko in post #1
4. create the blacklist file accordingly
5. disable nvidia-fallback

After reboot, optirun works.

Juan Montero (jjmonrod) wrote :

Update: both optirun and primusrun crash when trying to load openGL.

They work as expected for non-opengl apps:
('optirun screenfetch' and 'primusrun screenfetch' both work and show the GPU correctly!)

-----------------------------
Output of 'optirun glxgears':
-----------------------------
X Error of failed request: BadMatch (invalid parameter attributes)
  Major opcode of failed request: 155 (GLX)
  Minor opcode of failed request: 11 (X_GLXSwapBuffers)
  Serial number of failed request: 37
  Current serial number in output stream: 38
primus: warning: dropping a frame to avoid deadlock
primus: warning: timeout waiting for display worker
terminate called without an active exception

-----------------------------
Output of primusrun glxgears:
-----------------------------
/usr/bin/primusrun: line 41: warning: command substitution: ignored null byte in input
primus: fatal: failed to load any of the libraries: /usr/lib/x86_64-linux-gnu/mesa/libGL.so.1
/usr/lib/x86_64-linux-gnu/mesa/libGL.so.1: cannot open shared object file: No such file or directory

This happens even after installing the full nvidia-driver-390 package (which includes nvidia-prime) and repeating all the steps mentioned in post #1.

Which package provides this openGL library and where is it located? Am I missing a symlink or a path?

Roman Dinga (roman-dinga) wrote :

@Rocko: unfortunately it didn't work. I've also tried the 5 commands by Juan Montero (purge and then reinstall), but it didn't help. Any idea what can be wrong?

Rocko (rockorequin) wrote :

@Roman: I don't know what might be wrong. You might be able to get more information with the command "systemctl status bumblebeed.service". Also, you could try "tail -f /var/log/syslog" in one terminal before running "optirun glxinfo" in another and check back on the tail output afterwards. "journalctl -e" might also have some relevant info.

Juan Montero (jjmonrod) wrote :
Download full text (51.9 KiB)

Sorry for the length of this post, I don't know how to attach multiple files.
I am pasting the output of the following commands:

----------------------------------------------------------
$ systemctl status nvidia-fallback.service
----------------------------------------------------------
● nvidia-fallback.service - Fall back on nouveau if nvidia is not loaded
   Loaded: loaded (/lib/systemd/system/nvidia-fallback.service; disabled; vendor preset: enabled)
   Active: inactive (dead)

----------------------------------------------------------
$ systemctl status bumblebeed.service
----------------------------------------------------------
● bumblebeed.service - Bumblebee C Daemon
   Loaded: loaded (/lib/systemd/system/bumblebeed.service; enabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-05-01 11:39:50 CEST; 3min 11s ago
 Main PID: 727 (bumblebeed)
    Tasks: 1 (limit: 4915)
   CGroup: /system.slice/bumblebeed.service
           └─727 /usr/sbin/bumblebeed

Mai 01 11:39:50 vesper bumblebeed[727]: [ 4.231860] [INFO]/usr/sbin/bumblebeed 3.2.1 started
Mai 01 11:39:50 vesper systemd[1]: Started Bumblebee C Daemon.
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816309] [WARN][XORG] (WW) Warning, couldn't open module mouse
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816321] [ERROR][XORG] (EE) Failed to load module "mouse" (module does not exist, 0)
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816331] [WARN][XORG] (WW) NVIDIA(0): Unable to get display device for DPI computation.
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816335] [WARN][XORG] (WW) NVIDIA(0): Option "NoLogo" is not used
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816340] [WARN][XORG] (WW) Warning, couldn't open module mouse
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816343] [ERROR][XORG] (EE) Failed to load module "mouse" (module does not exist, 0)
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816348] [ERROR][XORG] (EE) PreInit returned 2 for "<default pointer>"
Mai 01 11:40:21 vesper bumblebeed[727]: [ 34.816353] [ERROR][XORG] (EE) PreInit returned 2 for "<default keyboard>"

----------------------------------------------------------
$ tail -f /var/log/syslog (difference before and after optirun glxinfo)
----------------------------------------------------------
May 1 11:43:54 vesper kernel: [ 248.137858] bbswitch: enabling discrete graphics
May 1 11:43:54 vesper kernel: [ 248.253446] nvidia-nvlink: Nvlink Core is being initialized, major device number 241
May 1 11:43:54 vesper kernel: [ 248.253821] NVRM: loading NVIDIA UNIX x86_64 Kernel Module 390.48 Thu Mar 22 00:42:57 PDT 2018 (using threaded interrupts)
May 1 11:43:54 vesper systemd[1]: Starting NVIDIA Persistence Daemon...
May 1 11:43:54 vesper nvidia-persistenced: Verbose syslog connection opened
May 1 11:43:54 vesper nvidia-persistenced: Now running with user ID 121 and group ID 127
May 1 11:43:54 vesper nvidia-persistenced: Started (2166)
May 1 11:43:54 vesper nvidia-persistenced: Failed to query NVIDIA devices. Please ensure that the NVIDIA device files (/dev/nvidia*) exist, and that user 121 has read and write permissions for those files.
May 1 11:43:54 vesp...

Rocko (rockorequin) wrote :

@Juan: I should have suggested running just optirun glxinfo|grep 'server glx vendor'!

Your logs show that bumblebee is working fine - the nvidia module loads and the X server starts. I get the same nvidia-persistenced and error loading the mouse module as you, but my 3D wine apps are working fine in optirun.

I should have tried "optirun glxheads" like in your comment #6 first, because I get the same BadMatch error as you when I try to run OpenGL apps (the call to X_GLXSwapBuffers fails).

The comment from bluca here https://github.com/Bumblebee-Project/Bumblebee/issues/951#issuecomment-385242063 suggests that it might be a problem in libglvnd0, so we should open another bug for this.

Roman Dinga (roman-dinga) wrote :

Hi Rocko,

This is the error I get in syslog:
May 2 11:02:59 rocky kernel: [ 424.518174] bbswitch: enabling discrete graphics
May 2 11:02:59 rocky bumblebeed[770]: libkmod: ERROR ../libkmod/libkmod-module.c:832 kmod_module_insert_module: could not find module by name='off'
May 2 11:02:59 rocky bumblebeed[770]: [ 424.980461] [ERROR]Could not load GPU driver

I've checked the services, bumblebeed is active, nvidia-fallback is inactive. I think that there is some config issue somewhere since it states that module name "off" is unknown. But I don't know where to look.

Rocko (rockorequin) wrote :

@Roman: it sounds like bumblebee is trying to load a module that has been aliased to 'off' somewhere in your /etc/modprobe.d folder. Is the configuration in /etc/bumblebee/bumblebee.conf set to load nouveau, perhaps? Or has the nvidia module been aliased to off by accident?

Roman Dinga (roman-dinga) wrote :

OK, after installing a fresh copy of Ubuntu 18.04 and executing exactly the steps mentioned here I managed to get to a state where you are. Non-GL apps work with optirun, GL apps throw BadMatch (invalid parameter attributes) error. So I'll wait until the bug you opened is solved. Then we will see.

Edmond Shwayri (eshwayri) wrote :

I am at the same point as well with 18.04. OpenGL fails with the same error, while everything else seems to work as expected. I guess no Steam for me until this is fixed.

Roman Dinga (roman-dinga) wrote :

For me switching to Nvidia card using the Nvidia settings tool or prime-select works like a charm. Also when I set the kernel parameter nvidia-drm.modeset=1 I get a tear-free experience, which is excellent. So while this is not fixed, I can fully use the Nvidia card by switching to it entirely.

I can confirm as of today this bug is still present.
I made the changes suggested by Rocko. Still primusrun does not work properly.

JT (ajackofsometrades) wrote :

I have the exact same issue with the exact same error messages as the original post.

JT (ajackofsometrades) wrote :

Whoops, I meant to say that I have the exact same error messages as Juan in post #6 (https://bugs.launchpad.net/ubuntu/+source/bumblebee/+bug/1758243/comments/6)

Rocko (rockorequin) wrote :

From the attached bumblebee issue, carlicious recently posted that a fix for running Ubuntu apps other than wine is to set __GLVND_DISALLOW_PATCHING=1 (and this works for me - I tried running 0ad, glxheads).

description: updated
JT (ajackofsometrades) wrote :

Thanks, that solved it. I had a million tabs open, and I guess I missed that line late in his OP.

Juan Montero (jjmonrod) wrote :

The fix from post #20 solved the issue.
Now both glxgears and glxheads work.

Peter Curtis (pdcurtis) wrote :

I can confirm that the full procedure covered in #1 and #5 has worked for me once I added one addition change. I found a file in /etc/modprobe.d with the line "alias nvidia off" which prevented bumblebee from loading the nvidia module. It was in /etc/modprobe.d//blacklist-nvidia.conf which I believe is created by prime-select and remained although nvidia-prime had been purged. I commented out the line and restarted bumblebee with "sudo systemctl restart bumblebeed" and everything then worked.

these two lines is no longer necessary.

alias nvidia_drm off
alias nvidia_modeset off

fixes for drm device handling on systemd c238/239 is backported to systemd 237-3ubuntu10.2 (bug #1777099)
these fixes also help nvidia-xrun to unload nvidia, nvidia_uvm, nvidia_drm, and nvidia_modeset module

https://launchpad.net/ubuntu/bionic/+source/systemd/+changelog

JORGETECH (jorgetech) wrote :

I would recommend keeping the "nvidia_drm" and ”nvidia_modeset" aliases since removing them caused me problems (system freezes after running primusrun/optirun or loading the nvidia kernel module).

Rocko (rockorequin) wrote :

FWIW, I've found that optirun doesn't work in Ubuntu 18.10 - the nvidia module loads but as soon as the application tries to create a 3D window, the appliction exits - but primusrun does work, so long as you ensure the path to its libGL is correct, as per https://github.com/Bumblebee-Project/Bumblebee/issues/951#issuecomment-379512353:

eg PRIMUS_libGL=/usr/lib/x86_64-linux-gnu/libGL.so.1 primusrun 0ad

or I think you can also modify your primusrun file directly, as per https://github.com/Bumblebee-Project/Bumblebee/issues/951#issuecomment-412314114.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.