amdgpu-dkms 在 ubuntu 20 上的安装后脚本中失败

amdgpu-dkms 在 ubuntu 20 上的安装后脚本中失败
root@gpt:/home# lshw -C display
  *-display
       description: VGA compatible controller
       product: Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
       vendor: Advanced Micro Devices, Inc. [AMD/ATI]
       physical id: 0
       bus info: pci@0000:01:00.0
       version: c7
       width: 64 bits
       clock: 33MHz
       capabilities: pm pciexpress msi vga_controller bus_master cap_list rom
       configuration: driver=amdgpu latency=0
       resources: irq:41 memory:c0000000-cfffffff memory:d0000000-d01fffff ioport:e000(size=256) memory:fea00000-fea3ffff memory:c0000-dffff
root@gpt:/home# lspci -nnk | grep -i vga -A3
01:00.0 VGA compatible controller [0300]: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1002:67df] (rev c7)
        Subsystem: Gigabyte Technology Co., Ltd Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] [1458:22df]
        Kernel driver in use: amdgpu
        Kernel modules: amdgpu
root@gpt:/home# apt install amdgpu-dkms
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  dctrl-tools dkms
Suggested packages:
  debtags menu
The following NEW packages will be installed:
  amdgpu-dkms dctrl-tools dkms
0 upgraded, 3 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/10.3 MB of archives.
After this operation, 444 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Selecting previously unselected package dctrl-tools.
(Reading database ... 90817 files and directories currently installed.)
Preparing to unpack .../dctrl-tools_2.24-3_amd64.deb ...
Unpacking dctrl-tools (2.24-3) ...
Selecting previously unselected package dkms.
Preparing to unpack .../dkms_2.8.1-5ubuntu2_all.deb ...
Unpacking dkms (2.8.1-5ubuntu2) ...
Selecting previously unselected package amdgpu-dkms.
Preparing to unpack .../amdgpu-dkms_1%3a6.2.4.50700-1646729.20.04_all.deb ...
Unpacking amdgpu-dkms (1:6.2.4.50700-1646729.20.04) ...
Setting up dctrl-tools (2.24-3) ...
Setting up dkms (2.8.1-5ubuntu2) ...
Setting up amdgpu-dkms (1:6.2.4.50700-1646729.20.04) ...
Loading new amdgpu-6.2.4-1646729.20.04 DKMS files...
Building for 5.4.0-166-generic
Building for architecture x86_64
Building initial module for 5.4.0-166-generic
ERROR: Cannot create report: [Errno 17] File exists: '/var/crash/amdgpu-dkms.0.crash'
Error! Bad return status for module build on kernel: 5.4.0-166-generic (x86_64)
Consult /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/make.log for more information.
dpkg: error processing package amdgpu-dkms (--configure):
 installed amdgpu-dkms package post-installation script subprocess returned error exit status 10
Processing triggers for man-db (2.9.1-1) ...
Errors were encountered while processing:
 amdgpu-dkms
E: Sub-process /usr/bin/dpkg returned an error code (1)
make[1]: *** [scripts/Makefile.build:520: /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu] Error 2

为了满足字符数限制,我不得不缩写日志的部分内容。缩写以“...”表示。

root@gpt:/home# cat /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/make.log
DKMS make.log for amdgpu-6.2.4-1646729.20.04 for kernel 5.4.0-166-generic (x86_64)
Tue 14 Nov 2023 11:58:15 PM UTC
make: Entering directory '/usr/src/linux-headers-5.4.0-166-generic'
/var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/Makefile:219: "The local C standard(gnu89) doesn't match kernel default C standard(gnu11/gnu99)"

...

In file included from /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdxcp/backport/include/kcl/kcl_drm_drv.h:29,
                 from /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdxcp/backport/backport.h:1,
                 from <command-line>:
./include/drm/drm_drv.h:784:23: note: expected ‘struct drm_driver *’ but argument is of type ‘const struct drm_driver *’
  784 |    struct drm_driver *driver,
      |    ~~~~~~~~~~~~~~~~~~~^~~~~~
make[2]: *** [scripts/Makefile.build:270: /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdxcp/./backport/kcl_drm_drv.o] Error 1
make[2]: *** Waiting for unfinished jobs....
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/ttm/ttm_bo_util.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdkcl/kcl_kernel_params.o
make[1]: *** [scripts/Makefile.build:520: /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdxcp] Error 2
make[1]: *** Waiting for unfinished jobs....
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/scheduler/sched_fence.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdkcl/kcl_dma-resv.o
/var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_drv.c:2379:13: warning: ‘amdgpu_driver_release’ defined but not used [-Wunused-function]
 2379 | static void amdgpu_driver_release(struct drm_device *ddev)
      |             ^~~~~~~~~~~~~~~~~~~~~
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/ttm/ttm_bo_vm.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/ttm/ttm_module.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_device.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/ttm/ttm_execbuf_util.o
/var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/ttm/ttm_bo_vm.c: In function ‘amdttm_bo_vm_dummy_page’:
/var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/ttm/ttm_bo_vm.c:319:21: warning: unused variable ‘ddev’ [-Wunused-variable]
  319 |  struct drm_device *ddev = bo->base.dev;
      |                     ^~~~

...

In file included from ./include/drm/drm_modes.h:33,
                 from ./include/drm/drm_crtc.h:40,
                 from /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/include/kcl/kcl_drm_connector.h:25,
                 from /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdkcl/kcl_drm_connector.c:22:
./include/drm/drm_connector.h:1526:5: note: previous declaration of ‘drm_mode_create_colorspace_property’ was here
 1526 | int drm_mode_create_colorspace_property(struct drm_connector *connector);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [scripts/Makefile.build:270: /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdkcl/kcl_drm_connector.o] Error 1
make[2]: *** Waiting for unfinished jobs....
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_benchmark.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/atombios_dp.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_afmt.o
make[1]: *** [scripts/Makefile.build:520: /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdkcl] Error 2
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_trace_points.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/atombios_encoders.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_sa.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/atombios_i2c.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_dma_buf.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_vm.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_vm_pt.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_ib.o
  CC [M]  /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_pll.o
/var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build/amd/amdgpu/amdgpu_dma_buf.c: In function ‘amdgpu_dma_buf_map_detach’:

...

make: *** [Makefile:1778: /var/lib/dkms/amdgpu/6.2.4-1646729.20.04/build] Error 2
make: Leaving directory '/usr/src/linux-headers-5.4.0-166-generic'

答案1

您的内核版本对于该驱动程序来说太旧了。您可以通过先安装 HWE 版本来解决这个问题:

sudo apt install --install-recommends linux-generic-hwe-20.04

然后重新启动,然后再次尝试安装 amdgpu-dkms。

相关内容