Linux(Centos7.7)下安装GPU驱动报unable to find kernel source的问题

	在Linux(Centos7.7)下安装GPU A100的驱动时,启用命令行界面,运行Nvidia Driver .run的安装包后,发现报错:Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured on Red Hat Linux system.be sure you have the 'kernel-source' or 'kernel-devel' RPM installed .If you know the correct kernel source files are installed ,you may specify the kernel source path with the '--kernel-source-path' command line option.

错误的原因是运行的系统内核版本与kernel-source kernel-devel等不一致。
运行uname -r 和rpm -qa | grep kernel 对比发现,运行内核版本确实与相关的devel headers的版本号不一致,发现devel的版本号较新,运行yum install 安装与kernel devel 一致的内核。随后切换默认的启动内核版本。

1.查看当前默认内核
grub2-editenv list
2.查看已有内核
cat /boot/grub2/grub.cfg |grep menuentry
3.更换默认启动内核
grub2-set-default ‘CentOS (3.10.2.el7.x86_64) 24 (Workstation Edition)’
4. 备份并重新生成grub信息
grub2-mkconfig -o /boot/grub2/grub.cfg
5.重启系统
reboot

切换完成后,再次运行安装驱动程序。安装成功!
报错的根本原因是内核版本与其他的内核相关kernel包版本不一致。

你可能感兴趣的:(linux,centos,nvidia)