CUDA 和 Nvidia 安装失败且 nvidia-smi 错误

CUDA 和 Nvidia 安装失败且 nvidia-smi 错误

我想在 Ubuntu 上安装 CUDA 工具包和 NVIDIA 驱动程序。我是 Linux 新手,所以没有经验。我已经为此工作了三天,但问题仍然存在。

首先,我在 BIOS 中禁用了安全启动。之后,在 grub 菜单中,我设置nomodeset 安静飞溅 已安装CUDA 工具包 10.1从那里开始。为了安装 Nvidia 驱动程序,我应用了以下步骤:

$ sudo add-apt-repository ppa:graphics-drivers/ppa  
$ sudo apt update  
$sudo apt install nvidia-driver-418  
reboot

当输入 nvidia-smi 时输出是:

“NVIDIA-SMI 失败,因为它无法与 NVIDIA 驱动程序通信。请确保最新的 NVIDIA 驱动程序已安装并正在运行。”

我该如何解决这个问题,谢谢朋友。

~$ uname -a

Linux denisa 4.18.0-17-generic #18-Ubuntu SMP Wed Mar 13 14:34:40 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux

~$ uname -i

x86_64

~$ cat /etc/os-release

NAME="Ubuntu"
VERSION="18.10 (Cosmic Cuttlefish)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 18.10"
VERSION_ID="18.10"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=cosmic
UBUNTU_CODENAME=cosmic

̣,

~$ sudo ubuntu-drivers devices

== /sys/devices/pci0000:00/0000:00:1c.0/0000:01:00.0 ==
modalias : pci:v000010DEd0000134Dsv00001043sd00001490bc03sc02i00
vendor   : NVIDIA Corporation
model    : GM108M [GeForce 940MX]
driver   : nvidia-driver-410 - third-party free
driver   : nvidia-driver-418 - third-party free recommended
driver   : nvidia-driver-396 - third-party free
driver   : nvidia-driver-415 - third-party free
driver   : nvidia-driver-390 - distro non-free
driver   : xserver-xorg-video-nouveau - distro free builtin

~$ sudo lshw -numeric -C display

      *-display UNCLAIMED       
           description: VGA compatible controller
           **product: HD Graphics 620 [8086:5916]
           vendor: Intel Corporation [8086]**
           physical id: 2
           bus info: pci@0000:00:02.0
           version: 02
           width: 64 bits
           clock: 33MHz
           capabilities: pciexpress msi pm vga_controller bus_master cap_list
           configuration: latency=0
           resources: memory:ed000000-edffffff memory:c0000000-cfffffff ioport:f000(size=64) memory:c0000-dffff
      *-display
           description: 3D controller
           **product: GM108M [GeForce 940MX] [10DE:134D]**
           vendor: NVIDIA Corporation [10DE]
           physical id: 0
           bus info: pci@0000:01:00.0
           version: a2
           width: 64 bits
           clock: 33MHz
           capabilities: pm msi pciexpress bus_master cap_list rom
           configuration: driver=nvidiafb latency=0
           resources: irq:16 memory:ee000000-eeffffff memory:d0000000-dfffffff memory:e0000000-e1ffffff ioport:e000(size=128) memory:ef000000-ef07ffff

編輯-V-1:

~$ mokutil --sb-state
SecureBoot disabled

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

 ~$ sudo lshw -c video


 [sudo] password for denisa: 
   *-display UNCLAIMED       
        description: VGA compatible controller
        product: HD Graphics 620
        vendor: Intel Corporation
        physical id: 2
        bus info: pci@0000:00:02.0
        version: 02
        width: 64 bits
        clock: 33MHz
        capabilities: pciexpress msi pm vga_controller bus_master cap_list
        configuration: latency=0
        resources: memory:ed000000-edffffff memory:c0000000-cfffffff ioport:f000(size=64) memory:c0000-dffff
   *-display
        description: 3D controller
        product: GM108M [GeForce 940MX]
        vendor: NVIDIA Corporation
        physical id: 0
        bus info: pci@0000:01:00.0
        version: a2
        width: 64 bits
        clock: 33MHz
        capabilities: pm msi pciexpress bus_master cap_list rom
        configuration: driver=nvidiafb latency=0
        resources: irq:16 memory:ee000000-eeffffff memory:d0000000-dfffffff memory:e0000000-e1ffffff ioport:e000(size=128) memory:ef000000-ef07ffff

 ~$ dkms status 

 nvidia, 418.56, 4.18.0-17-generic, x86_64: installed

~$ lsmod | grep nvidia

nvidiafb               49152  0
vgastate               20480  1 nvidiafb
fb_ddc                 16384  1 nvidiafb
i2c_algo_bit           16384  2 nvidiafb,i915

~$ echo $XDG_SESSION_TYPE

x11

~$ nvcc -V

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2019 NVIDIA Corporation
Built on Fri_Feb__8_19:08:17_PST_2019
Cuda compilation tools, release 10.1, V10.1.105

已编辑-V-2:

~$ sudo mv /etc/modprobe.conf /etc/modprobe.conf.bak

[sudo] password for denisa: 
mv: cannot stat '/etc/modprobe.conf': No such file or directory   

~$ echo "blacklist nvidiafb" | sudo tee -a /etc/modprobe.d/nvidiafb.conf 

blacklist nvidiafb 

~$ sudo depmod -ae 

depmod: WARNING: -e needs -E or -F



~$ sudo update-initramfs -u

update-initramfs: Generating /boot/initrd.img-4.18.0-17-generic

任何帮助都将不胜感激。谢谢朋友们。

相关内容