Can not install cudnn in Ubuntu2204 with cuda 12.1

I am downloading the cuda12.1 in my ubuntu2204, and it works:

XXX@XXX:~/XXX$ nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Mon_Apr__3_17:16:06_PDT_2023
Cuda compilation tools, release 12.1, V12.1.105
Build cuda_12.1.r12.1/compiler.32688072_0

However when I follow the guide of cudnn installation in cudnn-installation, Something goes wrong when I run the code sudo apt-get install libcudnn8=
it said "can not find the version of “”

I solved this by using sudo apt-get install libcudnn8= And this pass the cudnn test. I think this is because that cudnn+cuda12.2 can be compatible with cudnn-cuda12.1.
I find this through the previous command sudo apt-get update, executing this command then it outputs something like “file: /var/cudnn…”, I step into this folder and find that there are deb files which name contain cuda-12.2, So I have a try and it succeeds.