# Setting up Bumblebee

## reikdas

Following the guide to setup bumblebee - https://wiki.gentoo.org/wiki/NVIDIA/Bumblebee ,

How to know if I have my intel video card as i915 or i965? I have a fairly new CPU(i7 8750H) so according to the wiki I should have i965 but I remember having an issue while setting up xorg when I had to enable i915. Which do I add as a VIDEO_CARDS use flag? Both? If both, as 'intel i915 intel i965' or 'intel i915 i965'?Last edited by reikdas on Tue Jan 08, 2019 6:57 pm; edited 3 times in total

----------

## reikdas

Nvidia bumblebee does not work on my laptop because my external monitor is not accessible by my Intel iGPU. (The Intel iGPU does not have access to the HDMI port)

----------

## reikdas

According to the arch wiki page on my laptop - https://wiki.archlinux.org/index.php/MSI_GS65#Multihead the Intel GPU does have access to the thunderbolt port so I decided to give this another go. 

I followed the Bumblebee page on the wiki - https://wiki.gentoo.org/wiki/NVIDIA/Bumblebee

First I setup my Intel GPU following the guide here - https://wiki.gentoo.org/wiki/Intel . (Related forum post - https://forums.gentoo.org/viewtopic-t-1090942-highlight-.html)

I rebuilt nvidia-drivers using -uvm and -kms. 

I configured every file as given in the wiki. 

modprobe -r nvidia does not work.

```
reik-msi /home/reik # modprobe -r nvidia

modprobe: FATAL: Module nvidia is in use.

modprobe: FATAL: Error running remove command for nvidia
```

lsmod shows that nvidia is loaded.

cat /proc/acpi/bbswitch shows that bbswitch is ON.  

What should I do?

----------

## sao98021

 *reikdas wrote:*   

> According to the arch wiki page on my laptop - https://wiki.archlinux.org/index.php/MSI_GS65#Multihead the Intel GPU does have access to the thunderbolt port so I decided to give this another go. 
> 
> I followed the Bumblebee page on the wiki - https://wiki.gentoo.org/wiki/NVIDIA/Bumblebee
> 
> First I setup my Intel GPU following the guide here - https://wiki.gentoo.org/wiki/Intel . (Related forum post - https://forums.gentoo.org/viewtopic-t-1090942-highlight-.html)
> ...

 

/etc/modprobe.d/blacklist.conf

```
blacklist nvidia_modeset

blacklist nvidia_drm

blacklist nouveau
```

/etc/modprobe.d/nvidia-rmmod.conf

```
remove nvidia modprobe -r --ignore-remove nvidia-drm nvidia-modeset nvidia-uvm nvidia
```

reboot and sudo bumblebeed, optirun something, run nvidia-smi to verify card is loaded and on, close program re-run nvidia-smi to verify card is shut off by bumblebee

the only difference is i have bumblebee and primus built from seden overlay (9999-r3) and i build nvidia-driver with +kms and +uvmLast edited by sao98021 on Tue Jan 08, 2019 7:29 pm; edited 1 time in total

----------

## reikdas

 *sao98021 wrote:*   

>  and i build nvidia-driver with +kms and +uvm

 

I had nvidia-driver built with kms and uvm, but I disabled those and removed cuda and cuda support for my applications so I can get bumblebee support. I plan to add those back after bumblebee is working.

----------

## reikdas

 *sao98021 wrote:*   

> 
> 
> /etc/modprobe.d/blacklist.conf
> 
> ```
> ...

 

This did not let me boot into my display manager (lightdm). I could only use tty.

----------

## sao98021

 *reikdas wrote:*   

>  *sao98021 wrote:*   
> 
> /etc/modprobe.d/blacklist.conf
> 
> ```
> ...

 

odd, wonder if thats because... either its running nouveau or its loading the nvidia driver so to boot its depending on that display before letting bumblebee handle it, it's a pain in the ass to set up but once you do its worth it. I haven't had to mess with bumblebee since like dec 2017.

it's important to note that bumblebee 100% refused to work for me untill i used sources from seden overlay, definitely do that

----------

## sao98021

oh, by following the intel guide, did you make a .conf file in /etc/X11/xorg.conf.d ?

like with my build, i do not have one. and it falls back to /etc/bumblebee/xorg.conf.d/10-dummy.conf

which is how it's supposed to be done with bumblebee i believe, if you did make one just re-lable it so it isnt parsed, but with this - i'm not sure in how it would/could effect the fact that its thunderbolt, as in if gaining access to it requires custom things in a conf file not handled by bumblebees dummy-conf workaround.. would just cross fingers and try

----------

## reikdas

 *sao98021 wrote:*   

> odd, wonder if thats because... either its running nouveau or its loading the nvidia driver so to boot its depending on that display before letting bumblebee handle it

 

No, I do not have nouveau so it must be loading the nvidia driver at boot. 

Do I need to change any kernel modules to M instead of Y?

 *sao98021 wrote:*   

> oh, by following the intel guide, did you make a .conf file in /etc/X11/xorg.conf.d ?
> 
> like with my build, i do not have one. and it falls back to /etc/bumblebee/xorg.conf.d/10-dummy.conf
> 
> which is how it's supposed to be done with bumblebee i believe, if you did make one just re-lable it so it isnt parsed, but with this - i'm not sure in how it would/could effect the fact that its thunderbolt, as in if gaining access to it requires custom things in a conf file not handled by bumblebees dummy-conf workaround.. would just cross fingers and try

 

I have a 20-modesetting.conf file in /etc/X11/xorg.conf.d. Are you suggesting that I rename it and move it to /etc/bumblebee/xorg.conf.d/10-dummy.conf? Also, do I need to make any conf file changes so it falls back to the dummy conf file?

----------

## reikdas

Okay, so I got bumblebee set up such that it is working. But my external monitor is not working.

There is a solution for my issue which is given here - https://wiki.archlinux.org/index.php/bumblebee#Output_wired_to_the_NVIDIA_chip

But on trying this solution I get the error-

```
reik-msi /etc/bumblebee # intel-virtual-output

No VIRTUAL outputs on ":0".
```

There is a solution for this problem here - https://unix.stackexchange.com/questions/321151/do-not-manage-to-activate-hdmi-on-a-laptop-that-has-optimus-bumblebee

But having the intel.conf file makes my display glitch - But intel-virtual-output works.

intel-virtual-output does not work with modesetting.conf.

Additional info - 

Using bumblebee takes a lot of time to boot. (The login manager screen stays there for a couple of minutes)

I am having troubles switching back to optimus with the nvidia driver switched on always.

----------

## sao98021

 *reikdas wrote:*   

> 
> 
> I have a 20-modesetting.conf file in /etc/X11/xorg.conf.d. Are you suggesting that I rename it and move it to /etc/bumblebee/xorg.conf.d/10-dummy.conf? Also, do I need to make any conf file changes so it falls back to the dummy conf file?

 

suggesting that you get rid of it entirely, just rename it to .old, leave it where it is, 10-dummy.conf should be a blank file and should already be there as such, i think the prob you were having before is by having that + the file in your /x11/xorg.conf.d caused the collision, defaulted to that one resulting in refusal to load dm or bumblebee or both.

as for the other conf files after changing that one, the only thing i can think of is re-adding those blacklist lines into blacklist.conf that previously wouldnt let you get in aside tty when it was using 20-modesetting.conf in x11/xorg.conf.d instead of bumblebee/xorg.conf.d/10-dummy.conf

and change the line in /etc/bumblebee/bumblebee.conf to look like this 

```
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee

# server exits.

TurnCardOffAtExit=true
```

also your not starting your DM with optirun are you?

i'm not sure about the system taking a long time to boot, i load everything after boot, so as soon as i get into wm i run bumblebeed to prevent nvidia from burning the house down

so everything i run is being fed to the intel card, dm's screens everything, until i optirun say steam, or something.

so while nothing running = 

```
 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.

```

and while nvidia running =

```
  nvidia-smi

Wed Jan  9 09:41:06 2019       

+-----------------------------------------------------------------------------+

| NVIDIA-SMI 390.87                 Driver Version: 390.87                    |

|-------------------------------+----------------------+----------------------+

| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |

| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |

|===============================+======================+======================|

|   0  GeForce GT 540M     Off  | 00000000:01:00.0 N/A |                  N/A |

| N/A   44C    P0    N/A /  N/A |      5MiB /   964MiB |     N/A      Default |

+-------------------------------+----------------------+-------

```

and then back to the first message when i close program

(i use that old driver because nvidia stopped supporting my card apparently and every update since has stated 'there is a card on this system known to not work with this driver' resulting in me masking them)

its pretty noticeable when its not working because system will idle 20 degrees hotter, When i see temps like 55-65C compared to the norm 35-45 i go 'oh, the nvidia card is on.' So for me, looking at the temps is the best way to make sure i'm in the clear because nothing my machine will do by it self can result in that jump

im afraid thats basically all my experience can permit me to help, i've never used their intel-virt tool, or had to deal with thunderbolt so for info on that more fine tuned i dont think i can be of any help + i dont want to make things more confusing by stating uncertainties

----------

## reikdas

 *sao98021 wrote:*   

>  *reikdas wrote:*   
> 
> I have a 20-modesetting.conf file in /etc/X11/xorg.conf.d. Are you suggesting that I rename it and move it to /etc/bumblebee/xorg.conf.d/10-dummy.conf? Also, do I need to make any conf file changes so it falls back to the dummy conf file? 
> 
> suggesting that you get rid of it entirely, just rename it to .old, leave it where it is, 10-dummy.conf should be a blank file and should already be there as such, i think the prob you were having before is by having that + the file in your /x11/xorg.conf.d caused the collision, defaulted to that one resulting in refusal to load dm or bumblebee or both
> ...

 

Display is glitching. intel-virtual-output works. Keeping 20-modesetting.conf prevents the glitching but intel-virtual-output does not work. 

 *sao98021 wrote:*   

> also your not starting your DM with optirun are you?

 

How do I check this?

 *sao98021 wrote:*   

> [so everything i run is being fed to the intel card, dm's screens everything, until i optirun say steam, or something.
> 
> so while nothing running = 
> 
> ```
> ...

 

I am currently running just google chrome with this tab open. 

```
reik@reik-msi ~ $ nvidia-smi

Wed Jan  9 20:46:17 2019       

+-----------------------------------------------------------------------------+

| NVIDIA-SMI 415.18       Driver Version: 415.18       CUDA Version: 10.0     |

|-------------------------------+----------------------+----------------------+

| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |

| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |

|===============================+======================+======================|

|   0  GeForce GTX 107...  Off  | 00000000:01:00.0 Off |                  N/A |

| N/A   49C    P0    29W /  N/A |      0MiB /  8119MiB |      0%      Default |

+-------------------------------+----------------------+----------------------+

                                                                               

+-----------------------------------------------------------------------------+

| Processes:                                                       GPU Memory |

|  GPU       PID   Type   Process name                             Usage      |

|=============================================================================|

|  No running processes found                                                 |

+-----------------------------------------------------------------------------+
```

But, glxgears -info shows Intel and primusrun glxgears -info shows Nvidia so Bumblebee is working.

Now the only thing is (and very important) to get my external monitor working with Bumblebee.

----------

## reikdas

Some more information - 

When I am running an application with primusrun, my external monitor lights up and indicates that it is getting input via the HDMI port, but there is no display. This means that there should be a way to get my external monitor to work with bumblebee. 

These are some attached files if they help to debug -

/etc/init.d/bumblebee - https://paste.pound-python.org/show/HEHkfgXYVXaDpQ0OkOST/

/etc/bumblebee/bumblebee.conf - https://paste.pound-python.org/show/CbXd2iwmlheT4oiVU9Db/

/etc/conf.d/modules - https://paste.pound-python.org/show/QkgoODa2cHKGmb6ynrPt/

I am unable to do rmmod nvidia. 

This is my nvidia-rmmod conf - (I set it up with uvm and kms after first getting bumblebee to work as shown in the wiki)

```
reik@reik-msi /etc/modprobe.d $ cat nvidia-rmmod.conf

# Nvidia UVM support

remove nvidia modprobe -r --ignore-remove nvidia_drm nvidia_modeset nvidia_uvm nvidia
```

These are the errors I faced while trying to rmmod nvidia -

```
reik-msi /home/reik # rmmod nvidia

rmmod: ERROR: Module nvidia is in use

reik-msi /home/reik # rmmod nvidia_drm

rmmod: ERROR: Module nvidia_drm is not currently loaded

reik-msi /home/reik # rmmod nvidia_uvm

rmmod: ERROR: Module nvidia_uvm is not currently loaded

reik-msi /home/reik # rmmod nvidia_modeset

rmmod: ERROR: Module nvidia_modeset is not currently loaded
```

----------

