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 747169 - Missing session record in wtmp
Missing session record in wtmp
Status: RESOLVED FIXED
Product: gdm
Classification: Core
Component: general
3.16.x
Other Linux
: Normal normal
: ---
Assigned To: GDM maintainers
GDM maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-01 12:13 UTC by Ondrej Holy
Modified: 2015-04-02 19:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
manager: find session at registration time (5.74 KB, patch)
2015-04-02 19:21 UTC, Ray Strode [halfline]
committed Details | Review
manager: set display name on session object at registration time (4.55 KB, patch)
2015-04-02 19:21 UTC, Ray Strode [halfline]
committed Details | Review
manager: gather tty of session when looking up other details (14.90 KB, patch)
2015-04-02 19:21 UTC, Ray Strode [halfline]
committed Details | Review
manager: set display device on session object at registration time (5.62 KB, patch)
2015-04-02 19:21 UTC, Ray Strode [halfline]
committed Details | Review
session-record: support NULL display name if tty available (5.50 KB, patch)
2015-04-02 19:21 UTC, Ray Strode [halfline]
committed Details | Review

Description Ondrej Holy 2015-04-01 12:13:45 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
Comment 1 Ray Strode [halfline] 2015-04-02 19:21:27 UTC
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.
Comment 2 Ray Strode [halfline] 2015-04-02 19:21:32 UTC
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.
Comment 3 Ray Strode [halfline] 2015-04-02 19:21:36 UTC
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.
Comment 4 Ray Strode [halfline] 2015-04-02 19:21:40 UTC
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.
Comment 5 Ray Strode [halfline] 2015-04-02 19:21:43 UTC
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.
Comment 6 Ray Strode [halfline] 2015-04-02 19:22:06 UTC
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