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 747351 - ckit: (x11-)display-device not properly set?
ckit: (x11-)display-device not properly set?
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
3.16.x
Other OpenBSD
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-04 22:02 UTC by Antoine Jacoutot
Modified: 2015-04-11 11:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
legacy-display: ensure X11 display device is propagated to launch environment (4.30 KB, patch)
2015-04-07 15:01 UTC, Ray Strode [halfline]
none Details | Review
gdm greeter log (15.95 KB, text/plain)
2015-04-07 15:54 UTC, Antoine Jacoutot
  Details
legacy-display: ensure X11 display device is propagated to launch environment (8.53 KB, patch)
2015-04-07 17:42 UTC, Ray Strode [halfline]
committed Details | Review
gdm session log (30.03 KB, text/plain)
2015-04-08 14:41 UTC, Antoine Jacoutot
  Details
manager: properly query display number when built without plymouth (3.31 KB, patch)
2015-04-10 19:12 UTC, Ray Strode [halfline]
committed Details | Review

Description Antoine Jacoutot 2015-04-04 22:02:26 UTC
Hi.

As per #743940 I am using --with-console-kit (yeah I know) to build GDM but there's something not quite right at runtime. I can login just fine but my session is never set as active.

3.16
----
Session2:
	unix-user = '1000'
	realname = 'Antoine Jacoutot'
	seat = 'Seat3'
	session-type = ''
	active = FALSE
	x11-display = ':0'
	x11-display-device = ''
	display-device = 'ttyC0'
	remote-host-name = ''
	is-local = TRUE
	on-since = '2015-04-04T21:36:37.098522Z'
	login-session-id = ''


3.14
----
Session2:
        unix-user = '1000'
        realname = 'Antoine Jacoutot'
        seat = 'Seat1'
        session-type = ''
        active = TRUE
        x11-display = ':0'
        x11-display-device = '/dev/ttyC4'
        display-device = '/dev/ttyC4'
        remote-host-name = ''
        is-local = TRUE
        on-since = '2015-02-18T05:49:56.320451Z'
        login-session-id = ''


As you can see, the display-device and x11-display-device are different in 3.14 and 3.16 -- not sure this is where the main issue is coming from but well...
I am currently going all the commits but that will take some time, so if anyone has an idea ;-)
Thanks!
Comment 1 Antoine Jacoutot 2015-04-04 23:10:44 UTC
I forgot to mention an important information. If I run this as part of .xinitrc (and use startx):
    exec ck-launch-session gnome-session

then everything works as expected:

Session4:
	unix-user = '1000'
	realname = 'Antoine Jacoutot'
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0'
	x11-display-device = '/dev/ttyC4'
	display-device = 'ttyC0'
	remote-host-name = ''
	is-local = TRUE
	on-since = '2015-04-04T22:50:37.354752Z'
	login-session-id = ''
Comment 2 Ray Strode [halfline] 2015-04-07 14:58:42 UTC
Can you turn on debugging and post the log? I do see one issue in the code just browsing around. will attach a patch. mind trying it?
Comment 3 Ray Strode [halfline] 2015-04-07 15:01:50 UTC
Created attachment 301078 [details] [review]
legacy-display: ensure X11 display device is propagated to launch environment

Once the server associated with the login screen session is ready, we
query its display device for ConsoleKit.  This device needs to get
propagated to the session to ensure ConsoleKit can track session
activeness properly.

This commit makes sure the display device is plumbed from the GdmServer
object to the GdmLaunchEnvironment object where it gets used by the
the login session (and subsequently the user session).
Comment 4 Antoine Jacoutot 2015-04-07 15:53:37 UTC
Hi Ray.

Running with the patch now but it does not seem to help.
I'm attaching gdm debug output.
Comment 5 Antoine Jacoutot 2015-04-07 15:54:15 UTC
Created attachment 301081 [details]
gdm greeter log
Comment 6 Ray Strode [halfline] 2015-04-07 16:09:05 UTC
oh i need the gdm logs not greeter session logs
Comment 7 Antoine Jacoutot 2015-04-07 16:31:52 UTC
(In reply to Ray Strode [halfline] from comment #6)
> oh i need the gdm logs not greeter session logs

Ah. Hmm, where I can find these?
Comment 8 Ray Strode [halfline] 2015-04-07 17:42:32 UTC
Created attachment 301084 [details] [review]
legacy-display: ensure X11 display device is propagated to launch environment

Once the server associated with the login screen session is ready, we
query its display device for ConsoleKit.  This device needs to get
propagated to the session to ensure ConsoleKit can track session
activeness properly.

This commit makes sure the display device is plumbed from the GdmServer
object to the GdmLaunchEnvironment object where it gets used by the
the login session (and subsequently the user session).
Comment 9 Ray Strode [halfline] 2015-04-07 17:44:07 UTC
give this one ^^ a try, i think it should fix things.

daemon logs should be next to the greeter logs in /var/log/gdm if you don't have systemd journal.
Comment 10 Antoine Jacoutot 2015-04-08 07:24:04 UTC
(In reply to Ray Strode [halfline] from comment #9)
> give this one ^^ a try, i think it should fix things.

Hey Ray.

Thanks a lot for looking into this... I know how much relevance ConsoleKit must be to you :-/
The latest patch still does not help things for me though.

> daemon logs should be next to the greeter logs in /var/log/gdm if you don't
> have systemd journal.

I only have :{0,1,2,3,4}-greeter.log and :{0,1,2,3,4}.log (gdm's X.org log) in there...
Comment 11 Koop Mast (kwm) 2015-04-08 09:14:42 UTC
After Antoine mentioned he had problems with consolekit, I check what the output was on FreeBSD.

Session2:
	unix-user = '1001'
	realname = 'Koop Mast'
	seat = 'Seat1'
	session-type = ''
	active = FALSE
	x11-display = ':0'
	x11-display-device = 'ERROR: Failed to find X lock file for display 0'
	display-device = '   ?   '
	remote-host-name = ''
	is-local = TRUE
	on-since = '2015-04-08T08:57:38.782242Z'
	login-session-id = ''

After applying the patch from #8 it works again.

Session6:
	unix-user = '1001'
	realname = 'Koop Mast'
	seat = 'Seat1'
	session-type = ''
	active = TRUE
	x11-display = ':0'
	x11-display-device = '/dev/ttyv8'
	display-device = 'pts/1'
	remote-host-name = ''
	is-local = TRUE
	on-since = '2015-04-08T09:04:34.063070Z'
	login-session-id = ''

For some reason I don't have a gdm.log either, only :0.log from xorg-server and 0-greeter.log. After enabling debug in gdm's custom.conf it printed debug information to the terminal.
Comment 12 Antoine Jacoutot 2015-04-08 09:42:58 UTC
> After applying the patch from #8 it works again.

Interesting that it works for you.

Now maybe that's because we need to revert this on OpenBSD:
https://git.gnome.org/browse/gdm/commit/?id=956d7d1c7a0cfbf2beacdb9e88e645e15ad32047
for the lack of sigwaitinfo() here.
Comment 13 Antoine Jacoutot 2015-04-08 13:40:55 UTC
Ok I found out why it works on FreeBSD and not on OpenBSD.
This is what I can see in GDM logs:
gdm[25958]: GdmManager: Running helper /usr/local/libexec/ck-get-x11-display-device --display :0

** (ck-get-x11-display-device:23761): WARNING **: cannot open display: :0
gdm[25958]: GdmManager: Got tty: ''


The difference is that FreeBSD replaced the original ck-get-x11-display-device with a home-made script that uses fstab to return the display.
Comment 14 Antoine Jacoutot 2015-04-08 14:41:51 UTC
Created attachment 301141 [details]
gdm session log

For the sake of completeness, here's the GDM session log.
Comment 15 Antoine Jacoutot 2015-04-09 12:02:44 UTC
Ok so after a bit more debugging, it seems that ck-get-x11-display-device is called while the X server is not up yet. At lest I can see that when running a script similar to what FreeBSD is using as a replacement for ck-get-x11-display-device.
The script tries to cat /tmp/.X0-lock but it's not there yet, hence the failure.
Comment 16 Ray Strode [halfline] 2015-04-10 19:10:29 UTC
ah i see one bug that might explain why it's not working for you.  we're getting the display number in #ifdef WITH_PLYMOUTH guards.
Comment 17 Ray Strode [halfline] 2015-04-10 19:12:21 UTC
Created attachment 301317 [details] [review]
manager: properly query display number when built without plymouth

The code to query the display number of the display object is
erroneously tucked away in

guards. This leads to the display device getting queried prematurely.
Comment 18 Ray Strode [halfline] 2015-04-10 19:14:33 UTC
Attachment 301084 [details] pushed as db9ee47 - legacy-display: ensure X11 display device is propagated to launch environment

( pushing this one, since it fixes the problem for some ConsoleKit users, but leaving bug
  open until the next patch can be confirmed )
Comment 19 Antoine Jacoutot 2015-04-10 20:41:28 UTC
(In reply to Ray Strode [halfline] from comment #17)
> Created attachment 301317 [details] [review] [review]
> manager: properly query display number when built without plymouth
> 
> The code to query the display number of the display object is
> erroneously tucked away in
> 
> guards. This leads to the display device getting queried prematurely.

Duh... stupid me for not figuring this out.
Awesomeness achieved, it works perfectly now :-)
Thanks a lot Ray.
Comment 20 Ray Strode [halfline] 2015-04-11 11:13:24 UTC
Attachment 301317 [details] pushed as 172534d - manager: properly query display number when built without plymouth