My ThinkPad-P16-Gen-2's ubuntu22.04 kernel is 5.15.0,which cannot successfully install nvidia driver with commad:
sudo apt install nvidia-driver-545
To solve this problem, we have to upgrade the kernel from 5.15.0 to 5.19.0 which you can download from:Index of /mainline
and then use the following command to install the 5.19.0 kernel in the folder:
sudo dpkg -i linux-*
sudo update-grub
and then reboot the laptop to ensure your ubuntu22.04 is using kernel with version 5.19.0.
when it comes to install the nvidia driver, you should follow the traditional way like below:
sudo gedit /etc/modprobe.d/blacklist.conf
blacklist nouveau
options nouveau modeset=0
sudo apt-get update
sudo apt-get install build-essential
After the update,input the following command to check whether nouveau is turned off.
lsmod | grep nouveau
If there is no output, it means sucess, or you should reboot your laptop.
then use the following command to install nvidia driver
sudo apt install nvidia-driver-545