UPDATE: According to the Ubuntu bug history cited below, this problem was fixed with an update of ubuntu-drivers-common on September 10, 2024. After removing the workaround udev rule and verifying the package was updated on my system, I confirmed that the troublesome behavior didn't return for me. That said, at least one other person has advised that they're still experiencing it even with the workaround.
Got bit by Ubuntu Linux bug #2060268 on the latest kernel update for 22.04 LTS (6.8.0-40-generic).
As in the bug report (and many forum posts across the Internet) this appears to be due to a collision between the simpledrm kernel module and NVIDIA drivers. The symptom is a nonexistent display device being assigned as card0. The practical effect is to throw off any previous configuration of the display system (display 1 becoming display 2, display 2 becoming display 3). As a result, customizations like joined or mirrored displays break and need to be reconfigured.
This bug was filed in April 2024 for a 24.04 desktop running the NVIDIA 545 drivers. Since then it has also been reported in 22.04 (my current system, where I am running the NVIDIA 535 drivers with Xorg).
Many solutions have been proposed on the Internet involving passing special flags to the kernel. These have sometimes proved disruptive to system operations (like booting).
A fix was released by the Ubuntu dev team for 24.10 in August 2024. Fixes for 24.04 and 22.04 are marked as "Committed - In Progress".
The fix implemented by the Ubuntu team was this addition to udev rule 71-u-d-c-gpu-detection.rules:
ACTION=="add", SUBSYSTEM=="module", KERNEL=="nvidia_drm", TEST=="/sys/devices/platform/simple-framebuffer.0/drm/card0", RUN+="/bin/rm /dev/dri/card0"
Making this change manually to /usr/lib/udev/rules.d/71-u-d-c-gpu-detection.rules in my system fixed the problem for me.
As always, YMMV.
thank you, this did fix it for me