GNOME Bugzilla – Bug 747169
Missing session record in wtmp
Last modified: 2015-04-02 19:22:22 UTC
We are using wtmp records for the users session history dialog in g-c-c, but in F22 is missing record which we need to determine "Session Started". I still see the code to write such entries in gdm, thus I pretend this is a bug... I used to see something like that for one session: ... oholy pts/0 :0 Sun Mar 22 22:39 - 22:50 (00:10) oholy :0 :0 Sun Mar 22 22:38 - 22:50 (00:11) reboot system boot 3.18.8-201.fc21. Sun Mar 22 22:37 - 22:50 (00:12) But now I see: ... oholy pts/0 :1 Tue Mar 31 09:56 - 10:51 (00:54) reboot system boot 4.0.0-0.rc5.git2 Tue Mar 31 09:53 - 10:51 (00:58) There is missing following line to determine "Session Started": oholy :1 :1 Tue Mar 31 09:56 - 10:51 (00:54) Also wtmp/last is pretty unuseful without those lines. See downstream bugreport: https://bugzilla.redhat.com/show_bug.cgi?id=1207205
Created attachment 300852 [details] [review] manager: find session at registration time We try to look up the session at registration time to add wtmp records for it. We fail to actually find the session, though, because we're using the "embryonic-user-session" object data key, which is only non-NULL when the user session is still getting setup. This commit changes the registration code, to instead, fetch the session straight from the manager object.
Created attachment 300853 [details] [review] manager: set display name on session object at registration time When the X server used at login time registers with GDM, GDM tries to write a wtmp session record for it. Now that the X server is started in the session, we don't know the display name of the X server up front and so don't have the display name attached to the session object. The wtmp record writing code relies on getting the display name from the session object, and so it fails. We do know the display name at registration time, from the details passed to the registration function. This commit makes sure to attach the display name to the session object as soon as the display is registered before writing the wtmp record.
Created attachment 300854 [details] [review] manager: gather tty of session when looking up other details We'll need the tty to give a reasonable wtmp record for wayland sessions.
Created attachment 300855 [details] [review] manager: set display device on session object at registration time When the wayland server used at login time registers with GDM, GDM tries to write a wtmp session record for it. wtmp registration for wayland sessions shouldn't use $DISPLAY like X11 displays, since $DISPLAY isn't as core and meaningful to wayland displays. Instead it could probably use tty device, but the tty device isn't up to date. This commit makes sure the tty device is associated with the session object at registration time. A future commit will probably move the tty association code to gdm-session.c at session open time.
Created attachment 300856 [details] [review] session-record: support NULL display name if tty available wayland sessions don't necessarily have a display name, so this commit just uses the display device instead.
Attachment 300852 [details] pushed as e5a0e92 - manager: find session at registration time Attachment 300853 [details] pushed as 507aefd - manager: set display name on session object at registration time Attachment 300854 [details] pushed as f86ef62 - manager: gather tty of session when looking up other details Attachment 300855 [details] pushed as 6902187 - manager: set display device on session object at registration time Attachment 300856 [details] pushed as 1edb0e4 - session-record: support NULL display name if tty available