Nvidia-settings reports "ERROR: Unable to find display on any available system" under Wayland, works fine under Xorg

I’ve got an older desktop that I’d like to switch from X11 to Wayland, but I’ve run into a couple of discrepancies with the NVIDIA driver (470.94 running under Linux 5.15.16 with Xorg 1.20 and Wayland server 21.1.4; I originally saw the same behavior under driver 470.86, and upgrading to 470.94 didn’t change anything):

(1) nvidia-settings fails to run under Wayland, printing only “ERROR: Unable to find display on any available system”. If I shut down Wayland and start classic X11, without rebooting or changing any other system settings, nvidia-settings works perfectly. Of note, nvidia-smi -q and glxinfo don’t have any trouble detecting the NVIDIA GPU under Wayland. nvidia-bug-report logs attached.

(2) I’m running a dual-monitor configuration with both displays driven by the same NVIDIA card, which is the only GPU in the system. Under X11, I have the screens arranged the way I want using the nvidia-settings tool. When I run Wayland, I get the same screen resolutions and general desktop layout (background images, icon arrangement, etc.) but which screen is on the left and which is on the right are swapped relative to the X11 configuration. Obviously, a simple workaround is just to swap which monitor cable connects to which port on the card, but it’s annoying that I can’t use the same arrangement under either X11 or Wayland. This discrepancy may be related to whichever underlying issue causes #1 above, and certainly it hurts to not have nvidia-settings available to debug and/or correct it.

(3) Not related to Wayland at all, but I noticed that nvidia-bug-settings.sh tries to run “pacman” a total of 12 (!) times even on non-Arch Linux distributions. It would be more prudent to first check the distribution flavor (e.g. from lsb_release or /etc/os-release) and then try to run appropriate package managers, and at a minimum to qualify the command name as /usr/bin/pacman. On my system, which is Slackware rather than Arch, “pacman” happens to resolve to /usr/games/pacman, which is a Pac-Man(R) clone provided by the “pacman” SlackBuild package, so the error is only comical, although it gets a little tedious having to close the Pac-Man window twelve separate times. However, the consequences could be worse on e.g. a non-Debian/non-RedHat system that nevertheless has dpkg and/or rpm installed for examining and working with those packages (not all that uncommon), in which case careless invocation from the root-privileged nvidia-bug-report.sh could really wreak havoc on the system configuration.
nvidia-bug-report.log.gz (1.3 MB)