The Kernel which is required to install nvidia-driver-390 is 5.15.0-121-generic ,The Command to install this kernel is :
sudo apt install linux-image-5.15.0-121-generic
And after installing 5.15 kernel you will have to delete the previous kernel. To Do that first identify the kernels which are currently installed by the following command :
dpkg --list | grep linux-image
after that choose the kernel you want to delete
for example after running the above command you will see something like this :
phantom@PhantomBox:~$ dpkg --list | grep linux-image
ii linux-image-5.15.0-121-generic 5.15.0-121.131 amd64 Signed kernel image generic
rc linux-image-5.15.0-82-generic 5.15.0-82.91 amd64 Signed kernel image generic
rc linux-image-6.5.0-35-generic 6.5.0-35.35~22.04.1 amd64 Signed kernel image generic
rc linux-image-6.8.0-40-generic 6.8.0-40.40~22.04.3 amd64 Signed kernel image generic
ii linux-image-generic 5.15.0.121.121 amd64 Generic Linux kernel image
rc linux-image-unsigned-5.15.0-82-generic 5.15.0-82.91 amd64 Linux kernel image for version 5.15.0 on 64 bit x86 SMP
rc linux-image-unsigned-6.0.0-060000-generic 6.0.0-060000.202210022231 amd64 Linux kernel image for version 6.0.0 on 64 bit x86 SMP
Delete the version 6.xx kernels by the command :
sudo apt remove linux-image-6.8.0-40-generic
I Chose version 6.8.0-40 as an example it may be differnt for you and delete all 6.xx kernels i only deleted 1 for example
After that remove the old driver files for a clean install by :
sudo apt-get purge 'nvidia-*'
sudo apt-get autoremove
sudo apt-get autoclean
sudo dpkg --purge $(dpkg -l | grep nvidia | awk '{print $2}')
After that install the 390 drivers :
sudo apt-get install build-essential dkms
sudo apt-get install linux-headers-$(uname -r)
sudo apt-get install nvidia-driver-390
And if an error occurs your best bet would be installing drivers via .run file.
[Note : If installation is successful but after rebooting black lines appear or the boot is stuck reboot into recovery and run this command :
sudo apt-get purge 'nvidia-*'
]