It would be great to implement something like feature request bumblebee#140 (https://github.com/Bumblebee-Project/Bumblebee/issues/978), because bbswitch doesn't work with later kernels unless you disable pci power management at boot with pcie_port_pm=off added to GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub (see https://github.com/Bumblebee-Project/bbswitch/issues/140 for more details) and in fact later kernels automatically activate and suspend the card as required, replacing the functionality of bbswitch.
To confirm this, I tried modifying the Ubuntu bumblebee source package, but it fails to build in Cosmic on my laptop with a number of reference errors like so (even though I do have libkmod2 installed):
/usr/bin/ld: src/module.o: in function `module_is_loaded':
/home/rocko/src/bumblebee-3.2.1/src/module.c:46: undefined reference to `kmod_module_new_from_name'
So I modified the bumblebee develop branch from git (https://github.com/Bumblebee-Project/Bumblebee/tree/develop) with the attached patch and built it to confirm that bumblebee works when allowing the kernel to manage power management. The most relevant part of the patch is this:
It would be great to implement something like feature request bumblebee#140 (https:/ /github. com/Bumblebee- Project/ Bumblebee/ issues/ 978), because bbswitch doesn't work with later kernels unless you disable pci power management at boot with pcie_port_pm=off added to GRUB_CMDLINE_ LINUX_DEFAULT in /etc/default/grub (see https:/ /github. com/Bumblebee- Project/ bbswitch/ issues/ 140 for more details) and in fact later kernels automatically activate and suspend the card as required, replacing the functionality of bbswitch.
To confirm this, I tried modifying the Ubuntu bumblebee source package, but it fails to build in Cosmic on my laptop with a number of reference errors like so (even though I do have libkmod2 installed):
/usr/bin/ld: src/module.o: in function `module_is_loaded': src/bumblebee- 3.2.1/src/ module. c:46: undefined reference to `kmod_module_ new_from_ name'
/home/rocko/
So I modified the bumblebee develop branch from git (https:/ /github. com/Bumblebee- Project/ Bumblebee/ tree/develop) with the attached patch and built it to confirm that bumblebee works when allowing the kernel to manage power management. The most relevant part of the patch is this:
@@ -227,8 +228,12 @@ static void switch_ and_unload( void) BUFFER_ SIZE];
char driver[
if (bb_config. pm_method == PM_DISABLED && bb_status.runmode != BB_RUN_EXIT) { driver( driver, pci_bus_ id_discrete, sizeof driver)) { unload( driver) ;
- /* do not disable the card if PM is disabled unless exiting */
- return;
+ /* RR: unload the driver loaded by the graphics card */
+ bb_log(LOG_INFO, "PM disabled, unloading nvidia drivers anyway\n");
+ if (pci_get_
+ module_
+ }
+ return;
}
//if card is on and can be switched, switch it off
but I have also included changing configuration defaults like PM_METHOD=none and setting up the Ubuntu library paths for nvidia and primus in Ubuntu 18.04/18.10 (see https:/ /bugs.launchpad .net/ubuntu/ +source/ bumblebee/ +bug/1758243 for why).
Then I configured and built it with:
autoreconf -f MODULE_ NVIDIA= nvidia CONF_PM_METHOD=none \ LDPATH_ NVIDIA= /usr/lib/ x86_64- linux-gnu: /usr/lib/ i386-linux- gnu \ MODPATH_ NVIDIA= /usr/lib/ x86_64- linux-gnu/ nvidia/ xorg,/usr/ lib/xorg/ modules, /usr/lib/ xorg/modules/ input \
./configure CONF_DRIVER=nvidia CONF_DRIVER_
CONF_
CONF_
--prefix=/usr --sysconfdir=/etc
make clean
make && sudo make install
I disabled bbswitch via /etc/modprobe. d/bbswitch:
blacklist bbswitch
and then on reboot, optirun seems to be working fine:
$ optirun glxinfo|grep NVIDIA
server glx vendor string: NVIDIA Corporation
OpenGL vendor string: NVIDIA Corporation
OpenGL core profile version string: 4.6.0 NVIDIA 396.54
OpenGL core profile shading language version string: 4.60 NVIDIA
OpenGL version string: 4.6.0 NVIDIA 396.54
OpenGL shading language version string: 4.60 NVIDIA
and afterwards, the nvidia card is turned off:
$ cat /sys/bus/ pci/devices/ 0000\:01\ :00.0/power/ runtime_ status
suspended
This works even after a suspend/resume cycle.
ProblemType: Bug bumblebee- bugreport usr/bin/optirun usr/sbin/bumblebeed usr/share/ doc/bumblebee/ README. markdown] 041900rc3- generic x86_64 .etc.bumblebee. bumblebee. conf: 2018-09- 10T12:33: 56.368908 .etc.bumblebee. xorg.conf. nvidia: 2018-09- 10T12:33: 56.368908
DistroRelease: Ubuntu 18.10
Package: bumblebee 3.2.1-17 [modified: usr/bin/
Uname: Linux 4.19.0-
ApportVersion: 2.20.10-0ubuntu9
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Tue Sep 11 13:30:22 2018
InstallationDate: Installed on 2017-08-16 (390 days ago)
InstallationMedia: Ubuntu 17.04 "Zesty Zapus" - Release amd64 (20170412)
SourcePackage: bumblebee
UpgradeStatus: Upgraded to cosmic on 2018-08-15 (26 days ago)
mtime.conffile.
mtime.conffile.