使用 dkms 在 rhel 8.6 上安装 Nvidia 驱动程序,但在构建中出现 asm/kmap_types.h 和 drm/drmP.h 错误

使用 dkms 在 rhel 8.6 上安装 Nvidia 驱动程序,但在构建中出现 asm/kmap_types.h 和 drm/drmP.h 错误

我正在尝试在 Rhel 8.6 Lenovo p15 上安装 T1000 Quadro 的 nvidia 驱动程序。但是,我在尝试构建和安装驱动程序时遇到了错误。

系统信息?

root:Downloads# hostnamectl | grep Kernel
            Kernel: Linux 4.18.0-372.9.1.el8.x86_64
root:Downloads# lshw -c video
  *-display UNCLAIMED       
       description: VGA compatible controller
       product: TU117GLM [Quadro T1000 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
       configuration: latency=0
       resources: memory:ad000000-adffffff memory:80000000-8fffffff memory:90000000-91ffffff ioport:3000(size=128) memory:ae080000-ae0fffff
  *-display
       description: VGA compatible controller
       product: CometLake-H GT2 [UHD Graphics]
       vendor: Intel Corporation
       physical id: 2
       bus info: pci@0000:00:02.0
       logical name: /dev/fb0
       version: 05
       width: 64 bits
       clock: 33MHz
       capabilities: pciexpress msi pm vga_controller bus_master cap_list fb
       configuration: depth=32 driver=i915 latency=0 mode=3840x2160 resolution=3840,2160 visual=truecolor xres=3840 yres=2160
       resources: iomemory:600-5ff iomemory:400-3ff irq:163 memory:6040000000-6040ffffff memory:4000000000-400fffffff ioport:4000(size=64) memory:c0000-dffff
root:Downloads# cat /etc/redhat-release
Red Hat Enterprise Linux release 8.6 (Ootpa)

我从 nvidia 获得了驱动程序,这里

root:Downloads# ls -l | grep NVIDIA
-rwxr-xr-x.  1 brad brad 110600229 May 29 22:22 NVIDIA-Linux-x86_64-430.26.run

当我运行运行脚本时,我得到以下 DKMS 步骤:

  ERROR: Failed to run `/sbin/dkms build -m nvidia -v 430.26 -k 4.18.0-372.9.1.el8.x86_64`:
         Building module:       
         cleaning build area...                                                                         
         'make' -j12 NV_EXCLUDE_BUILD_MODULES='' KERNEL_UNAME=4.18.0-372.9.1.el8.x86_64
         IGNORE_CC_MISMATCH='' modules....(bad exit status: 2)                                          
         Error! Bad return status for module build on kernel: 4.18.0-372.9.1.el8.x86_64 (x86_64)
         Consult /var/lib/dkms/nvidia/430.26/build/make.log for more information.

make 日志说什么? 这个(pastebin)和下面的示例。

make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:315: /var/lib/dkms/nvidia/430.26/build/nvidia/nv-mmap.o] Error 1
make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:315: /var/lib/dkms/nvidia/430.26/build/nvidia/nv-i2c.o] Error 1
make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:315: /var/lib/dkms/nvidia/430.26/build/nvidia/nv-mempool.o] Error 1
In file included from /var/lib/dkms/nvidia/430.26/build/nvidia/nv-p2p.c:15:
/var/lib/dkms/nvidia/430.26/build/common/inc/nv-linux.h:118:10: fatal error: asm/kmap_types.h: No such file or directory
 #include <asm/kmap_types.h>         /* page table entry lookup          */
          ^~~~~~~~~~~~~~~~~~
compilation terminated.
make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:315: /var/lib/dkms/nvidia/430.26/build/nvidia/nv-p2p.o] Error 1
make[2]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/Makefile:1577: _module_/var/lib/dkms/nvidia/430.26/build] Error 2
make[2]: Leaving directory '/usr/src/kernels/4.18.0-372.9.1.el8.x86_64'
make[1]: *** [Makefile:157: sub-make] Error 2
make[1]: Leaving directory '/usr/src/kernels/4.18.0-372.9.1.el8.x86_64'
make: *** [Makefile:81: modules] Error 2

如果您不尝试使用 dkms 安装它怎么办?好吧,我想要,但是好吧...

  ERROR: An error occurred while performing the step: "Building kernel modules". See
         /var/log/nvidia-installer.log for details.

  ERROR: An error occurred while performing the step: "Checking to see whether the nvidia kernel module
         was successfully built". See /var/log/nvidia-installer.log for details.

而且当然

  ERROR: The nvidia kernel module was not created.

...

  ERROR: Installation has failed.  Please see the file '/var/log/nvidia-installer.log' for details.     
         You may find suggestions on fixing installation problems in the README available on the Linux  
         driver download page at www.nvidia.com.

那条日志说了什么?好吧,nvidia 安装程序 (pastebin)和样品。

   make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:316: /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia/nv-instance.o] Error 1
     CC [M]  /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia/nv-procfs.o
   In file included from /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia/nv-acpi.c:15:
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/common/inc/nv-linux.h:118:10: fatal error: asm/kmap_types.h: No such file or directory
    #include <asm/kmap_types.h>         /* page table entry lookup          */
             ^~~~~~~~~~~~~~~~~~
   compilation terminated.
   make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:316: /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-uvm/uvm8_fault_buffer_flush_test.o] Error 1
     CC [M]  /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-modeset.o
   In file included from /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-fb.c:29:
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-fb.h:30:10: fatal error: drm/drmP.h: No such file or directory
    #include <drm/drmP.h>
             ^~~~~~~~~~~~
   compilation terminated.
   make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:316: /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-uvm/uvm8_peer_identity_mappings_test.o] Error 1
   make[3]: *** [/usr/src/kernels/4.18.0-372.9.1.el8.x86_64/scripts/Makefile.build:316: /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-helper.o] Error 1
     CC [M]  /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.o
   In file included from /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.c:27:
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:33:30: error: field 'base' has incomplete type
        struct nv_drm_gem_object base;
                                 ^~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:37:5: error: unknown type name 'bool'
        bool dumb_buffer;
        ^~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h: In function 'to_nv_nvkms_memory':
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:46:19: error: 'NULL' undeclared (first use in this function)
        if (nv_gem != NULL) {
                      ^~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:46:19: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:31:1:
   +#include <stddef.h>
    
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:46:19:
        if (nv_gem != NULL) {
                      ^~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:46:19: note: each undeclared identifier is reported only once for each function it appears in
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:47:16: error: implicit declaration of function 'container_of' [-Werror=implicit-function-declaration]
            return container_of(nv_gem, struct nv_drm_gem_nvkms_memory, base);
                   ^~~~~~~~~~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:47:37: error: expected expression before 'struct'
            return container_of(nv_gem, struct nv_drm_gem_nvkms_memory, base);
                                        ^~~~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h: In function 'to_nv_nvkms_memory_const':
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:56:19: error: 'NULL' undeclared (first use in this function)
        if (nv_gem != NULL) {
                      ^~~~
   /tmp/selfgz30846/NVIDIA-Linux-x86_64-430.26/kernel/nvidia-drm/nvidia-drm-gem-nvkms-memory.h:56:19: note: 'NULL' is defined in header '<stddef.h>'; did you forget to '#include <stddef.h>'?

最后,如果您的 nvidia 驱动程序有任何状态怎么办?

root:Downloads# 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.

dkm 怎么样?

root:Downloads# dkms status
nvidia/430.26: added

所以我不太确定这里出了什么问题,但看起来我缺少一些模块 akmap_types.h和 a drmP.h。这些是什么?在哪里可以找到 RHEL 8.6 的它们?我该如何安装它们?另外,我假设一旦驱动程序正确构建并安装,我就不应该再有显示器了UNCLAIMED?提前坦克以获取任何见解!

答案1

这是因为 Redhat 8.6 中故意从 kernel-devel 包中删除了该功能

问题 由于从内核开发中删除了 kmap_types.h,因此在 RHEL8.6 上模块构建失败。

相关内容