linux-surface
linux-surface copied to clipboard
[Surface Book 2] How to properly setup the dgpu and intel graphics (using bumblebee)?
Hello everyone!
I am running:
- Surface Book 2 with a gtx 1060 mobile dgpu
- Ubuntu 19.04 with the latest jakeday 5.1.15 kernel and patches
- nvidia-driver-430 (i.e. the latest one from the repo, see this guide).
Problem: I can't get bumblebee to work and am wondering if bumblebee is the way to get proper functionality of both dgpu and intel.
I started by following install instructions (with manual signing per SIGNING.md, so secure boot + 3rd party enabled in UEFI) from: How to dual boot ubuntu 18.04 on Surface Book
At this point, I can switch between dgpu and intel by sudo prime-select intel / nvidia. This switch only requires a logout (ctrl+alt+del) but implies everything graphically (including Gnome) is done by a single unit. This means that detaching would require a relog and unit switch every time and is therefore unwanted. To this end, I installed the Surface Control and dgpu hot-plug packages recommended here:
Jakeday Issues 501
Of course now the dgpu has to be turned on before making a switch and it is not possible to boot into the nvidia profile as the dgpu is turned off by default at boot. Moreover, I cannot run CUDA ( using sh devicequery from the CUDA samples) while on the intel profile with the dgpu set on using surface control. I suppose this is because the driver is not loaded, but I do not know how to manually load the nvidia driver in this situation. Installing nvidia-modprobe and running it does nothing.
I then figured ideally I can run the display on intel while specifically assigning the dgpu to programmes like steam / wine / krita / CUDA. This is the flexibility that would make live detaching possible while still being able to utilize the dgpu.
I therefore installed Bumblebee to use primusrun / optirun, using the official wiki:
Bumblebee Ubuntu wiki
I edited the config file to reflect my specific nvidia driver following step 5 from here. (attached) bumblebee.conf.txt
I now use Surface Control to power on the dgpu with sudo surface dgpu set on.
When I try to use optirun / primusrun, I get:
optirun glxgears
[ 4156.548064] [ERROR]Cannot access secondary GPU - error: Could not load GPU driver
[ 4156.548155] [ERROR]Aborting because fallback start is disabled.
primusrun glxgears
/usr/bin/primusrun: line 41: warning: command substitution: ignored null byte in input
primus: fatal: Bumblebee daemon reported: error: Could not load GPU driver
TLDR problem:
- The kernel does not seem to support a similar hybrid graphics setup as its windows equivalent
- Bumblebee does not work in its base configuration
- Prime switching works
- While on the prime intel profile and turning on the dgpu with surface control, CUDA does not work
Thoughts on a solution:
- Maybe bumblebee isn't the way to go for the jakeday kernel and the SB2? Should I use some other form of
nvidia-primeornvidia-xrunto get the wanted functionality? - The configuration file is wrong and the paths are wrong in the file? The default configuration file also does not work, but the changed file at least gets the bumblebeed service running when checking using
sudo bumblebeed -vv. - I should use a different nvidia driver version / installation method?
More information:
lspci -k
02:00.0 3D controller: NVIDIA Corporation GP106M [GeForce GTX 1060 Mobile] (rev a1)
Kernel modules: nvidiafb, nouveau
Related to Issue 534
I did not properly configure bbswitch or switcheroo as I am using the Surface Linux Control package.
Any help and or thoughts are much appreciated! Everything else works perfectly. Thanks!
I've written a short how-to for bumblebee/optirun here. Essentially, you need to manually run sudo nvidia-modprobe before you can use optirun.
Of course now the dgpu has to be turned on before making a switch and it is not possible to boot into the nvidia profile as the dgpu is turned off by default at boot.
You can change the default behavior via the module parameters as described here. I've set the defaults this way as Gnome has the habit of "claiming" the device, making it impossible to turn off once Gnome/GDM has started without crashing something.
Moreover, I cannot run CUDA ( using
sh devicequeryfrom the CUDA samples) while on the intel profile with the dgpu set on usingsurface control. I suppose this is because the driver is not loaded, but I do not know how to manually load the nvidia driver in this situation. Installingnvidia-modprobeand running it does nothing.
Works for me on Arch Linux if I turn on the dGPU and then run sudo nvidia-modprobe. Although I have never set (/tried setting up) up prime-select. What about nvidia-smi?
@Roderfeen could figure this out? I tried qzed suggestion but I am still getting the same errors as you do.
@atasoglou Unfortunately not as of yet. Although I am currently also not able to go through all the setup steps again as I need a functioning Linux distribution at the moment and the manual switching between intel gpu and nvidia gpu is sufficient for my needs right now.
My best guess is that it has something to do with Bumblebee's compatibility with (19.xx) Ubuntu. Perhaps Arch Linux is the way to go? I will definitely look into that the coming summer.
@qzed Thank you very much for the reply, I'll leave the post open so others can try your suggested steps and perhaps be more successful.
Bumblebee itself shouldn't be the issue, rather optirun. Although I think it should work with pretty much any version provided that the nvidia driver does work. Something I forgot to mentioned here: You will need to install the dkms version of the driver, as the normal driver won't work for custom kernels (basically, you need a driver that is compiled for the specific kernel version and normally distros only provide pre-compiled drivers for the kernel they provide themselves). This could be the reason why nvidia-modprobe was not working.
Also please note that there are updated kernels available at https://github.com/linux-surface/linux-surface/ and the dGPU part has been updated (this shouldn't change anything in behavior though).