我想在我的 Ubuntu 服务器上安装 nvidia 驱动,但我的服务器不支持安全启动。我在 BIOS 界面找不到安全启动项。而且我无法安装驱动程序。
我通过以下方式安装驱动程序sudo apt-get install nvidia-driver-415
。它显示
update-initramfs: Generating /boot/initrd.img-5.0.0-20-generic
I: The initramfs will attempt to resume from /dev/sda12
I: (UUID=d42cdc5e-7ede-4a3b-b613-5cf71fdf1e4b)
I: Set the RESUME variable to override this.
gzip: stdout: No space left on device
E: mkinitramfs failure cpio 141 gzip 1
update-initramfs: failed for /boot/initrd.img-5.0.0-20-generic with 1.
dpkg: error processing package initramfs-tools (--configure):
installed initramfs-tools package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
nvidia-dkms-415
nvidia-driver-415
initramfs-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
我运行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.
我想使用带有 gpu 的 pytorch。当我在 python 中导入 pytorch 时,它显示
>>>import torch
>>>x = torch.Tensor([1])
>>>x
tensor([1.])
>>>x.to('cuda')
THCudaCheck FAIL file=/opt/conda/conda-bld/pytorch_1556653114079/work/aten/src/THC/THCGeneral.cpp line=51 error=38 : no CUDA-capable device is detected
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/hekai/.conda/envs/pytorch/lib/python3.7/site-packages/torch/cuda/__init__.py", line 163, in _lazy_init
torch._C._cuda_init()
RuntimeError: cuda runtime error (38) : no CUDA-capable device is detected at /opt/conda/conda-bld/pytorch_1556653114079/work/aten/src/THC/THCGeneral.cpp:51
那么如何才能成功安装 nvidia 驱动程序?
谢谢
答案1
安全启动与您的问题无关,这从您的命令输出中可以看出:
gzip: stdout: No space left on device
您的/boot
挂载似乎磁盘空间不足。您可以通过运行 来确认这一点df -hT
,它会显示每个文件系统的可用空间。
要释放 中的空间/boot
,您应该删除旧内核。请参阅如何删除旧内核版本来清理启动菜单?向 Ubuntu 询问进一步的指导。
当您拥有足够的磁盘空间后/boot
,您应该能够安装 NVIDIA 专有驱动程序。