Gentoo's xorg-server and elogind
By Erik Letson, July 25th, 2020 (blog index)
Recently, I performed a regular upgrade of my Gentoo system via portage. Everything seemed normal, and all was well until I shut down my computer for the night. The next morning, upon starting it up, I realized that I had a problem: I couldn't get xserver to successfully start!
I was getting an error message that informed me that Xorg did not have permission to use /dev/tty0. The specific error was:
parse_vt_settings: Cannot open /dev/tty0 (Permission denied)
Now this was a very strange error. Why in the world did Xorg not have permission to use the tty devices? Nothing had changed, as far as I knew! I had recently performed a system upgrade, and the most likely culprit I could figure out was the proprietary nVidia drivers, which had an upgrade during that time.
After much searching, though, it turned out that the problem was something else entirely: elogind. For those unaware, elogind is a user login manager daemon forked from systemd's "logind" program. Gentoo maintains elogind as a seperate program, and it is intended to replace the no-longer-actively-maintained ConsoleKit. Thanks to elogind, many programs that are dependent on systemd are able to function in a non-systemd environment. I use elogind system-wide on my Gentoo install, and had never had any issues because of it (until now).
According to this news item on gentoo.org, the newest Gentoo xserver packages have dropped suid support by-default, and now require what they refer to as "a logind provider," meaning either Gentoo's stand-alone elogind, or systemd itself. This is in line with Xorg on other distros, which pretty much depend on systemd to operate in a supported (that is, reccommended by upstream) way. Until now, apparently, Gentoo has been using a hacky solution that runs xserver as root, which is a big no-no as far as the Xorg maintainers are concerned. Users can still use this hack by enabling the suid USE flag for Xorg components, and thus avoid installing elogind. I already had it installed, though, so for me it was simply a matter of re-emerging everything with the elogind USE flag enabled globally. It seems that I should have been doing this from the start.
Once that was done, everything worked again. So let this be a warning to you readers: Always pay VERY close attention to news from Gentoo, and do what it says!