CentOS に NVIDIA のビデオドライバーをインストール
〜 OS をアップデートしたら X-Window が起動しなくなった 〜

2015-08-26 作成 福島
TOP > tips > centos-nvidia
1. 症状
CentOS 6.7 をアップデート (yum) したら、GDM が表示されなくなった。
※ ps aux | grep gnome しても、何も表示されない。



2. ランレベルを 5(GUI) → 3(マルチユーザー) へ切り替えて再起動

/root/# cd /etc/
/etc/# cp -p inittab inittab-bak
/etc/# vi inittab
id:3:initdefault:
/etc/# shutdown -r now

(・・・再起動後・・・)

/root/# startx
X-Window が起動しない
waiting for X server to shut down  Server terminated successfully (0). Closing log file.
/root/# cat /var/log/Xorg.0.log | grep '(EE)'
nouveau_dri.so が開けないらしい
        (WW) warning, (EE) error, (NI) not implemented, (??) unknown.
[    51.302] (EE) AIGLX error: dlopen of /usr/lib64/dri/nouveau_dri.so failed (/usr/lib64/dri/nouveau_dri.so: cannot open shared object file: No such file or directory)
[    51.302] (EE) AIGLX: reverting to software rendering
[    51.387] (EE) PreInit returned 8 for "HDA Intel MID Front Headphone"
[    51.387] (EE) config/hal: NewInputDeviceRequest failed (8)
[    51.537] (EE) PreInit returned 8 for "HDA NVidia HDMI/DP,pcm=9"
[    51.537] (EE) config/hal: NewInputDeviceRequest failed (8)
[    51.563] (EE) PreInit returned 8 for "HDA NVidia HDMI/DP,pcm=8"
[    51.563] (EE) config/hal: NewInputDeviceRequest failed (8)
[    51.591] (EE) PreInit returned 8 for "HDA NVidia HDMI/DP,pcm=7"
[    51.591] (EE) config/hal: NewInputDeviceRequest failed (8)
[    51.617] (EE) PreInit returned 8 for "HDA NVidia HDMI/DP,pcm=3"
[    51.617] (EE) config/hal: NewInputDeviceRequest failed (8)
[    51.534] (EE) Server terminated successfully (0). Closing log file.
/root/# ls -l /usr/lib64/dri/nouveau_dri.so
ls: cannot access /usr/lib64/dri/nouveau_dri.so: そのようなファイルやディレクトリはありません

3. 対処

使用しているビデオカードを確認
/root/# lspci | grep -i VGA
1:00.0 VGA compatible controller: NVIDIA Corporation GT218 [GeForce 8400 GS Rev. 3] (rev a2)

NVIDIA のドライバーダウンロードページから、使用するドライバーをダウンロード
例: NVIDIA-Linux-x86_64-340.76.run

GCC とカーネルソースをインストール
/root/# yum -y install gcc kernel-devel
インストール:
  gcc.x86_64 0:4.4.7-16.el6       kernel-devel.x86_64 0:2.6.32-573.3.1.el6

依存性関連をインストールしました:
  cloog-ppl.x86_64 0:0.15.7-1.2.el6          cpp.x86_64 0:4.4.7-16.el6
  mpfr.x86_64 0:2.4.1-6.el6                  ppl.x86_64 0:0.10.2-11.el6

完了しました!
grub.conf を書き換えて再起動

/root/# cd /boot/grub/
/boot/grub/# cp -p grub.conf grub.conf-bak
/boot/grub/# vi grub.conf
kernel ・・・ の行に "nomodeset" を追加
title CentOS (2.6.32-573.3.1.el6.x86_64)
        root (hd0,0)
        kernel /vmlinuz-2.6.32-573.3.1.el6.x86_64 ro root=/dev/mapper/vg-lv_root rd_NO_LUKS rd_LVM_LV=vg/lv_root rd_NO_MD rd_LVM_LV=vg/lv_swap crashkernel=128M  KEYBOARDTYPE=pc KEYTABLE=jp106 LANG=ja_JP.UTF-8 rd_NO_DM rhgb quiet nomodeset
        initrd /initramfs-2.6.32-573.3.1.el6.x86_64.img
/boot/grub/# shutdown -r now

(再起動後)

ダウンロードしたドライバーをインストール (/var/tmp/ にファイルがあるものと仮定)
/root/# cd /var/tmp/
/var/tmp/# sh NVIDIA-Linux-x86_64-340.76.run
ライセンスの受諾 (Accept を選択する)
          NVIDIA Accelerated Graphics Driver for Linux-x86_64 (340.76)         

                                                                               
  Please read the following LICENSE and then select either "Accept" to accept  
  the license and continue with the installation, or select "Do Not Accept" to 
  abort the installation.                                                      
                                                                               
                        Accept                 Do Not Accept                   
                                                                               
            License For Customer Use of NVIDIA Software


  IMPORTANT NOTICE -- READ CAREFULLY: This License For Customer Use of
  NVIDIA Software ("LICENSE") is the agreement which governs use of
  the software of NVIDIA Corporation and its subsidiaries ("NVIDIA")
  downloadable herefrom, including computer software and associated
  printed materials ("SOFTWARE").  By downloading, installing, copying,

  NVIDIA Software License                                                  Top 
32bit のドライバーはインストールしない (どちらでも良い)
          NVIDIA Accelerated Graphics Driver for Linux-x86_64 (340.76)         




                                                                               
  Install NVIDIA's 32-bit compatibility libraries?                             
                                                                               
                          Yes                       No                         
                                                                               








  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 
OK を選択して次に進む
          NVIDIA Accelerated Graphics Driver for Linux-x86_64 (340.76)         

                                                                               
  nvidia-installer will install the libvdpau and libvdpau_trace libraries that 
  were included with this installer package. These libraries are available     
  separately through the libvdpau project and will be removed from the NVIDIA  
  Linux driver installer package in the future, so it is recommended that      
  VDPAU users install libvdpau separately, e.g. by using packages available    
  from their distributions, or by building from the sources available at:      
                                                                               
 http://people.freedesktop.org/~aplattner/vdpau                                
                                                                               
                                       OK                                      
                                                                               



  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 
NO (デフォルト) を選択して次に進む
          NVIDIA Accelerated Graphics Driver for Linux-x86_64 (340.76)         


                                                                               
  Would you like to run the nvidia-xconfig utility to automatically update     
  your X configuration file so that the NVIDIA X driver will be used when you  
  restart X?  Any pre-existing X configuration file will be backed up.         
                                                                               
                          Yes                       No                         
                                                                               





  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 
OK を選択してインストーラーを終了する
          NVIDIA Accelerated Graphics Driver for Linux-x86_64 (340.76)         


                                                                               
  Installation of the NVIDIA Accelerated Graphics Driver for Linux-x86_64      
  (version: 340.76) is now complete.  Please update your XF86Config or         
  xorg.conf file as appropriate; see the file                                  
  /usr/share/doc/NVIDIA_GLX-1.0/README.txt for details.                        
                                                                               
                                       OK                                      
                                                                               





  NVIDIA Software Installer for Unix/Linux                      www.nvidia.com 

デスクトップ関係のパッケージを入れ直し
/var/tmp/# yum -y groupinstall "Desktop" "Desktop Platform" "General Purpose Desktop"
インストール:
  cheese.x86_64 0:2.28.1-8.el6
  compiz-gnome.x86_64 0:0.8.2-24.el6
  control-center.x86_64 1:2.28.1-39.el6
  control-center-extra.x86_64 1:2.28.1-39.el6
  gdm.x86_64 1:2.30.4-64.el6
  gdm-plugin-fingerprint.x86_64 1:2.30.4-64.el6
  gdm-user-switch-applet.x86_64 1:2.30.4-64.el6
  gnome-applets.x86_64 1:2.28.0-7.el6.centos
  gnome-panel.x86_64 0:2.30.2-15.el6
  gnome-session.x86_64 0:2.28.0-22.el6
  nautilus-sendto.x86_64 0:2.28.2-4.el6
  orca.x86_64 0:2.28.2-1.el6

依存性関連をインストールしました:
  desktop-effects.x86_64 0:0.8.4-7.el6
  evolution-data-server.x86_64 0:2.32.3-23.el6
  gnome-session-xsession.x86_64 0:2.28.0-22.el6
  plymouth-gdm-hooks.x86_64 0:0.8.3-27.el6.centos.1
  pulseaudio-gdm-hooks.x86_64 0:0.9.21-21.el6

完了しました!
xorg.conf の作成
/var/tmp/# /usr/bin/nvidia-xconfig
/var/tmp/# ls -l /etc/X11/xorg.conf
-rw-r--r--. 1 root root 1483  8月 26 16:09 2015 /etc/X11/xorg.conf
ランレベルを 3(マルチユーザー) → 5(GUI) へ戻して再起動

/var/tmp/# cd /etc/
/etc/# mv inittab-bak inittab
/etc/# shutdown -r now
元に戻りました