After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 745031 - "VT_ACTIVATE failed: Operation not permitted"
"VT_ACTIVATE failed: Operation not permitted"
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
3.15.x
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2015-02-23 16:31 UTC by Mantas Mikulėnas (grawity)
Modified: 2015-02-27 15:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
worker: give session control of the tty (5.61 KB, patch)
2015-02-23 19:50 UTC, Ray Strode [halfline]
none Details | Review
session: jump to VT up front for X sessions (3.32 KB, patch)
2015-02-27 15:31 UTC, Ray Strode [halfline]
none Details | Review
worker: force KD_GRAPHICS mode before doing VT switch (8.33 KB, patch)
2015-02-27 15:31 UTC, Ray Strode [halfline]
none Details | Review

Description Mantas Mikulėnas (grawity) 2015-02-23 16:31:14 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.
Comment 1 Jasper St. Pierre (not reading bugmail) 2015-02-23 16:35:55 UTC
Why is it trying to use VT_ACTIVATE without root privileges? It should be using logind's VT code.
Comment 2 Ray Strode [halfline] 2015-02-23 16:55:05 UTC
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
Comment 3 Ray Strode [halfline] 2015-02-23 19:49:54 UTC
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.
Comment 4 Ray Strode [halfline] 2015-02-23 19:50:23 UTC
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.
Comment 5 Ray Strode [halfline] 2015-02-23 19:51:01 UTC
Attachment 297710 [details] pushed as 99c4809 - worker: give session control of the tty
Comment 6 Ray Strode [halfline] 2015-02-24 14:21:53 UTC
This doesn't seem to work entirely reliably yet, reopening.
Comment 7 Ray Strode [halfline] 2015-02-27 15:31:45 UTC
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.
Comment 8 Ray Strode [halfline] 2015-02-27 15:31:49 UTC
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.
Comment 9 Ray Strode [halfline] 2015-02-27 15:33:27 UTC
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