GNOME Bugzilla – Bug 745031
"VT_ACTIVATE failed: Operation not permitted"
Last modified: 2015-02-27 15:33:27 UTC
Arch Linux has xorg-server 1.17.1, which uses Xorg.wrap and defaults to unprivileged mode if it's started as a non-root user and detects a compatible (KMS) driver. [I use radeon.] This however doesn't seem to work with the new gdm 3.15; as the session-Xorg runs without root privileges, it cannot switch VTs away from the greeter. It logs the following & exits, and I'm stuck staring at the gray screen where my login prompt used to be. gdm-x-session[570460]: (II) modesetting: Driver for Modesetting Kernel Drivers: kms gdm-x-session[570460]: (II) FBDEV: driver for framebuffer: fbdev gdm-x-session[570460]: (++) using VT number 7 gdm-x-session[570460]: (EE) gdm-x-session[570460]: Fatal server error: gdm-x-session[570460]: (EE) xf86OpenConsole: VT_ACTIVATE failed: Operation not permitted gdm-x-session[570460]: (EE) gdm-x-session[570460]: (EE) gdm-x-session[570460]: Please consult the The X.Org Foundation support gdm-x-session[570460]: at http://wiki.x.org gdm-x-session[570460]: for help. gdm-x-session[570460]: (EE) Please also check the log file at "/home/grawity/.local/share/xorg/Xorg.0.log" for additional information. gdm-x-session[570460]: (EE) gdm-x-session[570460]: (WW) xf86CloseConsole: KDSETMODE failed: Operation not permitted gdm-x-session[570460]: (WW) xf86CloseConsole: VT_SETMODE failed: Operation not permitted gdm-x-session[570460]: (EE) gdm-x-session[570460]: FatalError re-entered, aborting gdm-x-session[570460]: (EE) xf86CloseConsole: VT_ACTIVATE failed: Operation not permitted gdm-x-session[570460]: (EE) gdm[570300]: GdmSession: Emitting 'session-exited' signal with exit code '70' As a workaround, I have "needs_root_rights = yes" in my /etc/X11/Xwrapper.config, to tell Xorg.wrap to keep setuid privileges.
Why is it trying to use VT_ACTIVATE without root privileges? It should be using logind's VT code.
weird timing, i was looking at this in a debugger when this report came... I think we need this patch: http://cgit.freedesktop.org/~halfline/xserver/commit/?h=wip/logind-integration&id=2d8d245b4b29c9ab932c42fce203bff845ec55c0 and maybe some others from that branch, will need to investigate further
heh, os/osinit.c has this gem: fclose(stdin);• fclose(stdout);• Then /var/log/Xorg.0.log gets happily opened to stdin. My code relies on stdin getting used by Xorg as the tty device. I guess if we set the tty device as the controlling tty of the session then things should work okay, since X will then open /dev/tty.
Created attachment 297710 [details] [review] worker: give session control of the tty The X server relies on the controlling tty to be set up properly when getting run in a non-privileged mode. This commit makes sure that happens.
Attachment 297710 [details] pushed as 99c4809 - worker: give session control of the tty
This doesn't seem to work entirely reliably yet, reopening.
Created attachment 298093 [details] [review] session: jump to VT up front for X sessions It turns out that in order for X to work without being run as root, it needs to have its VT be active at start up. This is because it bails out of some of its logind codepaths if it gets given a "paused" device by logind, and then sometimes fails in its fallback code paths as it races to open /dev/dri/card0 while logind is still giving the user permissions to it. As a workaround, until X is fixed, this commit jumps to the VT up front before starting X. That adds flicker, which we'll address in a follow up commit.
Created attachment 298094 [details] [review] worker: force KD_GRAPHICS mode before doing VT switch If we switch VTs when in KD_TEXT mode there's obvious flicker. This commit addresses that problem by going to KD_GRAPHICS mode before switching VTs. Ideally, we wouldn't switch VTs at all, and instead leave it up to the display servers to manage via logind. At the moment, the display servers don't use logind properly, though, so do this as a stop gap.
Attachment 298093 [details] pushed as 5dcbc5a - session: jump to VT up front for X sessions Attachment 298094 [details] pushed as e699b43 - worker: force KD_GRAPHICS mode before doing VT switch