无法在 Ubuntu 14.04 上使用适当驱动程序和 Bumblebee/Prime 关闭独立显卡

无法在 Ubuntu 14.04 上使用适当驱动程序和 Bumblebee/Prime 关闭独立显卡

我有一台 Optimus 笔记本电脑。我将运行一些繁重的模拟,因此我需要使用带有适当驱动程序的独立 Nvidia GPU。由于使用 Nvidia GPU 做所有事情会浪费太多电量,因此我需要能够在 Intel 和 Nvidia 之间切换。我尝试了 Bumblebee 和 Prime,两者都有相同的问题:即使我使用 Intel GPU,Nvidia GPU 仍处于打开状态。我安装了nvidia-361nvidia-364导致黑屏)和nvidia-prime软件包,重新启动,从 NVIDIA X 服务器设置切换到 Intel,再次重新启动,我注意到的第一件事就是我的笔记本电脑产生大量热量,因此我运行 powertop 只看到以下内容:

          100,0%      PCI Device: NVIDIA Corporation GK107M [GeForce GT 740M]

使用 nouveau 驱动程序时,此使用率为 0%。然后我使用以下命令安装了 Bumblebee:

sudo apt-get install bumblebee bumblebee-nvidia primus linux-headers-generic

我编辑了/etc/bumblebee/bumblebee.conf,现在它看起来像这样:

# Configuration file for Bumblebee. Values should **not** be put between quotes

## Server options. Any change made in this section will need a server restart
# to take effect.
[bumblebeed]
# The secondary Xorg server DISPLAY number
VirtualDisplay=:8
# Should the unused Xorg server be kept running? Set this to true if waiting
# for X to be ready is too long and don't need power management at all.
KeepUnusedXServer=false
# The name of the Bumbleblee server group name (GID name)
ServerGroup=bumblebee
# Card power state at exit. Set to false if the card shoud be ON when Bumblebee
# server exits.
TurnCardOffAtExit=false
# The default behavior of '-f' option on optirun. If set to "true", '-f' will
# be ignored.
NoEcoModeOverride=false
# The Driver used by Bumblebee server. If this value is not set (or empty),
# auto-detection is performed. The available drivers are nvidia and nouveau
# (See also the driver-specific sections below)
Driver=nvidia
# Directory with a dummy config file to pass as a -configdir to secondary X
XorgConfDir=/etc/bumblebee/xorg.conf.d

## Client options. Will take effect on the next optirun executed.
[optirun]
# Acceleration/ rendering bridge, possible values are auto, virtualgl and
# primus.
Bridge=auto
# The method used for VirtualGL to transport frames between X servers.
# Possible values are proxy, jpeg, rgb, xv and yuv.
VGLTransport=proxy
# List of paths which are searched for the primus libGL.so.1 when using
# the primus bridge
PrimusLibraryPath=/usr/lib/x86_64-linux-gnu/primus:/usr/lib/i386-linux-gnu/primus
# Should the program run under optirun even if Bumblebee server or nvidia card
# is not available?
AllowFallbackToIGC=false


# Driver-specific settings are grouped under [driver-NAME]. The sections are
# parsed if the Driver setting in [bumblebeed] is set to NAME (or if auto-
# detection resolves to NAME).
# PMMethod: method to use for saving power by disabling the nvidia card, valid
# values are: auto - automatically detect which PM method to use
#         bbswitch - new in BB 3, recommended if available
#       switcheroo - vga_switcheroo method, use at your own risk
#             none - disable PM completely
# https://github.com/Bumblebee-Project/Bumblebee/wiki/Comparison-of-PM-methods

## Section with nvidia driver specific options, only parsed if Driver=nvidia
[driver-nvidia]
# Module name to load, defaults to Driver if empty or unset
KernelDriver=nvidia-361
PMMethod=auto
# colon-separated path to the nvidia libraries
LibraryPath=/usr/lib/nvidia-361:/usr/lib32/nvidia-361
# comma-separated path of the directory containing nvidia_drv.so and the
# default Xorg modules path
XorgModulePath=/usr/lib/nvidia-361/xorg,/usr/lib/xorg/modules
XorgConfFile=/etc/bumblebee/xorg.conf.nvidia

## Section with nouveau driver specific options, only parsed if Driver=nouveau
[driver-nouveau]
KernelDriver=nouveau
PMMethod=auto
XorgConfFile=/etc/bumblebee/xorg.conf.nouveau

我重新启动并再次检查 powertop,结果相同,使用率为 100%。然后我检查了内核输出。 dmesg | grep bbswitch

[   26.135632] bbswitch: version 0.7
[   26.135640] bbswitch: Found integrated VGA device 0000:00:02.0: \_SB_.PCI0.GFX0
[   26.135646] bbswitch: Found discrete VGA device 0000:01:00.0: \_SB_.PCI0.PEG0.PEGP
[   26.135741] bbswitch: detected an Optimus _DSM function
[   26.135751] bbswitch: Succesfully loaded. Discrete card 0000:01:00.0 is on

dmesg | grep nvidia

[   14.803636] nvidia: module license 'NVIDIA' taints kernel.
[   14.805959] nvidia: module verification failed: signature and/or  required key missing - tainting kernel
[   14.809434] nvidia-nvlink: Nvlink Core is being initialized, major device number 251
[   15.139887] [drm] Initialized nvidia-drm 0.0.0 20150116 for 0000:01:00.0 on minor 1
[   15.554841] nvidia-modeset: Loading NVIDIA Kernel Mode Setting Driver for UNIX platforms  361.45.11  Tue May 17 17:49:04 PDT 2016
[   15.875205] nvidia-uvm: Loaded the UVM driver in lite mode, major device number 250
[   26.147993] nvidia-uvm: Unloaded the UVM driver in lite mode

输出cat /proc/acpi/bbswitch

0000:01:00.0 ON

然后我sudo tee /proc/acpi/bbswitch <<<OFF再次运行上述命令,输出相同。然后我检查dmesgbbswitch 条目并看到以下内容:

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

我尝试nvidia用以下方法卸载sudo rmmod nvidia

rmmod: ERROR: Module nvidia is in use by: nvidia_modeset

卸载后,nvidia_modeset我可以卸载nvidia,然后再次运行sudo tee /proc/acpi/bbswitch <<<OFF,这次它可以工作,但 powertop 的输出没有变化。重启后,Nvidia GPU 仍在运行。我将这行添加到我的/etc/modprobe.d/bbswitch.conf

options bbswitch load_state=0 unload_state=1

nouveau并且nvidia也被列入了黑名单,我仍然无法关闭我的 Nvidia GPU。我不知道我还能做什么。我做错了什么?

答案1

您需要禁用 nvidia 驱动程序的加载,以便 bumblebee 稍后可以执行此操作。

因此编辑:

sudo nano /etc/modprobe.d/bumblebee.conf

在我的情况下,在末尾添加一个新条目,其中包含 nvidia-xxx:

# nvidia-375
#375
blacklist nvidia-375
blacklist nvidia-375-drm
blacklist nvidia-375-updates
blacklist nvidia-experimental-375

确保有 drm 条目。这将完全禁用启动时加载 nvidia 显卡,bumblebee 将处理其余部分。

在此处查看在 xps-15 上执行此操作的指南:https://gist.github.com/whizzzkid/37c0d365f1c7aa555885d102ec61c048

相关内容