Xorg loading twice on boot

Why is gdm-x-session loading xorg twice during boot?

It creates Xorg.0.log & Xorg.1.log

journalctl -p 4 -b 0 | grep "Log file"                                                                  ✔ 
May 09 15:42:59 xmg /usr/lib/gdm-x-session[738]: (--) Log file renamed from "/var/log/Xorg.pid-738.log" to "/var/log/Xorg.0.log"
May 09 15:42:59 xmg /usr/lib/gdm-x-session[738]: (==) Log file: "/var/log/Xorg.0.log", Time: Tue May  9 15:42:59 2023
May 09 15:43:06 xmg /usr/lib/gdm-x-session[1157]: (--) Log file renamed from "/var/log/Xorg.pid-1157.log" to "/var/log/Xorg.1.log"
May 09 15:43:06 xmg /usr/lib/gdm-x-session[1157]: (==) Log file: "/var/log/Xorg.1.log", Time: Tue May  9 15:43:06 2023

And you can see the time stamps are just minutes apart.

 ll Xorg*                                                  ✔ 
-rw-r--r-- 1 root root  8893 Jun 21  2022 Xorg.2.log
-rw-r--r-- 1 root gdm  49037 May  9 15:41 Xorg.0.log.old
-rw-r--r-- 1 root ryan 55228 May  9 15:42 Xorg.1.log.old
-rw-r--r-- 1 root gdm  48273 May  9 15:43 Xorg.0.log
-rw-r--r-- 1 root ryan 42913 May  9 15:45 Xorg.1.log

The first time it is loaded as root so that it can run gdm, the GNOME Display Manager, which needs root privileges in order to be able to read /etc/shadow when you enter your login credentials.

The second time, it is loaded under your own user ID, because with systemd, it no longer needs to run as root while you are logged in as an unprivileged user.


Its not really as simple as systemd.

Xorg - ArchWiki

But GDM+KMS will do this by default.

Other Display managers mostly default to starting the window system as root.
(sddm does … though newer sddm-git can be made not to)


1 Like

Yes, kernel mode-setting is an absolute requirement. Without it, the xinit executable must be SUID, unless one foregoes the use of a display manager and instead logs in at a tty, and then manually starts X11 — i.e. what used to be called “runlevel 3” in sysvinit-based systems.

systemd does play a role in why X11 no longer requires running as root, but I’m not sure how exactly it mitigates this — possibly via logind and PAM. :man_shrugging:

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.