更新 1

更新 1

我已经安装了 Kubuntu 18.04 LTS,并且我想使用来自 nvidia.com 的 NVIDIA 驱动程序。

我的图形设备是:

$ lspci | grep "VGA"
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
01:00.0 VGA compatible controller: NVIDIA Corporation Device 1c8d (rev a1)

我已经从多用户会话(没有X)安装了他们的驱动程序,通过添加行将nouveau列入黑名单

blacklist nouveau
options nouveau modeset=0

进入/etc/modprobe.d/blacklist.conf,线条

rdblacklist=nouveau

变成/etc/default/grub,制成

# grub-mkconfig -o /boot/grub/grub.cfg
# update-initramfs -u
# reboot

重启后我得到黑屏,而从其他 tty 可以运行 nvidia-smi 并返回正确的结果:

$ nvidia-smi
Fri Apr 12 20:33:11 2019
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| 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 1050    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   39C    P8    N/A /  N/A |     49MiB /  4040MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0       840      G   /usr/lib/xorg/Xorg                             8MiB |
|    0       880      G   /usr/bin/sddm-greeter                         38MiB |
+-----------------------------------------------------------------------------+

因此驱动程序看起来安装正确。

我的配置文件和日志在这里:xorg配置文件Xorg.0.log消息日志控制

xorg.conf文件取自安装在同一台笔记本电脑上的 Linux Mint,该笔记本nvidia电脑在从存储库安装驱动程序后图形可以正常启动。使用xorg.conf驱动程序安装过程中生成的文件会出现同样的黑屏(除了 Xorg.0.log 中没有加载模式设置)。

nvidia我的系统可以使用最新的驱动程序来运行图形吗?


更新 1

有关我的系统的其他信息:

$ mokutil --sb-state
SecureBoot disabled
Platform is in Setup Mode

$ ls /sys/firmware/efi
config_table efivars esrt fw_platform_size fw_vendor runtime runtime-map systab vars

# lshw -c video
  *-display
       description: VGA compatible controller
       product: GP107M [GeForce GTX 1050 Mobile]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:134 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff
  *-display
       description: VGA compatible controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 04
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:130 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64) memory:c0000-dffff

$ lsmod | grep nvidia
nvidia_drm             45056  3
nvidia_modeset       1085440  6 nvidia_drm
nvidia              17592320  221 nvidia_modeset
ipmi_msghandler       102400  2 ipmi_devintf,nvidia
drm_kms_helper        172032  2 nvidia_drm,i915
drm                   458752  8 drm_kms_helper,nvidia_drm,i915

更新 2

dkms status不返回任何内容:

$ dkms status
$

更新 3

我重新安装了驱动程序然后安装了bbswitch-dkms。但启动X的结果是一样的。

以下是Xorg.0.log以及先前显示的命令的结果,其中结果已经改变:

$ lsmod | grep nvidia
nvidia_uvm            798720  0
nvidia_drm             40960  3
nvidia_modeset       1085440  6 nvidia_drm
nvidia              17592320  222 nvidia_uvm,nvidia_modeset
ipmi_msghandler       102400  2 ipmi_devintf,nvidia
drm_kms_helper        172032  2 nvidia_drm,i915
drm                   458752  8 drm_kms_helper,nvidia_drm,i915

$ dkms status
bbswitch, 0.8, 4.18.0-17-generic, x86_64: installed
nvidia, 418.43, 4.18.0-17-generic, x86_64: installed

xorg.conf 与前面相同。 、 、 的输出mokutills /sys/firmware/efi前面lshw相同nvidia-smi

我又找到了一个相关日志:/var/log/gpu-manager.log。以下是 Kubuntu 和 Linux Mint 的文件(存储库中的驱动程序成功运行 X):gpu-manager.log.Kubuntugpu-manager.log.Mint。从第二篇日志可以看出,bbswitch 也被使用了。这就是在 Kubuntu 上安装它的原因,但目前我不知道如何使用它……

答案1

我已经通过安装解决了这个问题nvidia-prime

现在 X 可以正确启动了,

$ glxinfo | head
name of display: :0
display: :0  screen: 0
direct rendering: Yes
server glx vendor string: NVIDIA Corporation
server glx version string: 1.4
server glx extensions:
    GLX_ARB_context_flush_control, GLX_ARB_create_context, 
    GLX_ARB_create_context_no_error, GLX_ARB_create_context_profile, 
    GLX_ARB_create_context_robustness, GLX_ARB_fbconfig_float, 
    GLX_ARB_multisample, GLX_EXT_buffer_age,

$ glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
65344 frames in 5.0 seconds = 13068.664 FPS
66224 frames in 5.0 seconds = 13244.633 FPS
66325 frames in 5.0 seconds = 13264.833 FPS
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":0"
      after 54 requests (54 known processed) with 0 events remaining.

$ nvidia-smi | head
Tue Apr 16 16:10:47 2019       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 418.43       Driver Version: 418.43       CUDA Version: 10.1     |
|-------------------------------+----------------------+----------------------+
| 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 1050    Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   42C    P0    N/A /  N/A |    176MiB /  4040MiB |      4%      Default |
+-------------------------------+----------------------+----------------------+

$ mokutil --sb-state
SecureBoot disabled
Platform is in Setup Mode

$ ls /sys/firmware/efi
config_table  efivars  esrt  fw_platform_size  fw_vendor  runtime  runtime-map  systab  vars

# lshw -c video
  *-display                 
       description: VGA compatible controller
       product: GP107M [GeForce GTX 1050 Mobile]
       vendor: NVIDIA Corporation
       physical id: 0
       bus info: pci@0000:01:00.0
       version: a1
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress vga_controller bus_master cap_list rom
       configuration: driver=nvidia latency=0
       resources: irq:134 memory:de000000-deffffff memory:c0000000-cfffffff memory:d0000000-d1ffffff ioport:e000(size=128) memory:df000000-df07ffff
  *-display
       description: VGA compatible controller
       product: Intel Corporation
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 04
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:130 memory:dd000000-ddffffff memory:b0000000-bfffffff ioport:f000(size=64) memory:c0000-dffff

$ dkms status
bbswitch, 0.8, 4.18.0-17-generic, x86_64: installed
nvidia, 418.43, 4.18.0-17-generic, x86_64: installed

$ lsmod | grep nvidia
nvidia_drm             40960  9
nvidia_modeset       1085440  19 nvidia_drm
nvidia              17592320  895 nvidia_modeset
ipmi_msghandler       102400  2 ipmi_devintf,nvidia
drm_kms_helper        172032  2 nvidia_drm,i915
drm                   458752  13 drm_kms_helper,nvidia_drm,i915

对应的日志:Xorg.0.loggpu 管理器.log.X 使用前面介绍的 xorg.conf 运行:

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "nvidia"
    Inactive       "intel"
EndSection

Section "Device"
    Identifier     "intel"
    Driver     "modesetting"
    BusID      "PCI:0@0:2:0"
    Option     "AccelMethod" "None"
EndSection

Section "Screen"
    Identifier     "intel"
    Device     "intel"
EndSection

Section "Device"
    Identifier     "nvidia"
    BusID      "PCI:1@0:0:0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    Option     "ConstrainCursor" "off"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Option     "AllowEmptyInitialConfiguration" "on"
    Option     "IgnoreDisplayDevices" "CRT"
EndSection

我无法使用安装 nvidia 驱动程序期间生成的 xorg.conf 启动 X。

因此,总结一下,我安装了dkms,手动安装了驱动程序(对“是否要使用 DKMS 注册内核模块源?”问题回答“是”,将 nouveau 列入黑名单,安装了bbswitch-dkmsnvidia-prime并将 xorg.conf 更改为如上所示。完成这些步骤后,X 可以正常启动。

相关内容