Problem installing nvidia driver 470 on Ubuntu 20.04.3 LTS

I have a Lenovo IdeaPad Gaming 3 15ARH05 with NVIDIA GeForce GTX 1650 running Ubuntu 20.04.3 LTS. The screen brightness keys were not working so I upgraded the kernel to version 5.15.1 using Ubuntu Mainline Kernel Installer. Upgrading the Kernel allows me to change screen brightness. Since the upgrade I have been unable to install the nvidia drivers.

This is what I see in terminal:

Setting up nvidia-dkms-470 (470.82.01-0ubuntu1) ...
update-initramfs: deferring update (trigger activated)

A modprobe blacklist file has been created at /etc/modprobe.d to prevent Nouveau
from loading. This can be reverted by deleting the following file:

A new initrd image has also been created. To revert, please regenerate your
initrd by running the following command after deleting the modprobe.d file:
`/usr/sbin/initramfs -u`

*** Reboot your computer and verify that the NVIDIA graphics driver can   ***
*** be loaded.                                                            ***

INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
Removing old nvidia-470.82.01 DKMS files...

Deleting module version: 470.82.01
completely from the DKMS tree.
Loading new nvidia-470.82.01 DKMS files...
Building for 5.15.1-051501-generic
Building for architecture x86_64
Building initial module for 5.15.1-051501-generic
ERROR (dkms apport): kernel package linux-headers-5.15.1-051501-generic is not supported
Error! Bad return status for module build on kernel: 5.15.1-051501-generic (x86_64)
Consult /var/lib/dkms/nvidia/470.82.01/build/make.log for more information.
dpkg: error processing package nvidia-dkms-470 (--configure):
 installed nvidia-dkms-470 package post-installation script subprocess returned error exit status 10
dpkg: dependency problems prevent configuration of nvidia-driver-470:
 nvidia-driver-470 depends on nvidia-dkms-470 (= 470.82.01-0ubuntu1); however:
  Package nvidia-dkms-470 is not configured yet.

dpkg: error processing package nvidia-driver-470 (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Processing triggers for initramfs-tools (0.136
ubuntu6.6) ...
update-initramfs: Generating /boot/initrd.img-5.15.1-051501-generic
Errors were encountered while processing:
E: Sub-process /usr/bin/dpkg returned an error code (1)

make.log (44.1 KB)

The ubuntu kernels 5.15 are for 21.10 and require glibc-2.33+ to compile modules, so this won’t work. Rather upgrade the whole system to 21.10 and then use the 5.15 kernel.