Nvidia driver in modeset=1 requires root permissions, Daniel van Vugt (Canonical) concludes it is an...

Optimus linux users can’t use gdm3 and modeset=1. External monitors don’t work.
This long, long standing bug has reports in a few places, this is the best one:

It works with lightdm, so that’s the workaround.

Recently we discovered that running X as root allows gdm3 to work. There was another workaround discovered too, but it had some undesirable effects. But perhaps it sheds some light.

Daniel van Vugt was triggered to do some more investigating by the discovery that X with root permissions worked.

"In a more pure development environment, I can confirm this bug without needing hybrid GPUs, or gdm3.

Just the Nvidia driver and Xorg results in no outputs/monitors detected:

$ xrandr
Screen 0: minimum 8 x 8, current 640 x 480, maximum 16384 x 16384

To work around the problem I need to run Xorg as root. Then I get:

$ xrandr
Screen 0: minimum 8 x 8, current 1920 x 1200, maximum 16384 x 16384
DVI-I-0 disconnected primary (normal left inverted right x axis y axis)
DVI-I-1 disconnected (normal left inverted right x axis y axis)
DP-0 disconnected (normal left inverted right x axis y axis)
DP-1 connected 1920x1200+0+0 (normal left inverted right x axis y axis) 518mm x 324mm
1920x1200 59.95*+ 59.88
1920x1080 60.00 59.94 50.00 23.98
1600x1200 60.00
1280x1024 75.02 60.02
1280x720 60.00 59.94 50.00
1152x864 75.00
1024x768 75.03 60.00
800x600 75.00 60.32
720x576 50.00
720x480 59.94
640x480 75.00 59.94 59.93

So perhaps gdm3 is sometimes missing whatever /dev/* privileges it needs to start Xorg on Nvidia properly. And perhaps lightdm just always does it right.

Although a solution here in the medium term might lay in gdm3, I would more like to see the Nvidia driver fix this bug. Because I can reproduce it without any *dm. Just the kernel + Nvidia driver + Xorg"

and

“Also, it sounds like the root cause here is the same as bug 1769857”:

Vulkan not working if nvidia-drm.modeset=1 is set and gdm3 is used (Optimus)

I wouldn’t think so, I’m running

  • Optimus system
  • modeset=1
  • gnome-shell/gdm/mutter compiled without wayland support
  • xorg running as unpriviledge user
    which is reliably working.
    OTOH, GDM sometimes even tries to set up a wayland session on single nvidia gpu systems with modeset=0.

Daniel added: “Also, I forgot to mention that you CAN run Xorg+Nvidia and see your monitors as non-root. But only after you have started and stopped Xorg as root beforehand. Something gets remembered, maybe in $HOME somewhere?”