安装CUDA后重启ubuntu不能登入图形化界面

在ubuntu1604按照nvidia官方文档安装CUDA后(http://docs.nvidia.com/cuda/cuda-installation-guide-linux/index.html#post-installation-actions),不能正常进入图形化界面

  1. cat /var/log/syslog:
kernel: [   72.264024] NVRM: this kernel module has the version 340.101.  Please
kernel: [   72.264024] NVRM: make sure that this kernel module and all NVIDIA driver
kernel: [   72.264024] NVRM: components have the same version.
kernel: [   72.264031] NVRM: nvidia_frontend_ioctl: minor 255, module->ioctl failed, error -22
nvidia-persistenced: Failed to query NVIDIA devices. Please ensure that the NVIDIA device files (/dev/nvidia*) exist, and that user 124 has read and write permissions for those files.

由于安装的cuda的版本是384,所以内核接口不兼容

  1. 移除旧的nvidia显卡驱动
#remove old version
sudo apt-get purse nvidia*
#stop grafical interface
sudo service lightdm stop
  1. 重新安装内核接口
    download link: http://www.nvidia.cn/Download/index.aspx?lang=en
    下载后的nvidia图形化驱动NVIDIA-Linux-x86_64-384.90.run
    安装文档链接:http://us.download.nvidia.com/XFree86/Linux-x86_64/384.90/README/installdriver.html
#install kernel interface
cd yourdirectory
sh ./NVIDIA-Linux-x86_64-384.90.run --add-this-kernel

#run the executable
sh NVIDIA-Linux-x86_64-384.90.run

nvidia-installer会被安装在/usr/bin/nvidia-installer路径下

  1. 测试nvidia显卡是否正常工作
nvidia-smi
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 384.90                 Driver Version: 384.90                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  Quadro K1200        Off  | 00000000:01:00.0  On |                  N/A |
| 39%   38C    P8     1W /  35W |   3742MiB /  4041MiB |      0%      Default |
+-------------------------------+----------------------+----------------------+

+-----------------------------------------------------------------------------+
| Processes:                                                       GPU Memory |
|  GPU       PID   Type   Process name                             Usage      |
|=============================================================================|
|    0      6150      G   /usr/lib/xorg/Xorg                           216MiB |
|    0      6581      G   compiz                                       107MiB |
|    0     10327      C   python                                      3405MiB |
+-----------------------------------------------------------------------------+
5. 启动ubuntu图形化界面

sudo service lightdm start

可以看到图形化桌面可以正常使用

你可能感兴趣的:(安装CUDA后重启ubuntu不能登入图形化界面)