環境
Amazon Linux2
インスタンスタイプ
g4dn.2xlarge
gccのversion
[ec2-user@ip ~]$ gcc --version
gcc (GCC) 7.3.1 20180712 (Red Hat 7.3.1-17)
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
[ec2-user@ip ~]$ rpm -q gcc
gcc-7.3.1-17.amzn2.x86_64
kernelのversion
[ec2-user@ip ~]$ uname -r
5.10.228-219.884.amzn2.x86_64
[ec2-user@ip ~]$ rpm -q kernel-devel
kernel-devel-5.10.228-219.884.amzn2.x86_64
やりたいこと
Amazon Linux2に、NVIDIA driver version 525.89.02をインストールしたい。
実施したこと
参考サイト:https://docs.aws.amazon.com/ja_jp/AWSEC2/latest/UserGuide/install-nvidia-driver.html#nvidia-gaming-driver
sudo yum install gcc make
sudo yum update -y
sudo reboot
sudo yum groupinstall -y "Development Tools"
sudo yum install -y kernel-devel-$(uname -r) kernel-headers-$(uname -r)
sudo aws s3 cp s3://nvidia-gaming/linux/525.89.02-Feb2023-Cloud_Gaming-Linux-Guest-Drivers.zip .
sudo unzip 525.89.02-Feb2023-Cloud_Gaming-Linux-Guest-Drivers.zip -d nvidia-drivers
sudo chmod +x nvidia-drivers/NVIDIA-Linux-x86_64*-grid.run
sudo CC=/usr/bin/gcc10-cc ./nvidia-drivers/NVIDIA-Linux-x86_64*.run
結果
エラーログ
/var/log/nvidia-installer.logの851行目~903行目を抜粋します。
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'rcu_read_unlock_strict'
make[5]: *** [/tmp/selfgz21584/NVIDIA-Linux-x86_64-525.89.02-grid/kernel/Module.symvers] Error 1
make[5]: Target `__modpost' not remade because of errors.
make[4]: *** [modules] Error 2
make[3]: *** [modules] Error 2
make[2]: *** [__sub-make] Error 2
make[2]: Target `modules' not remade because of errors.
make[2]: Leaving directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
make: *** [modules] Error 2
-> Checking to see whether the nvidia kernel module was successfully built
executing: 'cd ./kernel; /bin/make -k -j8 NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/5.10.228-219.884.amzn2.x86_64/source" SYSOUT="/lib/modules/5.10.228-219.884.amzn2.x86_64/build" NV_KERNEL_MODULES="nvidia"'...
make[1]: Entering directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
/bin/make -f Makefile.kernel CROSS_COMPILE="gcc10-" CC="/usr/bin/gcc10-cc" HOSTCC="gcc10-gcc" HOSTCXX="gcc10-g++" LD="ld" modules
make[2]: Entering directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
/bin/make -f Makefile.kernel CROSS_COMPILE="gcc10-" CC="/usr/bin/gcc10-cc" HOSTCC="gcc10-gcc" HOSTCXX="gcc10-g++" LD="ld" modules
scripts/Makefile.lib:8: 'always' is deprecated. Please use 'always-y' instead
MODPOST /tmp/selfgz21584/NVIDIA-Linux-x86_64-525.89.02-grid/kernel/Module.symvers
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'rcu_read_unlock_strict'
make[5]: *** [/tmp/selfgz21584/NVIDIA-Linux-x86_64-525.89.02-grid/kernel/Module.symvers] Error 1
make[5]: Target `__modpost' not remade because of errors.
make[4]: *** [modules] Error 2
make[3]: *** [modules] Error 2
make[2]: *** [__sub-make] Error 2
make[2]: Target `modules' not remade because of errors.
make[2]: Leaving directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
make: *** [modules] Error 2
-> Error.
ERROR: An error occurred while performing the step: "Checking to see whether the nvidia kernel module was successfully built". See /var/log/nvidia-installer.log for details.
-> The command `cd ./kernel; /bin/make -k -j8 NV_EXCLUDE_KERNEL_MODULES="" SYSSRC="/lib/modules/5.10.228-219.884.amzn2.x86_64/source" SYSOUT="/lib/modules/5.10.228-219.884.amzn2.x86_64/build" NV_KERNEL_MODULES="nvidia"` failed with the following output:
make[1]: Entering directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
/bin/make -f Makefile.kernel CROSS_COMPILE="gcc10-" CC="/usr/bin/gcc10-cc" HOSTCC="gcc10-gcc" HOSTCXX="gcc10-g++" LD="ld" modules
make[2]: Entering directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
/bin/make -f Makefile.kernel CROSS_COMPILE="gcc10-" CC="/usr/bin/gcc10-cc" HOSTCC="gcc10-gcc" HOSTCXX="gcc10-g++" LD="ld" modules
scripts/Makefile.lib:8: 'always' is deprecated. Please use 'always-y' instead
MODPOST /tmp/selfgz21584/NVIDIA-Linux-x86_64-525.89.02-grid/kernel/Module.symvers
FATAL: modpost: GPL-incompatible module nvidia.ko uses GPL-only symbol 'rcu_read_unlock_strict'
make[5]: *** [/tmp/selfgz21584/NVIDIA-Linux-x86_64-525.89.02-grid/kernel/Module.symvers] Error 1
make[5]: Target `__modpost' not remade because of errors.
make[4]: *** [modules] Error 2
make[3]: *** [modules] Error 2
make[2]: *** [__sub-make] Error 2
make[2]: Target `modules' not remade because of errors.
make[2]: Leaving directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
make[1]: *** [modules] Error 2
make[1]: Leaving directory `/usr/src/kernels/5.10.228-219.884.amzn2.x86_64'
make: *** [modules] Error 2
ERROR: The nvidia kernel module was not created.
ERROR: Installation has failed. Please see the file '/var/log/nvidia-installer.log' for details. You may find suggestions on fixing installation problems in the README available on the Linux driver download page at www.nvidia.com.
解決案について
GCCとKernelのversionが原因だと睨んでいます。
どのように対策すればよいでしょうか?
gcc --version
なのになぜそれとは違うCC=/usr/bin/gcc10-cc
を指定しているのでしょうか?