自 2 月 22 日起,ubuntu 20.04 下的 cuda 无法运行

自 2 月 22 日起,ubuntu 20.04 下的 cuda 无法运行

2 月份运行了新的内核更新。从那时起,cuda 10.1 和 nvidia 驱动程序 510 就无法运行了。

(base) oem@PC83:~$ nvidia-smi NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信。请确保最新的 NVIDIA 驱动程序已安装并正在运行。

此致


(base) oem@PC83:~/Downloads$ dpkg -l |grep headers
ii  libblkid-dev:amd64                                          2.34-0.1ubuntu9.3                                                               amd64        block device ID library - headers and static libraries
ii  libdbus-1-dev:amd64                                         1.12.16-2ubuntu2.2                                                              amd64        simple interprocess messaging system (development headers)
ii  libhwloc-dev:amd64                                          2.1.0+dfsg-4                                                                    amd64        Hierarchical view of the machine - static libs and headers
ii  libice-dev:amd64                                            2:1.0.10-0ubuntu1                                                               amd64        X11 Inter-Client Exchange library (development headers)
ii  libmount-dev:amd64                                          2.34-0.1ubuntu9.3                                                               amd64        device mounting library - headers and static libraries
ii  libnl-3-dev:amd64                                           3.4.0-1                                                                         amd64        development library and headers for libnl-3
ii  libnl-route-3-dev:amd64                                     3.4.0-1                                                                         amd64        development library and headers for libnl-route-3
ii  libselinux1-dev:amd64                                       3.0-1build2                                                                     amd64        SELinux development headers
ii  libsm-dev:amd64                                             2:1.2.3-1                                                                       amd64        X11 Session Management library (development headers)
ii  libx11-dev:amd64                                            2:1.6.9-2ubuntu1.2                                                              amd64        X11 client-side library (development headers)
ii  libxau-dev:amd64                                            1:1.0.9-0ubuntu1                                                                amd64        X11 authorisation library (development headers)
ii  libxcomposite-dev:amd64                                     1:0.4.5-1                                                                       amd64        X11 Composite extension library (development headers)
ii  libxdamage-dev:amd64                                        1:1.1.5-2                                                                       amd64        X11 damaged region extension library (development headers)
ii  libxdmcp-dev:amd64                                          1:1.1.3-0ubuntu1                                                                amd64        X11 authorisation library (development headers)
ii  libxext-dev:amd64                                           2:1.3.4-0ubuntu1                                                                amd64        X11 miscellaneous extensions library (development headers)
ii  libxfixes-dev:amd64                                         1:5.0.3-2                                                                       amd64        X11 miscellaneous 'fixes' extension library (development headers)
ii  libxi-dev:amd64                                             2:1.7.10-0ubuntu1                                                               amd64        X11 Input extension library (development headers)
ii  libxinerama-dev:amd64                                       2:1.1.4-2                                                                       amd64        X11 Xinerama extension library (development headers)
ii  libxmu-dev:amd64                                            2:1.1.3-0ubuntu1                                                                amd64        X11 miscellaneous utility library (development headers)
ii  libxmu-headers                                              2:1.1.3-0ubuntu1                                                                all          X11 miscellaneous utility library headers
ii  libxrandr-dev:amd64                                         2:1.5.2-0ubuntu1                                                                amd64        X11 RandR extension library (development headers)
ii  libxt-dev:amd64                                             1:1.1.5-1                                                                       amd64        X11 toolkit intrinsics library (development headers)
ii  libxtst-dev:amd64                                           2:1.2.3-1                                                                       amd64        X11 Record extension library (development headers)
ii  linux-generic-hwe-20.04                                     5.13.0.44.49~20.04.28                                                           amd64        Complete Generic Linux kernel and headers
ii  linux-headers-5.13.0-41-generic                             5.13.0-41.46~20.04.1                                                            amd64        Linux kernel headers for version 5.13.0 on 64 bit x86 SMP
ii  linux-headers-5.13.0-44-generic                             5.13.0-44.49~20.04.1                                                            amd64        Linux kernel headers for version 5.13.0 on 64 bit x86 SMP
ii  linux-headers-5.4.0-113                                     5.4.0-113.127                                                                   all          Header files related to Linux kernel version 5.4.0
ii  linux-headers-5.4.0-113-generic                             5.4.0-113.127                                                                   amd64        Linux kernel headers for version 5.4.0 on 64 bit x86 SMP
ii  linux-headers-5.8.0-63-generic                              5.8.0-63.71~20.04.1                                                             amd64        Linux kernel headers for version 5.8.0 on 64 bit x86 SMP
ii  linux-headers-generic                                       5.4.0.113.117                                                                   amd64        Generic Linux kernel headers
ii  linux-headers-generic-hwe-20.04                             5.13.0.44.49~20.04.28                                                           amd64        Generic Linux kernel headers
ii  linux-hwe-5.13-headers-5.13.0-41                            5.13.0-41.46~20.04.1                                                            all          Header files related to Linux kernel version 5.13.0
ii  linux-hwe-5.13-headers-5.13.0-44                            5.13.0-44.49~20.04.1                                                            all          Header files related to Linux kernel version 5.13.0
ii  linux-hwe-5.8-headers-5.8.0-63                              5.8.0-63.71~20.04.1                                                             all          Header files related to Linux kernel version 5.8.0
ii  uuid-dev:amd64                                              2.34-0.1ubuntu9.3                                                               amd64        Universally Unique ID library - headers and static libraries
ii  x11proto-dev                                                2019.2-1ubuntu1                                                                 all          X11 extension protocols and auxiliary headers

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most      
         frequently when this kernel module was built against the wrong or     
         improperly configured kernel sources, with a version of gcc that      
         differs from the one used to build the target kernel, or if another
         driver, such as nouveau, is present and prevents the NVIDIA kernel
         module from obtaining ownership of the NVIDIA device(s), or no NVIDIA 
         device installed in this system is supported by this NVIDIA Linux
         graphics driver release.                                              

It is not possible to write in /sys/kernel/btf


i2c_hid               processor_thermal_rfim    vmlinux
i2c_hid_acpi          psmouse                   wmi
i2c_i801              r8169                     wmi_bmof
i2c_smbus             raid6_pq                  x86_pkg_temp_thermal
i915                  rapl                      xfrm_algo
idma64                rc_core                   xfrm_user
input_leds            realtek                   xhci_pci
int3400_thermal       rfcomm                    xhci_pci_renesas
int3403_thermal       sch_fq_codel              xor
int340x_thermal_zone  sdhci                     x_tables
intel_cstate          sdhci_pci                 xt_addrtype
intel_hid             serio_raw                 xt_conntrack
intel_lpss            snd                       xt_MASQUERADE
intel_lpss_pci        snd_compress              zstd_compress
intel_pch_thermal     snd_hda_codec
(base) oem@PC83:/sys/kernel/btf$ sudo ls > test
bash: test: Permission denied

ubuntu 存储库不起作用。每次我都会遇到以下错误。

(base) oem@PC83:~$ 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.

ubfan1 说我应该使用新内核的 nvidia-Driver。NVIDIA-Linux-x86_64-510.68.02.run 出现编译器错误:

ERROR: Unable to load the kernel module 'nvidia.ko'.  This happens most      
         frequently when this kernel module was built against the wrong or     
         improperly configured kernel sources, with a version of gcc that      
         differs from the one used to build the target kernel, or if another
         driver, such as nouveau, is present and prevents the NVIDIA kernel
         module from obtaining ownership of the NVIDIA device(s), or no NVIDIA 
         device installed in this system is supported by this NVIDIA Linux
         graphics driver release.

   Skipping BTF generation for /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia-modeset.ko due to unavailability of vmlinux
     BTF [M] /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia-drm.ko
   Skipping BTF generation for /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia-drm.ko due to unavailability of vmlinux
     BTF [M] /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia.ko
   Skipping BTF generation for /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia.ko due to unavailability of vmlinux
     BTF [M] /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia-uvm.ko
   Skipping BTF generation for /tmp/selfgz42390/NVIDIA-Linux-x86_64-510.68.02/kernel/nvidia-uvm.ko due to unavailability of vmlinux

答案1

使用以下命令安装专有 Nvidia 驱动程序:

sudo apt update
sudo ubuntu-drivers autoinstall

重新启动以应用更改。


现在,下次更新内核时,系统将自动更新驱动程序。

以后不要从 Nvidia 网站下载专有驱动程序。专有驱动程序包含在 Ubuntu 存储库中,Ubuntu (Canonical) 与 Nvidia 合作以确保正确配置和与系统的兼容性。

答案2

好极了,来自 ubuntu 20.04 的新更新和最新的 NVIDIA 驱动程序运行了。(基础)

oem@PC83:~$ nvidia-smi
Sun Jul 17 18:01:09 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 515.57       Driver Version: 515.57       CUDA Version: 11.7     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:02:00.0 Off |                  N/A |
| N/A   50C    P8    N/A /  N/A |      9MiB /  4096MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      2584      G   /usr/lib/xorg/Xorg                  4MiB |
|    0   N/A  N/A      3302      G   /usr/lib/xorg/Xorg                  4MiB |
+-----------------------------------------------------------------------------+

相关内容