DL服務器主機環境配置(ubuntu14.04+GTX1080+cuda8.0)解決桌面重復登錄


DL服務器主機環境配置(ubuntu14.04+GTX1080+cuda8.0)解決桌面重復登錄

前面部分是自己的記錄,后面方案部分是成功安裝驅動+桌面的正解

問題的開始在於:登錄不了桌面,停留在重復輸入密碼界面

博文中分析的結論:
虛擬機中不能直接調用物理顯卡進行 CUDA 編程;虛擬機中運行 CUDA 需要硬件和軟件的配合才能使用,對於一般使用者可能暫時不太可能的。

參考博文:

深度學習主機環境配置: Ubuntu16.04+Nvidia GTX 1080+CUDA8.0

深度學習主機環境配置: Ubuntu16.04+GeForce GTX 1080+TensorFlow

ubuntu14.04+cuda8.0(GTX1080)+caffe安裝

如何搭建一台深度學習服務器

Ctrl+alt+F1進入字符界面,關閉圖形界面

sudo service lightdm stop //必須有,不然會安裝失敗 
sudo /etc/init.d/lightdm stop //一樣的命令

sudo chmod 755 NVIDIA-Linux-x86_64-367.27.run  //獲取權限
sudo ./NVIDIA-Linux-x86_64-367.27.run  //安裝驅動

Accept
Continue installation
安裝完成之后

sudo service lightdm start

圖形界面出現,然后關機,由讓人重復輸入密碼,登錄不了

博主

$ sudo /etc/init.d/gdm stop
$ sudo nvidia-installer --update
$ sudo /etc/init.d/gdm start

升級到375版本, 還是沒用,啟動進入不了桌面,重復登錄

Install driver 367

Uninstall previous nvidia drivers.

$ sudo apt-get purge nvidia-*

Stop light gdm (graphical interface)

$ sudo service lightgdm

Go to tty (CTRL+ALT+F1). Set your init state to 3 (text only mode). It is important to do this. Note these commands on a paper or something. I experienced sometimes the tty does not show with the newest driver. I just ssh to my PC as a way around.

$ sudo init 3

Log in to tty and cd to the directory where your have downloaded the driver.

$ sudo ./NVIDIA-Linux-x86_64-367.35.run

It will ask if you want to install 32-bit libraries, say no (assuming you do not have a 32-bit OS, hopefully. If you do have a 32-bit OS it is a good idea to upgrade…)

In a few minutes it is done….smooth. Reboot your PC

$ sudo reboot

update 之后還是不能進 圖形界面

Uninstall previous nvidia drivers.

sudo apt-get purge nvidia-*
sudo apt-get autoremove
sudo apt-get --purge remove nvidia-*

remove 之后,

nvidia-smi 

還是能看到gpu的。why?

卸載不了?

sudo apt-get install nvidia-prime

$ sudo /etc/init.d/lightdm stop
$ sudo nvidia-installer --update
$ sudo /etc/init.d/lightdm start

升級到375版本, 還是沒用,啟動進入不了桌面,重復登錄

有人說,安裝必須要在安裝桌面前安裝GTX 1080 driver,后面方案驗證來看, 那個參數才是關鍵。

解決方法

利用sudo gedit /etc/modprobe.d/blacklist-nouveau.conf新建blacklist-nouveau.conf文件,輸入命令

blacklist nouveau

blacklist lbm-nouveau

options nouveau modeset=0

alias nouveau off

alias lbm-nouveau off

保存並退出。這一步是為了禁掉Ubuntu自帶開源驅動nouveau。之后sudo reboot重啟系統。在終端執行命令

lsmod | grep nouveau

查看nouveau模塊是否被加載。如果什么都沒輸出,則執行下一步。

根本問題在於 參數: --no-opengl-files

sudo /etc/init.d/lightdm stop
sudo ./NVIDIA-Linux-x86_64-375.20.run --no-opengl-files
sudo /etc/init.d/lightdm start

即可以正常登錄界面了!!

在安裝過程中的選項:

Accept

Continue installation

register the kernel moudle sources with DKMS?

NO

Would you like to run the nvidia-xconfig utility to automatically update your X Configuration file so set the NVIDIA X driver will be used when you restart X?

NO

Install 32-Bit compatibility libraries?參考

NO

cuda8.0安裝

運行

sudo sh cuda_8.0.44_linux.run

選項如下所示:

Description

This package includes over 100+ CUDA examples that demonstrate
various CUDA programming principles, and efficient CUDA
implementation of algorithms in specific application domains.
The NVIDIA CUDA Samples License Agreement is available in
Do you accept the previously read EULA?
accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 367.48?
(y)es/(n)o/(q)uit: n

Install the CUDA 8.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
 [ default is /usr/local/cuda-8.0 ]:

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: y

Install the CUDA 8.0 Samples?
(y)es/(n)o/(q)uit: y

Enter CUDA Samples Location
 [ default is /home/c302 ]:

Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
Installing the CUDA Samples in /home/c302 ...
Copying samples to /home/c302/NVIDIA_CUDA-8.0_Samples now...
Finished copying samples.

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /usr/local/cuda-8.0
Samples:  Installed in /home/c302

Please make sure that
 -   PATH includes /usr/local/cuda-8.0/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /usr/local/cuda-8.0/bin

Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-8.0/doc/pdf for detailed information on setting up CUDA.

***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 361.00 is required for CUDA 8.0 functionality to work.
To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
    sudo <CudaInstaller>.run -silent -driver

Logfile is /tmp/cuda_install_9045.log

設置環境變量

export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH

添加系統變量修改到系統文件
sudo vi /etc/profile

在最后添加上面兩句,然后保存。使立即生效

sudo ldconfig //環境變量立即生效

驗證 cuda

c302@c302-dl:~/Downloads$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Sun_Sep__4_22:14:01_CDT_2016
Cuda compilation tools, release 8.0, V8.0.44

測試cuda的samples

cd ‘/home/zhou/NVIDIA_CUDA-8.0_Samples’
make  //這里需要點時間

最后顯示:

make[1]: Leaving directory `/home/c302/NVIDIA_CUDA-8.0_Samples/7_CUDALibraries/MersenneTwisterGP11213'

Finished building CUDA samples

cd 0_Simple/matrixMul

運行測試如下:

c302@c302-dl:~/NVIDIA_CUDA-8.0_Samples/0_Simple/matrixMul$ ./matrixMul
[Matrix Multiply Using CUDA] - Starting...
GPU Device 0: "GeForce GTX 1080" with compute capability 6.1

MatrixA(320,320), MatrixB(640,320)
Computing result using CUDA Kernel...
done
Performance= 1109.06 GFlop/s, Time= 0.118 msec, Size= 131072000 Ops, WorkgroupSize= 1024 threads/block
Checking computed result for correctness: Result = PASS

NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.

下一篇將會是安裝cuDNN、tensorflow等lib


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM