22 KiB
Linux How To - SL5 - Nvidia Driver Installation/Update On SL51 i386
References
- https://wiki.intranet.psi.ch/AIT/Linux/HowToDKMS?skin=clean.nat%2cpsiskin%2cpattern #Update_nvidia_x11_drv_driver_to
- [[DynamicKernelModuleSupportBasics][Dynamic Kernel Module Support (DKMS) Basics]]
Requirements
DKMS (Dynamic Kernel Module Support) framework has to be installed before the nvidia RPM installation, because the RPM scripts use it for proper setup:
# yum install dkms.noarch
Procedure
Check what graphic card is in your computer and what driver is installed:
# lspci
...
01:00.0 VGA compatible controller: nVidia Corporation G72 [GeForce 7300 LE] (rev a1)
# less /etc/X11/xorg.conf
(See the output below at "before nvidia installation".)
# rpm -qa | grep nvid
(nothing found)
Before beginning with the installation of the new graphics driver, make a backup of your current `xorg.conf`:
# cd /etc/X11/
# cp xorg.conf xorg.conf_bak
Check whether some nvidia driver is available:
# [root@pc7377 X11]# yum list | grep nvidia
nvidia-x11-drv.i386 100.14.19-3.9.slp5 sl51psi
# [root@pc7377 X11]# yum install nvidia-x11-drv.i386
### begin output
Loading "kernel-module" plugin
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for nvidia-x11-drv to pack into transaction set.
nvidia-x11-drv-100.14.19- 100% |=========================| 24 kB 00:00
---> Package nvidia-x11-drv.i386 0:100.14.19-3.9.slp5 set to be updated
--> Running transaction check
--> Processing Dependency: dkms for package: nvidia-x11-drv
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for dkms to pack into transaction set.
dkms-2.0.17.4-1.9.slp5.no 100% |=========================| 36 kB 00:00
---> Package dkms.noarch 0:2.0.17.4-1.9.slp5 set to be updated
--> Running transaction check
Beginning Kernel Module Plugin
Finished Kernel Module Plugin
Dependencies Resolved
=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
nvidia-x11-drv i386 100.14.19-3.9.slp5 sl51psi 7.1 M
Installing for dependencies:
dkms noarch 2.0.17.4-1.9.slp5 sl51psi 89 k
Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 7.2 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): nvidia-x11-drv-100 100% |=========================| 7.1 MB 00:00
(2/2): dkms-2.0.17.4-1.9. 100% |=========================| 89 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: dkms ######################### [1/2]
Installing: nvidia-x11-drv ######################### [2/2]
Installed: nvidia-x11-drv.i386 0:100.14.19-3.9.slp5
Dependency Installed: dkms.noarch 0:2.0.17.4-1.9.slp5
Complete!
[root@pc7377 X11]# dkms status -m nvidia
nvidia, 100.14.19-3.9.slp5, 2.6.18-92.1.10.el5, i686: installed
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.4.el5, i686: installed-weak from 2.6.18-92.1.10.el5
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.21.el5, i686: installed-weak from 2.6.18-92.1.10.el5
[root@pc7377 X11]# rpm -q --scripts nvidia-x11-drv-100
package nvidia-x11-drv-100 is not installed
[root@pc7377 X11]# rpm -q --scripts nvidia-x11-drv
postinstall scriptlet (using /bin/sh):
/sbin/ldconfig
# Make sure we have a Files section in xorg.conf, otherwise create an empty one
XORGCONF=/etc/X11/xorg.conf
[ -w ${XORGCONF} ] && ! grep -q 'Section "Files"' ${XORGCONF} && \
echo -e 'Section "Files"\nEndSection' >> ${XORGCONF}
# Enable the proprietary driver
/usr/sbin/nvidia-config-display enable || :
# Add to DKMS registry
dkms add -m nvidia -v 100.14.19-3.9.slp5 -q || :
# Rebuild and make available for the currenty running kernel
dkms build -m nvidia -v 100.14.19-3.9.slp5 -q || :
dkms install -m nvidia -v 100.14.19-3.9.slp5 -q --force || :
/sbin/MAKEDEV nvidia
preuninstall scriptlet (using /bin/sh):
# Remove all versions from DKMS registry
dkms remove -m nvidia -v 100.14.19-3.9.slp5 -q --all || :
# Last removal, disable the proprietary driver
if [ $1 -eq 0 ]; then
/usr/sbin/nvidia-config-display disable || :
fi
postuninstall program: /sbin/ldconfig
### end output
Check the status of the nvidia kernel module. (From the dkms manpage: dkms status returns the current status of modules, versions and kernels within the tree as well as whether they have been added, built or installed.):
# dkms status -m nvidia
nvidia, 100.14.19-3.9.slp5, 2.6.18-92.1.10.el5, i686: installed
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.4.el5, i686: installed-weak from 2.6.18-92.1.10.el5
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.21.el5, i686: installed-weak from 2.6.18-92.1.10.el5
List the package specific scriptlet(s) that are used as part of the installation and uninstallation processes:
# rpm -q --scripts nvidia-x11-drv
### begin output
postinstall scriptlet (using /bin/sh):
/sbin/ldconfig
# Make sure we have a Files section in xorg.conf, otherwise create an empty one
XORGCONF=/etc/X11/xorg.conf
[ -w ${XORGCONF} ] && ! grep -q 'Section "Files"' ${XORGCONF} && \
echo -e 'Section "Files"\nEndSection' >> ${XORGCONF}
# Enable the proprietary driver
/usr/sbin/nvidia-config-display enable || :
# Add to DKMS registry
dkms add -m nvidia -v 100.14.19-3.9.slp5 -q || :
# Rebuild and make available for the currenty running kernel
dkms build -m nvidia -v 100.14.19-3.9.slp5 -q || :
dkms install -m nvidia -v 100.14.19-3.9.slp5 -q --force || :
/sbin/MAKEDEV nvidia
preuninstall scriptlet (using /bin/sh):
# Remove all versions from DKMS registry
dkms remove -m nvidia -v 100.14.19-3.9.slp5 -q --all || :
# Last removal, disable the proprietary driver
if [ $1 -eq 0 ]; then
/usr/sbin/nvidia-config-display disable || :
fi
postuninstall program: /sbin/ldconfig
### end output
Check whether your xorg.conf was modified to use the nvidia driver:
# less /etc/X11/xorg.conf
### begin output
(after nvidia installation) # (before nvidia installation)
# Xorg configuration created by pyxf86config # # Xorg configuration created by pyxf86config
#
Section "ServerLayout" # Section "ServerLayout"
Identifier "Default Layout" # Identifier "Default Layout"
Screen 0 "Screen0" 0 0 # Screen 0 "Screen0" 0 0
InputDevice "Keyboard0" "CoreKeyboard" # InputDevice "Keyboard0" "CoreKeyboard"
EndSection # EndSection
#
Section "Files" #
ModulePath "/usr/lib/xorg/modules/extensions/nvidia" #
ModulePath "/usr/lib/xorg/modules" #
EndSection #
#
Section "InputDevice" # Section "InputDevice"
Identifier "Keyboard0" # Identifier "Keyboard0"
Driver "kbd" # Driver "kbd"
Option "XkbModel" "pc105" # Option "XkbModel" "pc105"
Option "XkbLayout" "ch" # Option "XkbLayout" "ch"
Option "XkbVariant" "de_nodeadkeys" # Option "XkbVariant" "de_nodeadkeys"
EndSection # EndSection
#
Section "Device" # Section "Device"
Identifier "Videocard0" # Identifier "Videocard0"
Driver "nvidia" # Driver "nv"
EndSection # EndSection
#
Section "Screen" # Section "Screen"
Identifier "Screen0" # Identifier "Screen0"
Device "Videocard0" # Device "Videocard0"
DefaultDepth 24 # DefaultDepth 24
SubSection "Display" # SubSection "Display"
Viewport 0 0 # Viewport 0 0
Depth 24 # Depth 24
EndSubSection # EndSubSection
EndSection # EndSection
### end output #
Test the module with glxgears for instance:
[root@pc7377 ~]# glxgears
11424 frames in 5.0 seconds = 2284.662 FPS
11291 frames in 5.0 seconds = 2258.003 FPS
11244 frames in 5.0 seconds = 2248.682 FPS
11290 frames in 5.0 seconds = 2257.974 FPS
12626 frames in 5.0 seconds = 2525.121 FPS
3439 frames in 5.0 seconds = 687.363 FPS
964 frames in 5.0 seconds = 192.629 FPS
964 frames in 5.0 seconds = 192.620 FPS
1395 frames in 5.0 seconds = 278.978 FPS
12080 frames in 5.0 seconds = 2415.854 FPS
11252 frames in 5.0 seconds = 2250.348 FPS
Problem With Automatic Nvidia Driver Update On SL51 i386
Problem Description
On some systems the automatic nvidia driver update by dkms fails. Somehow when the new RPM nvidia-x11-drv-169.12-4.9.slp5 is installed by yum or rpm, the old nvidia version 100.14.19-3.9.slp5 remains in dkms status added, i.e. the respective directory remains in the dkms tree, while the original driver sources are removed from /usr/src/, i.e. the RPM nvidia-x11-drv-100.14.19-3.9.slp5 was removed.
During reboot the service dkms_autoinstaller (see chkconfig --list) obviously tries to build the old 100.14.19-3.9.slp5 as well because it tries to get the file /var/lib/dkms/nvidia/100.14.19-3.9.slp5/source/dkms.conf. This, however, fails because the .../scource is a symbolic link pointing to the source directory that was removed during the nvidia RPM update as mentioned before:
"source -> /usr/src/nvidia-100.14.19-3.9.slp5"
Though, this basically would not be a problem if dkms was not confused by the occurences of several nvidia versions in its tree under /var/lib/dkms/nvidia/.
The main questions are:
- Why does the update procedure only partially clean the installation environment (under /usr/src/ it is clean, under /var/lib/dkms/nvidia/ it is not)?
- Why does dkms not properly recognize the new nvidia version only but also tries to build modules out of the sources of the older version?
Solution
The problem appears if the nvidia driver RPM is installed or updated before the dkms framework is ready on the system, because the RPM scripts invoke a variety of dkms commands to install the new driver into the dkms tree and to remove the old driver version from it. Thus, one has to install the dkms RPM first, before doing any driver installation or updates.
Manual Update Using DKMS
Perform the following steps:
[root@pc7377 ~]# dkms status -m nvidia
nvidia, 100.14.19-3.9.slp5, 2.6.18-92.1.10.el5, i686: installed
nvidia, 100.14.19-3.9.slp5, 2.6.18-92.1.13.el5, i686: installed
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.4.el5, i686: installed-weak from 2.6.18-92.1.10.el5
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.4.el5, i686: installed-weak from 2.6.18-92.1.13.el5
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.21.el5, i686: installed-weak from 2.6.18-92.1.10.el5
nvidia, 100.14.19-3.9.slp5, 2.6.18-53.1.21.el5, i686: installed-weak from 2.6.18-92.1.13.el5
nvidia, 100.14.19-3.9.slp5, 2.6.18-92.1.10.el5, i686: installed-weak from 2.6.18-92.1.13.el5
[root@pc7377 ~]# uname -a
Linux pc7377 2.6.18-92.1.13.el5 #1 SMP Wed Sep 24 16:44:34 EDT 2008 i686 i686 i386 GNU/Linux
[root@pc7377 ~]# locate nvidia.ko
/lib/modules/2.6.18-53.1.21.el5/weak-updates/lib/modules/2.6.18-92.1.10.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-53.1.21.el5/weak-updates/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-53.1.4.el5/weak-updates/lib/modules/2.6.18-92.1.10.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-53.1.4.el5/weak-updates/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-92.1.10.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-92.1.10.el5/weak-updates/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/var/lib/dkms/nvidia/100.14.19-3.9.slp5/2.6.18-92.1.10.el5/i686/module/nvidia.ko
/var/lib/dkms/nvidia/100.14.19-3.9.slp5/2.6.18-92.1.13.el5/i686/module/nvidia.ko
[root@pc7377 ~]# rpm -q nvidia-x11-drv
nvidia-x11-drv-100.14.19-3.9.slp5
[root@pc7377 ~]# cp -i /etc/X11/xorg.conf /etc/X11/xorg.conf_orig
[root@pc7377 ~]# yum --enablerepo=psi-beta update nvidia-x11-drv
...
=============================================================================
Package Arch Version Repository Size
=============================================================================
Updating:
nvidia-x11-drv i386 169.12-4.9.slp5 psi-beta 9.7 M
Transaction Summary
=============================================================================
Install 0 Package(s)
Update 1 Package(s)
Remove 0 Package(s)
Total download size: 9.7 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): nvidia-x11-drv-169 100% |=========================| 9.7 MB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : nvidia-x11-drv ######################### [1/2]
Cleanup : nvidia-x11-drv ######################### [2/2]
Updated: nvidia-x11-drv.i386 0:169.12-4.9.slp5
Note
yum update takes some time because it invokes dkms, which builds the required module(s) on the fly and does the cleaning up, see nvidia.spec or the output of `rpm -q --scripts RPM`:
[root@pc7377 nvidia]# rpm -q --scripts nvidia-x11-drv-169.12-4.9.slp5 postinstall scriptlet (using /bin/sh): /sbin/ldconfig # Make sure we have a Files section in xorg.conf, otherwise create an empty one XORGCONF=/etc/X11/xorg.conf [ -w ${XORGCONF} ] && ! grep -q 'Section "Files"' ${XORGCONF} && \ echo -e 'Section "Files"\nEndSection' >> ${XORGCONF} # Enable the proprietary driver /usr/sbin/nvidia-config-display enable || : # Add to DKMS registry dkms add -m nvidia -v 169.12-4.9.slp5 -q || : # Rebuild and make available for the currenty running kernel dkms build -m nvidia -v 169.12-4.9.slp5 -q || : dkms install -m nvidia -v 169.12-4.9.slp5 -q --force || : /sbin/MAKEDEV nvidia preuninstall scriptlet (using /bin/sh): # Remove all versions from DKMS registry dkms remove -m nvidia -v 169.12-4.9.slp5 -q --all || : # Last removal, disable the proprietary driver if [ $1 -eq 0 ]; then /usr/sbin/nvidia-config-display disable || : fi postuninstall program: /sbin/ldconfig
Snapshot of output of ps auxwf during `yum update`:
...
\_ /bin/bash
root 16677 0.0 0.0 5968 1668 pts/1 S 17:25 0:00 | \_ su -
root 16681 0.0 0.0 4804 1440 pts/1 S 17:25 0:00 | \_ -bash
root 17409 1.6 2.1 55980 44440 pts/1 S+ 17:43 0:04 | \_ /usr/bin/python /usr/bin/yum --enablerepo=psi-beta
root 17413 0.0 0.0 4452 1028 pts/1 S+ 17:44 0:00 | \_ /bin/sh /var/tmp/rpm-tmp.62532 2
root 18088 0.0 0.0 5112 1764 pts/1 S+ 17:45 0:00 | \_ /bin/bash /usr/sbin/dkms install -m nvidia
root 18188 0.0 0.0 4456 1200 pts/1 S+ 17:45 0:00 | \_ /bin/bash /sbin/weak-modules --add-modu
root 19238 0.0 0.0 4460 692 pts/1 S+ 17:47 0:00 | \_ /bin/bash /sbin/weak-modules --add-
root 19243 5.5 0.0 2004 452 pts/1 D+ 17:47 0:00 | \_ zcat /boot/initrd-2.6.18-53.1.4
root 19244 2.5 0.0 1816 496 pts/1 S+ 17:47 0:00 | \_ cpio -i
...
When the new nvidia RPM was installed the old stuff was not cleaned up properly, the old module sources remained in the dkms tree under /var/lib/dkms/nvidia/ and has to be removed manually:
[root@pc7377 etc]# dkms status -m nvidia
nvidia, 100.14.19-3.9.slp5: added
nvidia, 169.12-4.9.slp5, 2.6.18-92.1.13.el5, i686: installed
nvidia, 169.12-4.9.slp5, 2.6.18-53.1.4.el5, i686: installed-weak from 2.6.18-92.1.13.el5
nvidia, 169.12-4.9.slp5, 2.6.18-53.1.21.el5, i686: installed-weak from 2.6.18-92.1.13.el5
nvidia, 169.12-4.9.slp5, 2.6.18-92.1.10.el5, i686: installed-weak from 2.6.18-92.1.13.el5
# rm -rf /var/lib/dkms/nvidia/100.14.19-3.9.slp5/
# dkms status -m nvidia
nvidia, 169.12-4.9.slp5, 2.6.18-92.1.13.el5, i686: installed
nvidia, 169.12-4.9.slp5, 2.6.18-53.1.4.el5, i686: installed-weak from 2.6.18-92.1.13.el5
nvidia, 169.12-4.9.slp5, 2.6.18-53.1.21.el5, i686: installed-weak from 2.6.18-92.1.13.el5
nvidia, 169.12-4.9.slp5, 2.6.18-92.1.10.el5, i686: installed-weak from 2.6.18-92.1.13.el5
The .../weak-updates/... nvidia modules below are symbolic links to /lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko, which is identical with `/var/lib/dkms/nvidia/169.12-4.9.slp5/2.6.18-92.1.13.el5/i686/module/nvidia.ko`:
[root@pc7377 etc]# updatedb
[root@pc7377 etc]# locate nvidia.ko
/lib/modules/2.6.18-53.1.21.el5/weak-updates/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-53.1.4.el5/weak-updates/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-92.1.10.el5/weak-updates/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/lib/modules/2.6.18-92.1.13.el5/kernel/drivers/video/nvidia/nvidia.ko
/var/lib/dkms/nvidia/169.12-4.9.slp5/2.6.18-92.1.13.el5/i686/module/nvidia.ko
Nvidia related lines in `/var/log/messages`:
...
Oct 23 17:48:12 pc7377 Updated: nvidia-x11-drv.i386 169.12-4.9.slp5
...
Oct 24 11:16:04 pc7377 kernel: NVRM: API mismatch: the client has the version 169.12, but
Oct 24 11:16:04 pc7377 kernel: NVRM: this kernel module has the version 100.14.19. Please
Oct 24 11:16:04 pc7377 kernel: NVRM: make sure that this kernel module and all NVIDIA driver
Oct 24 11:16:04 pc7377 kernel: NVRM: components have the same version.
Oct 24 11:16:05 pc7377 gdm[6706]: gdm_slave_xioerror_handler: Fatal X error - Restarting :0
Oct 24 11:16:09 pc7377 kernel: NVRM: API mismatch: the client has the version 169.12, but
Oct 24 11:16:09 pc7377 kernel: NVRM: this kernel module has the version 100.14.19. Please
Oct 24 11:16:09 pc7377 kernel: NVRM: make sure that this kernel module and all NVIDIA driver
Oct 24 11:16:09 pc7377 kernel: NVRM: components have the same version.
Oct 24 11:16:10 pc7377 gdm[3734]: gdm_slave_xioerror_handler: Fatal X error - Restarting :0
Oct 24 11:16:13 pc7377 kernel: NVRM: API mismatch: the client has the version 169.12, but
Oct 24 11:16:13 pc7377 kernel: NVRM: this kernel module has the version 100.14.19. Please
Oct 24 11:16:13 pc7377 kernel: NVRM: make sure that this kernel module and all NVIDIA driver
Oct 24 11:16:13 pc7377 kernel: NVRM: components have the same version.
Oct 24 11:16:14 pc7377 gdm[3752]: gdm_slave_xioerror_handler: Fatal X error - Restarting :0
Oct 24 11:16:14 pc7377 gdm[6489]: deal_with_x_crashes: Running the XKeepsCrashing script
...
Oct 24 11:27:45 pc7377 kernel: nvidia: module license 'NVIDIA' taints kernel.
Oct 24 11:27:45 pc7377 kernel: ACPI: PCI Interrupt 0000:01:00.0[A] -> GSI 16 (level, low) -> IRQ 169
Oct 24 11:27:45 pc7377 kernel: NVRM: loading NVIDIA UNIX x86 Kernel Module 169.12 Thu Feb 14 17:53:07 PST 2008
...