You are not logged in.

#1 2017-08-10 19:56:47

Bollie
Member
Registered: 2017-08-10
Posts: 6

[Solved] gnome vs. bbswitch

Hello there,

I have a setup, that uses X11, gnome/gdm, nvidia-module, and bumblebee with bbswitch. Until recently, everything worked fine. Starting bumblebee would switch off the nvidia GPU and using optirun would switch it back on for usage. However, after some recent update, I noticed that something loaded the module "nvidia", which kept blocking bumblebee from switching off the GPU:

Aug 13 10:12:14 malamute systemd[1]: Started GNOME Display Manager.
Aug 13 10:12:14 malamute systemd[1]: Reached target Graphical Interface.
Aug 13 10:12:14 malamute dbus[711]: [system] Activating via systemd: service name='org.freedesktop.PolicyKit1' unit='polkit.service'
Aug 13 10:12:15 malamute gnome-session[801]: gnome-session-binary[801]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
Aug 13 10:12:15 malamute gnome-session-binary[801]: WARNING: Could not parse desktop file orca-autostart.desktop or it references a not found TryExec binary
Aug 13 10:12:15 malamute dbus[711]: [system] Rejected send message, 0 matched rules; type="error", sender=":1.1" (uid=0 pid=712 comm="/usr/lib/systemd/systemd-logind ") interface="(unset)" member="(unset)" error
Aug 13 10:12:15 malamute dbus[711]: [system] Activating via systemd: service name='org.freedesktop.UPower' unit='upower.service'
Aug 13 10:12:15 malamute systemd[1]: Starting Daemon for power management...
Aug 13 10:12:15 malamute dbus[711]: [system] Successfully activated service 'org.freedesktop.UPower'
Aug 13 10:12:15 malamute systemd[1]: Started Daemon for power management.
Aug 13 10:12:15 malamute tlp[747]: Applying power save settings...done.
Aug 13 10:12:15 malamute kernel: acpi_call: Cannot get handle: Error: AE_NOT_FOUND
Aug 13 10:12:15 malamute kernel: acpi_call: Cannot get handle: Error: AE_NOT_FOUND
Aug 13 10:12:15 malamute tlp[747]: Setting battery charge thresholds...done.
Aug 13 10:12:15 malamute systemd[1]: Started TLP system startup/shutdown.
Aug 13 10:12:15 malamute systemd[1]: Startup finished in 16.872s (kernel) + 16.293s (userspace) = 33.165s.
Aug 13 10:12:15 malamute kernel: nvidia: module license 'NVIDIA' taints kernel.
Aug 13 10:12:15 malamute kernel: Disabling lock debugging due to kernel taint
Aug 13 10:12:15 malamute kernel: nvidia-nvlink: Nvlink Core is being initialized, major device number 242
Aug 13 10:12:15 malamute kernel: NVRM: loading NVIDIA UNIX x86_64 Kernel Module  384.59  Wed Jul 19 23:53:34 PDT 2017 (using threaded interrupts)

Subsequently starting the bumblebee daemon leads to following message:

Aug 13 10:13:01 malamute kernel: bbswitch: version 0.8
Aug 13 10:13:01 malamute kernel: bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
Aug 13 10:13:01 malamute kernel: bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
Aug 13 10:13:01 malamute kernel: ACPI Warning: \_SB.PCI0.PEG0.PEGP._DSM: Argument #4 type mismatch - Found [Buffer], ACPI requires [Package] (20170303/nsarguments-95)
Aug 13 10:13:01 malamute kernel: bbswitch: detected an Optimus _DSM function
Aug 13 10:13:01 malamute kernel: bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on
Aug 13 10:13:01 malamute bumblebeed[1630]: [   79.937748] [INFO]/usr/bin/bumblebeed 3.2.1 started

bumblebee has set in the config:

PMMethod=bbswitch

Trying to manually disabling the nvidia by using sudo tee /proc/acpi/bbswitch <<< OFF
leads to this error message:

[  864.342811] bbswitch: device 0000:01:00.0 is in use by driver 'nvidia', refusing OFF

And here's why:

lsmod | grep nvidia
nvidia              12972032  12

So the question is: What has changed in recent updates that causes nvidia to be loaded? How can I find out what is loading it? gdm runs with wayland here. Switching to X doesn't change a thing, even when I configure X to not audo add GPUs. Here's what I tried:

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
    Option        "AutoAddGPU" "false"
EndSection

Section "Files"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "/usr/share/fonts/misc/"
    FontPath     "/usr/share/fonts/TTF/"
    FontPath     "/usr/share/fonts/OTF/"
    FontPath     "/usr/share/fonts/Type1/"
    FontPath     "/usr/share/fonts/100dpi/"
    FontPath     "/usr/share/fonts/75dpi/"
EndSection

Section "Module"
    Load  "glx"
EndSection

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option        "Protocol" "auto"
    Option        "Device" "/dev/input/mice"
    Option        "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
    Identifier   "Monitor0"
    VendorName   "Monitor Vendor"
    ModelName    "Monitor Model"
EndSection

Section "Device"
        Option     "Accel"                  "on"
        Option     "AccelMethod"            "SNA"
    Identifier  "Card0"
    Driver      "intel"
    BusID       "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    SubSection "Display"
        Depth     24
    EndSubSection
EndSection



Cheers
Bollie

Last edited by Bollie (2017-09-06 21:09:11)

Offline

#2 2017-08-10 20:33:14

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [Solved] gnome vs. bbswitch

Read your journal.

Please also edit your post to make the title more descriptive of your actual issue: https://wiki.archlinux.org/index.php/Co … ow_to_post

Moving to NC...


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#3 2017-08-16 06:37:49

Bollie
Member
Registered: 2017-08-10
Posts: 6

Re: [Solved] gnome vs. bbswitch

Ok, I went back ten years. I kept the xorg-conf from my first post (AutoAddGPU "false"), that just uses the intel driver, and put this into my ~/.xinitrc:

exec startxfce4

Now, when I do a startx and when xfce is running, there's no nvidia module loaded.

However, when my .xinitrc looks like this:

exec gnome-session

...and do an lsmod after gnome is up, something has loaded the nvidia kernel module.

Here's gnome-sessions startup sequence from my journal: https://ca9.eu/paste/?8b705df5df30a5d6# … XAj1OADBE=

Has anyone an idea, what causes loading the module during gnome-session startup?

Cheers
Bollie

Offline

#4 2017-08-16 08:31:13

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: [Solved] gnome vs. bbswitch

GNOME has added some support for allowing to run on a discrete GPU setup in 3.24. And from what I gather it will simply force the use of the nvidia GPU unconditionally (given that the X setup uses glvnd, which is the case with the Arch packages, don't know what you'd have to do to explicitly tell GNOME to ignore that) if it detects the proprietary driver (and allow use of a one click stop gap to use PRIME with nouveau) with work in the future to properly and without bumblebee support GPU switching.


http://hansdegoede.livejournal.com/16668.html
https://blogs.gnome.org/uraeus/2017/06/ … nd-beyond/

That said, is there any reason you aren't just enabling the bumblebeed.service? If you did I'd assume it would start before GNOME and potentially inhibit GNOME's behaviour by force.

For clarity, your order of events is wrong: The nvidia module is loaded by default, because the kernel detects the hardware -> you start gnome-session -> gnome-session detects nvidia provider and initializes rendering on it -> you start bumblebee, which invokes bbswitch -> bbswitch tries to unload the module, can't do so because the nvidia card is actively being used.

Gnome doesn't have the power to load your module, it's simply what the kernel does by default. Which is why I think that above suggestion will allow to sort out the issue, since I don't think GNOME will initialize rendering if it doesn't have an already loaded nvidia found. But you'd have to check

Mod note: Please use[ code ] not [ quote ] tags when pasting command outputs.

Also your pastebin link seems to be broken.

Last edited by V1del (2017-08-16 08:51:08)

Offline

#5 2017-08-16 09:52:13

Bollie
Member
Registered: 2017-08-10
Posts: 6

Re: [Solved] gnome vs. bbswitch

Thank you for your quick reply. Yeah, starting bumblebee after gnome results out of laziness... Because last year, at some point, my laptop kept crashing when X/gnome started while bumblebeed was already running and had switched the discrete card off. I assume, that GPU discovery and/or loading the nvidia module results in that crash whenever the discrete card is switched off. With my current setup (AutoAddGPU false in xorg.conf) and xfce4 it's not an issue, though if I put exec gnome-session into my .xinitrc, like mentioned above, it crashes.

I will later today check if modprobe nvidia after bumblebee has turned the card of leads to a crash as well.

My pastebin link isn't broken. It just relies on a browser being capable of decrypting AES. For convenience: https://paste.debian.net/hidden/7edbda40/ (yes, debian, arch pastebin seems to be broken. wink )

I will give starting bumblebee before gnome-session another try tonight and post more detailed result. Although that crash doesn't seemd to give logging enough time to flush the lines onto the disk.

Cheers
Bollie

Offline

#6 2017-08-16 11:29:26

Bollie
Member
Registered: 2017-08-10
Posts: 6

Re: [Solved] gnome vs. bbswitch

I've found this: https://bugzilla.gnome.org/show_bug.cgi?id=768308

This describes exactly my issue. I'm gonna comment on that ticket and we'll see what will happen. wink

Offline

#7 2017-08-16 11:33:49

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,425

Re: [Solved] gnome vs. bbswitch

Ah likely my work network then, we have a wonky proxy. But yeah the xorg.conf shouldn't be relevant on anything that isn't gnome, since afaik none of the other DE's try to be as intelligent, for better or worse. And in addition to that there's a good chance that gnome once again  has a completely different spot where they look for configurations of X because why not.

Edit: Just saw your addition while writing. If your system freezes when bbswitch tries to poweroff the device, it might also be powermanagement kicking in. But the current default config of TLP should correctly disable the kernel's explicit power management so that bbswitch can turn the card off. Do you have any unmerged .pacnew files of your TLP config? In particular make sure that nvidia is on the power management blacklist of TLP

Offline

#8 2017-08-16 11:48:55

Bollie
Member
Registered: 2017-08-10
Posts: 6

Re: [Solved] gnome vs. bbswitch

V1del wrote:

A If your system freezes when bbswitch tries to poweroff the device, it might also be powermanagement kicking in.

No, that part works just fine. Not bbswitch is causing the hang, but whatever tries to load (or have the kernel load) the nvidia module while the card is in the "switched off"-state.

Last edited by Bollie (2017-08-16 11:49:34)

Offline

#9 2017-09-06 21:08:11

Bollie
Member
Registered: 2017-08-10
Posts: 6

Re: [Solved] gnome vs. bbswitch

I've found a solution, that at least helps with my MSI GE62 6QC.

Posted the results here:

https://github.com/Bumblebee-Project/bb … -327611794

Now, bumblebeed can be started before gdm/gnome3 and disables the card and X, gdm and gnome3 come up without trying to have the nvidia module loaded.

Everything's fine now. smile

Offline

Board footer

Powered by FluxBB