so for the past 4 years or so, i've had the darnedest time trying to get bumblebee to function 100% on gentoo, it's literally forcing me to stay put on arch all this time.

the problem has persisted all this time, it'll show random errors, mouse, font, no screen, wrong module loaded.. anything you can think of, i've had bumblebeed's log yell at me about, so yesterday i decided to compile a new system and give it a go, same thing were happening, i spent 30 hours researching the latests posts circa 2012 till now, lots of people had similar issues, lots of aforementioned fixes, made a custom xorg.conf.nvidia... added a line to grub.conf, the end result which i'm now sitting on is about 90% functionality, in that power savings provided by bbswitch are working, the card is shutoff when not in use which was most of my concern anyway.. but hey who likes to have a gpu that doesnt work when you want it to.

soo doing that changed nothing, bbswitch/bumblebee powersaving functionality is a go, however actually running anything on the card.. not so good.

does anyone have a current gentoo install with all latest main branch kernel/bumblebee/nvidia drivers running like a charm? if so post here so i can be mad.

:::::::::::FIXED::::::::::

dont know exactly, what changed because i tried 2 previous times but, added i915 nvidia bbswitch to modules in that order (apparently if bbswitch loads first it may be an issue with nvidia) then recompiled kernel(if you use genkernel make sure to atleast use menuconfig to check if noveau is supported and remove it)and initramfs, rebooted, and now optirun is successful.

now it'll run and all will be well and functioning, it's just that msg, also if i try to add vgl to modules/rc-update add.. the system will hang on starting VirtualGL, nothing will be loaded after that and i have to chroot into the system to del from runlevel.

on 232 he modified /etc/conf.d/vgl.. but it's pertaining to un-commenting an entry dealing with lightDM which i do not use.. so i'm not sure about that.. for him doing that caused bumblebee to not start.. then on post 234 he configured bumblebee to run with no pid effectively making it functional again, now his vgl is loaded at runlevel and the system doesnt need to be chrooted.

i'm just confused because i dont understand what's causing it still, because this sounds like different cause but same effect in which case if i did what he did the effect might remain and or bloom into a bigger problem.

i also read that because bumblebee cannot function without vgl..which means if bumblebee and optirun are working inturn that means vgl is working despite the log, that it's not that vgl didnt start it's just that it didnt return the init process or something.

anyway no rush.. it's not a big deal as it seems all is well anyway plus i just cant wrap my brain around it right now too much going on at work, let me know if any ideas come to mind.

I use KDM installed by KDE. I sometimes use LightDM when I'm booting into LXQt which I also have installed. I am currently in the process of replacing both with SDDM. As far as I can remember I haven't had those problems with any of the display managers but I don't tend to run stuff that requires vgl from LXQt.

Bumblebee contains a kernel module, bbswitch, which is used to switch the nVidia card on and off. On my system, at boot, it is on, so bumblebee switches it off when it is started. The optirun command switches the nVidia card on, starts an Xorg server on it, then runs the program given to it using the Xorg bound to the nVidia card and a "GL bridge", then stops the Xorg server and switches the nVidia card off again. The GL bridge allows the program to render to an Xorg server running on the nVidia card, then copies the results into the Intel card's framebuffer for it to display. Bumblebee works with two GL bridges: VirtualGL (in portage) and primus (available in an overlay).

The VirtualGL bridge requires the xauth key to be able to write into the Xorg-on-the-Intel-card's framebuffer (I think). The error message says that it is unable to parse the key from the xauth file. My first question would be, does the file exist at the correct location? Have you tried running the xauth command from the initscript by yourself to see if there is an error?

as i said, everything is rock solid on this end aswell, everything works with optirun it's just the log entry with no impact on system.. or atleast functionality wise i cant see any problems.

my /etc/conf.d/vgl is default stock with no changes, same with the init.d/vgl... i use LXDM at the moment to launch kde, previously i just startxfce4.. both work properly although i'll say i haven't tried to optirun anything in xfce4..i could later to see if the xauth msg also appears in term's there.

but.. as for var/lib/VirtualGL/vgl_xauth_key... file does not exist... i think i recall reading somewhere in that thread i posted that the guys was located elsewhere.

i cant add bumblebee to default because during boot it loads vgl which causes the same hang to happen as if i just added vgl to the runlevel, i have to run bumblebeed postboot to get it up and running.

also i dont have primus installed i've always just used optirun... guess i been out of the loop for a minute.

--update, ok so i installed primus.. it doesnt give me the xauth message.... probably because it passes things differently then optirun i'm thinking... but im just going to go with it... no reason to break what isn't broken.

ohai, thread about bumblebee that comes up right as I can't get bumblebee to work!
(home you don't mind my jumping in)

So: what's the good way to get bumblebee installed? I have a brand-new MSI MP-72, with Optimus, and I can't get X to start. If I run 'lightdm' it spits out what looks like a core dump, the log says nothing after loading xorg.conf, and I get no X. *sadface*

What's a good guide for getting it working? All I see are guides from, like, 2013.

--update, ok so i installed primus.. it doesnt give me the xauth message.... probably because it passes things differently then optirun i'm thinking... but im just going to go with it... no reason to break what isn't broken.

Mind walking me through what you did there? I have a working bumblebee setup with virtualGL but am thinking of replacing the virtualGL part with primus because virtualGL is slow for games and links against OpenSSL.

One of the main reasons for optimus is having a more powerful graphics card than can be enabled on demand and not suck up power when it isn't being used, but if all the performance gained is lost using a slow bridge then what's the point (other than having more features than an integrated card like CUDA and OpenGL 4.2)? VirtualGL links against OpenSSL because it can transport OpenGL across network interfaces (one of the reasons it is slow - primus does everything in RAM AFAIK). This is a problem for me at the moment because steam statically links a different version of OpenSSL to the steam client, and anything using this (such as games run through optirun with virtualGL) crash.

What's a good guide for getting it working? All I see are guides from, like, 2013.

Not much has changed so those guides should still work. I followed the Bumblebee guide on the Arch wiki to get it working (but did so in 2013). One of these days I'll write down what I did and put it up on the Gentoo Wiki but I don't have much spare time right now.

EDIT -- I've found that the bumblebee repo on github is even older than that of primus! I suppose it would be hypocritical of me to continue to use bumblebee because primus is out of date (although they don't seem to have tagged any official releases).

--EDIT--
oh, I wrote the first line of xorg.conf as 'Sectio "ServerLayout"' (notice the missing 'n'). So that's why that puked. Now I see that it says "Could not find provider with name NVIDIA-0". How do I find the proper name of the provider?

--update, ok so i installed primus.. it doesnt give me the xauth message.... probably because it passes things differently then optirun i'm thinking... but im just going to go with it... no reason to break what isn't broken.

Mind walking me through what you did there?
.

i didnt do anything other than emerge primus. in bumblebee.conf you can switch the bridge entry to primus which i have not done yet.. because i think when you primusrun it automatically uses primus istead of virtualgl -- which is why i dont get the xauth message with it as opposed to optirun i believe. so i think if your .conf has auto in it for bridge optirun will use vgl as default, but when you primusrun, auto defaults to primus. so for you, just emerge primus, and primusrun something to see what's up. i'm thinking for primus use with good old optirun, just change the bridge method from auto to primus

(btw i dont use the one in the bumblebee overlay/git, just use the regular one from repod

Quote:

What's a good guide for getting it working? All I see are guides from, like, 2013.

Cheers,

EE

(jump to the lbottom for why i think your x wont start all stuff in between is bumblebee related)

well, there's not one guide currently that's going to give you all the details you need. the bumblebee info in the archwiki is great for the dependencies you need, when things didnt work correctly i googled up all the info i could.

but in theory everything should work out of the box(aside from modules). i'll try to walk you step by step of what i did (i just made this installation like last week) i'm going to have to wing it.

firstly i got xfce4 working.

so lets say your on a fresh install, no de or anything. first in your portage/make.conf add a line that says VIDEO="nvidia intel" also you can put vaapi into use if you want but it's not neccesary it has nothing to do with this, just a tip.

install your xf86-video-intel driver, libva,(libva-intel-driver ebuild is broken atm so avoid that), mesa, xorg-drivers and xorg-server, now install your DE, for the purposes of this rough walkthrough i suggest xfce4 as starting it is literally as simple as typing startxfce4.

now after that and you have a working desktop enviroment, install nvidia-drivers. after that do eselect opengl list, you should have 2 entries, nvidia and xorg-x11, set it to xorg-x11, eselect opencl list should only show one, nvidia.

now emerge bumblebee and bbswitch.

after both are installed, open /etc/bumblebee/bumblebee.conf, for the driver entry, type nvidia. save it and close.

add i915 nvidia bbswitch in that order to your /etc/conf.d/modules (you might have to blacklist the nouveau module). add your user to the bumblebee group (gpassword -a (user) -g bumblebee) now reboot, startxfce4 open a terminal as root or sudo bumblebeed, then from another terminal optirun glxgears -info, if all goes well it'll confirm your gpu is in use.

now i'm not saying this is the correct way to go about things, but it's what worked for me.

i think the reason why you cant get x started is because you mightve changed somthing like xorg.conf or xorg.conf.nvidia... something, because my de worked out of the box with no added attention, also i think i mightve adverted this issue your having by getting xfce4 up and running first and then getting bumblebee to work, the way you did it, installing bumblebee and nvidia first before you had a working de.. it might have changed the default conf file or something, not sure.

now remember, i didnt touch any xorg.conf.. for instance i dont even have an xorg.conf in my /etc/X11/ nor my /etc/X11/xorg.conf.d so i'm thinking thats where your problem is hiding.. i.e it's trying to read from something from a file that shouldnt even exist. --(not that it shouldnt exist ever, sometimes one is probably still needed, but i think nowadays xorg is setup to be compatible with most rigs out of the box with out modification)

Last edited by vilehost on Mon Feb 01, 2016 4:54 pm; edited 1 time in total

Otherwise bbswitch can no longer unload the nvidia drivers and turn the discrete card off.

vilehost wrote:

building without kms still causes you to manually kill the nvidia server after each useage of optirun/primus run with

Code:

rmmod nvidia_modeset
rmmod nvidia
kill (bumblebeed pid)
bumblebeed

What? Why? /etc/init.d/bumblebee is working on my system and optirun/primusrun work nicely and the card gets turned off automatically when the last application using it quits.

Nothing running using nvidia:

Code:

# /etc/init.d/bumblebee status
* status: started
# nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.
# cat /proc/acpi/bbswitch
0000:01:00.0 OFF

# nvidia-smi
NVIDIA-SMI has failed because it couldn't communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

# cat /proc/acpi/bbswitch
0000:01:00.0 OFF

See? The reason for bbswitch losing the possibility to turn the card off, was, at least on my systenm, the new nvidia-modeset module, which got autoloaded (pulling nvidia-uvm and nvidia in its wake) by the kernel on boot time. I blacklisted it, and all is well again.

Note: Blacklisting using kernel options in grub only means, that the kernel does not see the card and goes "Hey! Cool card on that PCI bus, Bro! Lemme activate it for ya!"_________________Important German:

"Aha" - German reaction to pretend that you are really interested while giving no f*ck.

"Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.

after adding the blacklist line to grub. have to manually rmmod and restart bb after using gpu. dont know. my nvidia-rmmod.conf is the same.
i rebuilt nvidia-drivers with kms to try aswell but still no go

one note of detail i suppose is the only thing that start/stops properly is bumblebee, init.d status will show it stopped when not running gpu, and started when something is being ran with opti/primusrun, then off again when i close the application, nvidia-smi will still show its loaded and bbswitch proc will still report :ON

Do not use rmmod. Use "modprobe -r". rmmod only tries to yank the module out, while "modprobe -r" honests the settings nvidia-rmmod.conf.

vilehost wrote:

one note of detail i suppose is the only thing that start/stops properly is bumblebee, init.d status will show it stopped when not running gpu, and started when something is being ran with opti/primusrun, then off again when i close the application, nvidia-smi will still show its loaded and bbswitch proc will still report :ON

Then there is something completely wrong. How I showed above is how it is supposed to work:

/etc/init.d/bumblebee always lists as "started"

When no application is using the nvidia gpu, its status must be OFF, no nvidia module is loaded, and nvidia-smi must error out.

When any application is started via optirun/primusrun, the bumblebee daemon does the following:

Tell bbswitch that the card is needed.

If the card is OFF, bbswitch turns it to ON and loads the nvidia module

optirun/primusrun use the bumblebee daemon to get a virtual server over the discrete card and run the application on it

Now bbswitch reports the card to be ON and nvidia-smi shows the status.

Once the application stops, the foolowing is happening:

The ending optirun/primusrun process tells the bumblebee daemon that its going bye-bye.

If no other application is running, the daemon asks bbswitch to turn off the card.

bbswitch unloads the nvidia module using "modprobe -r" (that's why the nvidia-rmmod.conf is so important!)

The reason I use the live ebuilds are the modprobe related issues that got fixed in the repository but not yet released.
And with app-portage/smart-live-rebuild maintaining live ebuilds is a piece of cake, so I do not bother so much.

I do hope there will be a bug fix release anytime soon. Bumblebee 3.2.1 is from 26 Apr 2013, so it would be about time, wouldn't it?

Important: Use the updated live ebuild for bumblebee from my overlay "seden". It uses the appropriate branch. The portage tree ebuild uses the master branch, which wasn't updated for three years. All development got into the develop branch. I have filed a bug report, but the ebuild isn't updated, yet.

However, even with the live ebuilds, you should check the following:

boot your machine

do not login to any DE

just switch back to your console if you are in a login manager

check with lsmod whether any nvidia module is loaded.

If any nvidia module is loaded, your blacklisting is not enough. You have pre-loaded the modules somewhere._________________Important German:

"Aha" - German reaction to pretend that you are really interested while giving no f*ck.

"Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.

i have no idea why init.d would be showing bumblebee as stopped when it is started, and it is working, power saving, optirun will show my proper card and driver being used it's 100% functional as far as that goes... so no idea there

the thing with rmmod is i have to use it since this nividia update because modprobe -r will spit out errors about no modules found...

maybe thats why adding the modprobe.blacklist line to grub and blacklist isnt doing anything for me? maybe i should change the nvidia-rmmod.conf file to use rmmod instead of modprobe -r? because when you say dont use rmmod use modprobe, maybe my machine is backwards somehow now.. because as said above i have to use rmmod manually because manually modprobe -r will just give errors about no nvidia-modeset found

aaaand nope, changing nvidia-rmmod.conf to use rmmod instead still yields same results.

also, i haven't used layman in a loong long time, prolly when i was testing sabyon in 2010.. the only way i remember to install a 3rd party ebuild is with doing the whole local overlay method, i have no idea how to pull it from an eix sync'd layman overlay, would i just mask the one in master the same way?

i have no idea why init.d would be showing bumblebee as stopped when it is started, and it is working, power saving, optirun will show my proper card and driver being used it's 100% functional as far as that goes... so no idea there

I assume this is because of the age of the stable ebuild.

vilehost wrote:

the thing with rmmod is i have to use it since this nividia update because modprobe -r will spit out errors about no modules found...

maybe thats why adding the modprobe.blacklist line to grub and blacklist isnt doing anything for me? maybe i should change the nvidia-rmmod.conf file to use rmmod instead of modprobe -r? because when you say dont use rmmod use modprobe, maybe my machine is backwards somehow now.. because as said above i have to use rmmod manually because manually modprobe -r will just give errors about no nvidia-modeset found

Hmmm... You have the same config as me, but you wrote that you disabled the "kms" USE Flag. I guess without that USE flag, nvidia-modeset isn't built. Then the line in /etc/modules.d/nvidia-rmmod.conf should read:

Code:

remove nvidia modprobe -r --ignore-remove nvidia-uvm nvidia

That said, the whole config is only needed to have nvidia-uvm (and nvidia-modeset) being removed by using "modprobe -r nvidia" instead of having to rmmod all two or three modules in the correct order.

I do not know how important the nivida-modeset module is these days. But could you please try again with enabled "kms" USE flag and the original line in nvidia-rmmod.conf?

No. None of these are in the development branch, yet. My ebuild only adds a patch to enable bumblebee to prefer nvidia-uvm if it is there. (UVM must be loaded first. It'll then pull in "nvidia-modeset" as a dependency, which will be followed by "nvidia")

I have commented in issue 719 already that autoloading the nvidia drivers by the kernel is the actual problem.

For systems like gentoo, where the user is in control and not some package maintainer of pre-built system parts, we can control the autoloading. However, for users, who can not really shut off all autoloading of the nvidia drivers, there must be some solution to get bumblebee running reliably for everyone.

We gentooers can work around the module dependency stuff and autoloading. But anyway, I'd prefer the system just to be emerged and then to be capable of handling autoloaded drivers itself, of course.

vilehost wrote:

also, i haven't used layman in a loong long time, prolly when i was testing sabyon in 2010.. the only way i remember to install a 3rd party ebuild is with doing the whole local overlay method, i have no idea how to pull it from an eix sync'd layman overlay, would i just mask the one in master the same way?

Layman is the easy method. These days it works with almost no need for user interference. See the wiki page for a howto. Its pretty easy, and the modern "emerge --sync" or "eix-sync" handle it well._________________Important German:

"Aha" - German reaction to pretend that you are really interested while giving no f*ck.

"Tja" - German reaction to the apocalypse, nuclear war, an alien invasion or no bread in the house.

I hope the bumblebee devs will get a new relase out soon. And that we'll get fresh and shiny ebuilds.

I hope so, nvidia driver stopped work for me from February 2016, and I waste last week to solve the problem... Time to go back to the future and again use bumblebee...

primusrun seems borked for me on only a single game. pillars of eternity. optirun though allows it to work fine._________________"My father rode a camel. I drive a car. My son flies a jet-plane. His son will ride a camel."
Saudi saying

I was wondering if users with working bumblebee setups might like to read over it and correct any mistakes they see as well as adding use-cases for particular hardware configurations as necessary.

Cheers,

Opafix

Very good stuff, I immensely appreciate the effort put into making that page I'm sure it will help people.

I only have one thing to add, I think if you optirun/primusrun steam, you might not need to go through each game adding optirun to the launch commands. I'm not certain though. iirc if you optirun steam, then just launch a game after it like normal, your nvidia-smi will show 2 things loaded on the card.