参考
CUDA initialization: Unexpected error from cudaGetDeviceCount()解决方法
systemd: How to unmask a service whose unit file is empty?
解决办法
问题原因是nvidia-fabricmanager 包与驱动版本不匹配
参考第一篇博客中的方法
wget https://developer.download.nvidia.cn/compute/cuda/repos/ubuntu1804/x86_64/nvidia-fabricmanager-xxx_amd64.deb
apt-get remove nvidia-fabricmanager-xxx
apt-get install ./nvidia-fabricmanager-xxx_amd64.deb
systemctl enable nvidia-fabricmanager
systemctl restart nvidia-fabricmanager
systemctl status nvidia-fabricmanager
部分情况可以解决问题
但是在执行systemctl enable nvidia-fabricmanager时可能会出现报错
Failed to enable unit: Unit file /etc/systemd/system/nvidia-fabricmanager.service is masked.
此时参考第二篇博客删除两个文件
sudo rm /lib/systemd/system/nvidia-fabricmanager.service
sudo rm /etc/systemd/system/nvidia-fabricmanager.service
之后卸载nvidia-fabricmanager重新安装,继续执行上述操作,可以解决问题。
如此问题经常复现,可以参考博客
Ubuntu中阻止软件包的升级
来禁用nvidia-fabricmanager的升级