Black screen on Ubuntu 22.04 after installing nvidia driver 510

It’s a fresh install of Ubuntu 22.04, I installed nvidia drivers using ubuntu-drivers install, restarted and then I got the black screen with initramfs.

This is my bug report:
nvidia-bug-report.log.gz (132.8 KB)

There doesn’t seem to be any nvidia kernel module installed. Please post the output of
dpkg -l |grep nvidia
and
dkms status

Thanks for the reply, the original issue with the black screen was solved by update-initramfs. However, things don’t work quite well yet. Steam games, for example, start and the music and sounds play, but the screen is black and the mouse become useless.
This is the requested output:

$ dpkg -l |grep nvidia
ii  libnvidia-cfg1-510:amd64                   510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA binary OpenGL/GLX configuration library
ii  libnvidia-common-510                       510.73.05-0ubuntu0.22.04.1              all          Shared files used by the NVIDIA libraries
ii  libnvidia-compute-510:amd64                510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA libcompute package
ii  libnvidia-compute-510:i386                 510.73.05-0ubuntu0.22.04.1              i386         NVIDIA libcompute package
ii  libnvidia-decode-510:amd64                 510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA Video Decoding runtime libraries
ii  libnvidia-decode-510:i386                  510.73.05-0ubuntu0.22.04.1              i386         NVIDIA Video Decoding runtime libraries
ii  libnvidia-egl-wayland1:amd64               1:1.1.9-1.1                             amd64        Wayland EGL External Platform library -- shared library
ii  libnvidia-encode-510:amd64                 510.73.05-0ubuntu0.22.04.1              amd64        NVENC Video Encoding runtime library
ii  libnvidia-encode-510:i386                  510.73.05-0ubuntu0.22.04.1              i386         NVENC Video Encoding runtime library
ii  libnvidia-extra-510:amd64                  510.73.05-0ubuntu0.22.04.1              amd64        Extra libraries for the NVIDIA driver
ii  libnvidia-fbc1-510:amd64                   510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-fbc1-510:i386                    510.73.05-0ubuntu0.22.04.1              i386         NVIDIA OpenGL-based Framebuffer Capture runtime library
ii  libnvidia-gl-510:amd64                     510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  libnvidia-gl-510:i386                      510.73.05-0ubuntu0.22.04.1              i386         NVIDIA OpenGL/GLX/EGL/GLES GLVND libraries and Vulkan ICD
ii  linux-modules-nvidia-510-5.15.0-39-generic 5.15.0-39.42                            amd64        Linux kernel nvidia modules for version 5.15.0-39
ii  linux-modules-nvidia-510-generic-hwe-22.04 5.15.0-39.42                            amd64        Extra drivers for nvidia-510 for the generic-hwe-22.04 flavour
ii  linux-objects-nvidia-510-5.15.0-39-generic 5.15.0-39.42                            amd64        Linux kernel nvidia modules for version 5.15.0-39 (objects)
ii  linux-signatures-nvidia-5.15.0-39-generic  5.15.0-39.42                            amd64        Linux kernel signatures for nvidia modules for version 5.15.0-39-generic
ii  nvidia-compute-utils-510                   510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA compute utilities
ii  nvidia-driver-510                          510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA driver metapackage
ii  nvidia-kernel-common-510                   510.73.05-0ubuntu0.22.04.1              amd64        Shared files used with the kernel module
ii  nvidia-kernel-source-510                   510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA kernel source package
ii  nvidia-prime                               0.8.17.1                                all          Tools to enable NVIDIA's Prime
ii  nvidia-settings                            510.47.03-0ubuntu1                      amd64        Tool for configuring the NVIDIA graphics driver
ii  nvidia-utils-510                           510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA driver support binaries
ii  screen-resolution-extra                    0.18.2                                  all          Extension for the nvidia-settings control panel
ii  xserver-xorg-video-nvidia-510              510.73.05-0ubuntu0.22.04.1              amd64        NVIDIA binary Xorg driver
$ dkms status

(empty for dkms)

Rather looks like you booted into the wrong kernel, the driver was installed for -39 butt you booted -37.
Please create a new nvidia-bug-report.log.

Here it is, good sir.
nvidia-bug-report.log.gz (367.9 KB)

OK, so, I posted my last message and turned my laptop off. The next time I turned it on and booted into Linux, all I got was a black screen with a blinking cursor. I managed to log in (via Ctrl+Alt+F2) and created this other report
nvidia-bug-report.log.gz (279.2 KB)

UPDATE: startx works

I followed this steps and I can log in again