0

I am tring to install nvidia driver by the following command.

sudo ./NVIDIA-Linux-x86_64-418.43.run --dkms -s

Here I got an error as follows.

ERROR: Failed to run `/sbin/dkms build -m nvidia -v 418.43 -k 3.10.0-1062.el7.x86_64`: Error! echo
   Your kernel headers for kernel 3.10.0-1062.el7.x86_64 cannot be found at
   /lib/modules/3.10.0-1062.el7.x86_64/build or /lib/modules/3.10.0-1062.el7.x86_64/source.
   You can use the --kernelsourcedir option to tell DKMS where it's located.


ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try installing again without DKMS, or check the DKMS logs for more
       information.

However, /lib/modules/3.10.0-1062.el7.x86_64/build and /lib/modules/3.10.0-1062.el7.x86_64/source are both in my /lib/modules path.

# cd /lib/modules/3.10.0-1062.el7.x86_64
# ls -la
lrwxrwxrwx.  1 root root     39 7月   2 11:11 build -> /usr/src/kernels/3.10.0-1062.el7.x86_64
lrwxrwxrwx.  1 root root      5 7月   2 11:11 source -> build

I have tried sudo yum install "kernel-devel-uname-r == $(uname -r)" in a similar question which doesn't work, it said

No package kernel-devel-uname-r == 3.10.0-1062.el7.x86_64 available

This is my output of uname -r

3.10.0-1062.el7.x86_64

And this is the kernel related packages

kernel.x86_64                  3.10.0-1062.el7                                                       
kernel.x86_64                  3.10.0-1160.31.1.el7              
kernel-devel.x86_64            3.10.0-1160.31.1.el7                                    
kernel-headers.x86_64          3.10.0-1160.31.1.el7                                                            

How can I solve this?

2
  • Can you post the output of lspci | grep 3D? Forgot to ask: are you running this in a VM or is it bare metal?
    – telometto
    Commented Jul 4, 2021 at 5:18
  • @telometto the output is 1b:00.0 3D controller: NVIDIA Corporation TU104GL [Tesla T4] (rev a1). I am runnning on a CentOS server.
    – jasonshu
    Commented Jul 4, 2021 at 7:00

1 Answer 1

2

The simplest option would appear to be a reboot, so that the running kernel matches the installed headers (1160.31.1).

Otherwise you’d have to find the header package for your older kernel (1062).

1
  • Quite right. Thanks Stephen. I had spent almost a day to find the right answer.
    – jasonshu
    Commented Jul 4, 2021 at 7:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .