Celeb Glow
general | March 21, 2026

Why do I get "/sbin/ldconfig.real: /usr/local/cuda/lib64/libcudnn.so.7 is not a symbolic link"?

After installing CUDA toolkit and cuDNN successfully without any issues, whenever I do :

sudo ldconfig 

I get the :

/sbin/ldconfig.real: /usr/local/cuda/lib64/libcudnn.so.7 is not a symbolic link

error message.
what is the reason and how can I resolve this?

By the way, I have installed cuDNN like this :

 # cuDNN, extracts to a folder named cuda tar xvf cudnn*.tgz cd cuda sudo cp lib64/* /usr/local/cuda/lib64 sudo cp include/* /usr/local/cuda/include

The output of ls -lha libcudnn* in /usr/local/cuda/lib64 is as follows:

breeze@breeze:/usr/local/cuda/lib64$ ls -lha libcudnn*
-rwxr-xr-x 1 root root 275M آوریل 15 12:03 libcudnn.so
-rwxr-xr-x 1 root root 275M آوریل 15 12:03 libcudnn.so.7
-rwxr-xr-x 1 root root 275M آوریل 15 12:03 libcudnn.so.7.0.5
-rw-r--r-- 1 root root 268M آوریل 15 12:03 libcudnn_static.a

2 Answers

Thanks to dear God I found the solution using this link.

This may happen when you run sudo ldconfig after copying cuDNN files.

After installing cuDNN, copying the extracted files to /usr/lib/cuda/lib64 and creating the symlinks, things may go wrong with the symlinks.

So go to /usr/local/cuda/lib64/ and run ls -lha libcudnn*.

You should see two symlinks (bold teal) and one single file. Something like this:

/usr/local/cuda/lib64$ ls -lha libcudnn*
lrwxrwxrwx 1 root root 13 Dez 25 23:56 libcudnn.so -> libcudnn.so.5
lrwxrwxrwx 1 root root 17 Dez 25 23:55 libcudnn.so.5 -> libcudnn.so.5.1.5
-rwxr-xr-x 1 root root 76M Dez 25 23:27 libcudnn.so.5.1.5

The exact version of libcudnn.so.5.1.5 maybe be a little different for you (maybe libcudnn.so.5.1.10). In that case, adapt the code accordingly

If libcudnn.so and libcudnn.so.5 are not symlinks then this is the reason why you got this error. If so, this is what you need to do:

/usr/local/cuda/lib64$ sudo rm libcudnn.so
/usr/local/cuda/lib64$ sudo rm libcudnn.so.5
/usr/local/cuda/lib64$ sudo ln libcudnn.so.5.1.5 libcudnn.so.5
/usr/local/cuda/lib64$ sudo ln libcudnn.so.5 libcudnn.so
Run sudo ldconfig again and there should be no errors

After running the ls -lha libcudnn* in /usr/local/cuda/lib64 and seeing :

breeze@breeze:/usr/local/cuda/lib64$ ls -lha libcudnn*
-rwxr-xr-x 1 root root 275M آوریل 15 12:03 libcudnn.so
-rwxr-xr-x 1 root root 275M آوریل 15 12:03 libcudnn.so.7
-rwxr-xr-x 1 root root 275M آوریل 15 12:03 libcudnn.so.7.0.5
-rw-r--r-- 1 root root 268M آوریل 15 12:03 libcudnn_static.a

I had to do :

breeze@breeze:/usr/local/cuda/lib64$ sudo rm libcudnn.so
[sudo] password for breeze:
breeze@breeze:/usr/local/cuda/lib64$ sudo rm libcudnn.so.7
breeze@breeze:/usr/local/cuda/lib64$ sudo ln libcudnn.so.7.0.5 libcudnn.so.7
breeze@breeze:/usr/local/cuda/lib64$ sudo ln libcudnn.so.7 libcudnn.so
breeze@breeze:/usr/local/cuda/lib64$ sudo ldconfig

And everything is back to normal:)

1

Check

wxf:/usr/local/cuda/lib64$ ls -al libcudnn.so*
...
...
-rwxr-xr-x 3 root root 302770160 Jan 27 14:30 libcudnn.so NO link
-rwxr-xr-x 3 root root 302770160 Jan 27 14:30 libcudnn.so.7 NO link
-rwxr-xr-x 3 root root 302770160 Jan 27 14:30 libcudnn.so.7.3.1
-rwxr-xr-x 1 root root 349141232 Jan 27 14:30 libcudnn.so.7.4.2
...
...

No link ->

(check all links: sudo ldconfig -v)

Because

(cudnn downloaded from nvidia has symbolic link)

wxf:~/cudnn/cuda/lib64$ ls -al
total 974632
drwxrwxr-x 2 wxf wxf 4096 Jan 19 19:50 .
drwxrwxr-x 4 wxf wxf 4096 Jan 19 19:50 ..
lrwxrwxrwx 1 wxf wxf 13 Dec 12 01:58 libcudnn.so -> libcudnn.so.7
lrwxrwxrwx 1 wxf wxf 17 Dec 12 01:58 libcudnn.so.7 -> libcudnn.so.7.4.2
-rwxrwxr-x 1 wxf wxf 302770160 Sep 21 01:36 libcudnn.so.7.3.1
-rwxrwxr-x 1 wxf wxf 349141232 Dec 12 01:30 libcudnn.so.7.4.2
-rw-rw-r-- 1 wxf wxf 346085818 Dec 12 01:30 libcudnn_static.a

When we copy, we lost symbolic info.

Go to /usr/local/cuda/lib64

sudo ln -sf libcudnn.so.7.4.2 libcudnn.so.7
sudo ln -sf libcudnn.so.7 libcudnn.so

Now,

wxf:/usr/local/cuda/lib64$ ls -al libcudnn.so*
...
...
lrwxrwxrwx 1 root root 13 Jan 27 14:43 libcudnn.so -> libcudnn.so.7
lrwxrwxrwx 1 root root 17 Jan 27 14:43 libcudnn.so.7 -> libcudnn.so.7.4.2
-rwxr-xr-x 1 root root 302770160 Jan 27 14:30 libcudnn.so.7.3.1
-rwxr-xr-x 1 root root 349141232 Jan 27 14:30 libcudnn.so.7.4.2
...
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy