TL;DR: Ubuntu is stuck at boot, probably because of "nvidia-driver-535" (other people report that), but apt doesn't list that package.
More details:
So, at boot, my Ubuntu stays stuck on one of the boot screens (the ones saying I can hit Ctrl-C to interrupt disk checks, but without the loading animation, and Ctrl-C does nothing, nor do any buttons apart from the power one; if before that I switch to the view with the logs it gets stuck on an empty screen without logs). This happens every time I boot (since this morning - yesterday I think I remember installing some packages suggested by the software updater at some point).
If I boot in recovery mode, I get a menu, and if I pick the option to continue normal boot, it will warn me that graphics drivers will be disabled.
Googling around people almost everybody blames this on nvidia drivers (and indeed I have an nvidia graphics card have have installed some cuda related packages), and suggest purging those packages; that fits well with things working in the recovery mode without graphics drivers.
HOWEVER, apt tells me it doesn't have anything that looks like an nvidia driver:
$ apt list --installed '*nvidia*'
Listing... Done
libnvidia-compute-525/jammy-updates,jammy-security,now 525.125.06-0ubuntu0.22.04.1 amd64 [installed,automatic]
libnvidia-ml-dev/jammy,now 11.5.50~11.5.1-1ubuntu1 amd64 [installed,automatic]
nvidia-cuda-dev/jammy,now 11.5.1-1ubuntu1 amd64 [installed,automatic]
nvidia-cuda-gdb/jammy,now 11.5.114~11.5.1-1ubuntu1 amd64 [installed,automatic]
nvidia-cuda-toolkit-doc/jammy,jammy,now 11.5.1-1ubuntu1 all [installed,automatic]
nvidia-cuda-toolkit/jammy,now 11.5.1-1ubuntu1 amd64 [installed]
nvidia-opencl-dev/jammy,now 11.5.1-1ubuntu1 amd64 [installed,automatic]
nvidia-profiler/jammy,now 11.5.114~11.5.1-1ubuntu1 amd64 [installed,automatic]
nvidia-visual-profiler/jammy,now 11.5.114~11.5.1-1ubuntu1 amd64 [installed,automatic]
... and running apt-get purge --dry-run nvidia-driver-*
as some people suggest does indeed tell me that that won't actually uninstall anything.
However, the driver does seem there:
$ nvidia-detector
nvidia-driver-535
and
$ sudo ubuntu-drivers list
nvidia-driver-525-open, (kernel modules provided by linux-modules-nvidia-525-open-generic-hwe-22.04)
nvidia-driver-470-server, (kernel modules provided by linux-modules-nvidia-470-server-generic-hwe-22.04)
nvidia-driver-470, (kernel modules provided by linux-modules-nvidia-470-generic-hwe-22.04)
nvidia-driver-535-server, (kernel modules provided by linux-modules-nvidia-535-server-generic-hwe-22.04)
nvidia-driver-535-server-open, (kernel modules provided by linux-modules-nvidia-535-server-open-generic-hwe-22.04)
nvidia-driver-535, (kernel modules provided by linux-modules-nvidia-535-generic-hwe-22.04)
nvidia-driver-535-open, (kernel modules provided by linux-modules-nvidia-535-open-generic-hwe-22.04)
nvidia-driver-525-server, (kernel modules provided by linux-modules-nvidia-525-server-generic-hwe-22.04)
nvidia-driver-525, (kernel modules provided by linux-modules-nvidia-525-generic-hwe-22.04)
libfprint-2-tod1-broadcom
oem-somerville-pidgeot-meta
... so it looks like I have some drivers, but they don't come from apt; they come from "linux-modules-nvidia-535-generic-hwe-22.04
" which isn't listen in apt either.
So, where does that come from? Some kind of system package not installed via apt? If so, is there a way to roll back? Or could the problem actually come from somewhere else?
(or is maybe all of this an artifact from booting in recovery mode, where the package is somehow "hidden" because disabled? That doesn't make sense, the whole point of recovery mode is to fix this stuff)