Skip to main content
Topic: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel) (Read 1488 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

as long as wayland is not sufficient for my purposes i run xserver rootless for security reasons, s. https://wiki.archlinux.org/index.php/Xorg#Rootless_Xorg.
On a pc with amd-graphic, a notebook with intel graphic and a notebook with hybrid graphics (nvidia, intel) i can start xserver rootless from vt by a little shell-script for selecting DE and modifying .xinitrc.
I only needed to set

Code: [Select]
# nano /etc/X11/Xwrapper.config
needs_root_rights = no

and get

Code: [Select]
$ ps -o user $(pgrep Xorg)
USER
<myusername>

after starting xserver on all 3 machines. On the notebook with hybrid-graphics i can use both cards by nvidia-prime.

Now i wanted to use a login manager, installed gdm and activated xdm. On the pc with amd-graphic and the notebook with intel graphic xorg is started rootless by the user logged in as expected.
On the notebook with hybrid graphics kms had to be manually enabled for the nvidia driver, s. https://wiki.archlinux.org/index.php/Kernel_mode_setting.

Code: [Select]
# nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT=".....nvidia-drm.modeset=1....."

# grub-mkconfig -o /boot/grub/grub.cfg

This parameter is shown in the output of

Code: [Select]
$ cat /proc/cmdline

gdm starts, i can login but i get a grey screen and dead keyboard. I can't open a vt b< CTRL+ALT+FN.
After ssh from another machine i get:

Code: [Select]
$ ps -o user $(pgrep Xorg)
USER
gdm

Only if i set

Code: [Select]
# nano /etc/X11/Xwrapper.config
needs_root_rights = yes
xorg starts, but by user root.

What can i do?



Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #3
If, after booting, the screen stays black and GDM does not start until the mouse is moved or something is typed on the keyboard, it may be due to a lack of entropy required for random number generation.

have you installed haveged package?

maybe can help this https://wiki.gentoo.org/wiki/Non_root_Xorg , they have more info about rootless Xorg

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #4
If you have elogind running, you should be able to start xorg as root (you can test this with startx). Not sure about the gdm part of this equation but it should, but even nvidia with kms enabled should be able to this this.

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #5
@alium: haveged is installed. I get the gdm-greeter and after login i get a grey screen and dead keyboard and mouse, see my first post.
Thanks for the link to gentoo Wiki.
@Dudemanguy: elogind is running. I am able to start Xorg as root by gdm, see my first post. 

Now i found a relevant difference in the gdm/greeter.log. If Xorg is started rootless by gdm, greeter.log contains the following lines:

Code: [Select]
etc/gdm/Xsession: Beginning session setup...
localuser:andreas being added to access control list
/etc/gdm/Xsession: Setup done, will execute: i3

These lines are missing on the notebook with hybrid graphics.

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #6
Oh my mistake. I didn't see that startx worked rootless in your first post. What init system do you use? Perhaps gdm needs to be executed as a non-root user? That can be done in the init script. Not sure if that will fix this issue though.

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #7
I use openrc. But on the two other machines the same init scripts (/etc/init.d/xdm resp. xdm-setup are working without issues.

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #8
another difference in greeter.log:

# on the running machines
using VT number 7

# on the blocked notebook
using VT number 1

I think this is the reason for the grey screen and blocked keyboard after login, see /etc/conf.d/xdm:

Quote
# We always try and start X on a static VT. The various DMs normally default
# to using VT7. If you wish to use the xdm init script, then you should ensure
# that the VT checked is the same VT your DM wants to use. We do this check to
# ensure that you haven't accidentally configured something to run on the VT
# in your /etc/inittab file so that you don't get a dead keyboard.
CHECKVT=7

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #9
IIRC gdm uses whatever tty you happen to be on. Although I wouldn't think that would affect this issue. I guess it's some strange problem with multi gpus. Did you ever try any other display managers by the way to see if this is gdm specific or not?

Re: Xorg does not start rootless by gdm with hybrid graphics (nvidia, intel)

Reply #10
sddm shows a black screen without cursor. I am able to log in by lightdm (Xorg runs by root, that does gdm too).
An issue by the two graphic cards was my first thought. I disabled the nvidia card without success.
I am searching why gdm.Xsession does not begin session setup (my reply #5)