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 762346 - User accounts login history showing incorrect history
User accounts login history showing incorrect history
Status: RESOLVED NOTGNOME
Product: gnome-control-center
Classification: Core
Component: User Accounts
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: Control-Center Maintainers
Control-Center Maintainers
Depends on:
Blocks:
 
 
Reported: 2016-02-19 18:57 UTC by Inactive account
Modified: 2016-10-12 22:00 UTC
See Also:
GNOME target: ---
GNOME version: 3.19/3.20


Attachments
Screenshot of incorrect login history being shown in the gnome-control-center (11.70 KB, image/png)
2016-02-19 18:57 UTC, Inactive account
  Details
user-accounts: Fix missing records in the history dialog (1.75 KB, patch)
2016-03-07 13:08 UTC, Ondrej Holy
none Details | Review
user-accounts: Fix missing records in the history dialog (1.62 KB, patch)
2016-03-11 13:12 UTC, Ondrej Holy
committed Details | Review

Description Inactive account 2016-02-19 18:57:06 UTC
Created attachment 321686 [details]
Screenshot of incorrect login history being shown in the gnome-control-center

I am running Ubuntu GNOME 15.10 with GNOME 3.18 and if I go to "Settings > Users" and clicking the "History" button, it will show you when you last logged in as "Session Started", but it will show that you "Session Ended" just before you login the next time. So to clarify what I mean, let's say that yesterday I logged into my account on this machine at 14:29, and then sometime near 23:00 I logged out, and then this morning I logged into my account somewhere around 11:20, it will show this:

        Today 11:20 Session Started
        Today 11:19 Session Ended
        Yesterday, 14:29 Session Started

So it assumes that the last session ended when you log into a new one, so the bug seems to be that it does not log when a session ends properly, and only logs it when a new session starts.

I provided a lot more information here when asking about it in Unity: http://askubuntu.com/questions/629373/user-account-history-showing-incorrectly And although that was Unity and this is GNOME, I think that the information will still help, and as it is present in both the unity- and the gnome-control-center it might help in figuring out the problem.

I have also attached a screenshot of what I mean just to fully clarify.

I also initially reported this issue here but thought I should also do so upstream: https://bugs.launchpad.net/ubuntu-gnome/+bug/1486558
Comment 1 Ondrej Holy 2016-03-07 13:04:45 UTC
Thanks for your bug report.

Could you please provide last.log obtained by the following command:
last -xF > last.log

and tell me a date, when it happened? Or is it happening all the time?

askubuntu.com returns "Page not found", so no additional info...

I don't see such problems with Fedora from a brief look at logs...
Comment 2 Ondrej Holy 2016-03-07 13:08:38 UTC
Created attachment 323267 [details] [review]
user-accounts: Fix missing records in the history dialog

However I realized that "Session Ended" record may miss if "Session Started" isn't in the same week. It is probably caused by a wrong order of conditions, however I can't prove it currently, because I have some problems with building of control-center...
Comment 3 Inactive account 2016-03-07 13:20:34 UTC
Well, this happens constantly so not just at the end of the week or time to time. The AskUbuntu system had automatically deleted the question due to lack of activity, but I've had it undeleted so you should be able to view the information now via the link I provided. If still not then let me know and I will provide the information here.
Comment 4 Inactive account 2016-03-07 13:35:09 UTC
Some more information is also provided here: https://bugs.launchpad.net/ubuntu-gnome/+bug/1443052 Though most (if not all) should be covered in the AskUbuntu question.
Comment 5 Ondrej Holy 2016-03-08 11:03:42 UTC
Thanks for the additional info!

It is a pity that your output from the "last" command doesn't reflect the data you mentioned in your report, however there is the following line:
arthur-d :0           :0               Sat May  2 13:08 - crash  (08:32)    

The word "crash" means that there is a missing wtmp record for log out and thus boot record is used instead...

Maybe your display manager (i.e. lightdm) doesn't write log out records properly, do you see "crash" word often in your "last" command output?
Comment 6 Sebastien Bacher 2016-03-08 14:38:52 UTC
there is an example of record on https://bugs.launchpad.net/gnome-control-center/+bug/1443052/comments/6

the records are of type

" arthur-d :0 :0 Fri May 1 20:34 - down (02:05)"

is that the right format? it looks like the "logout" event is missing if you shutdown directly from your session, what is supposed to be recorded in this case?
Comment 7 Ondrej Holy 2016-03-11 10:03:54 UTC
(In reply to Sebastien Bacher from comment #6)
> there is an example of record on
> https://bugs.launchpad.net/gnome-control-center/+bug/1443052/comments/6

I know, but it doesn't contain the records mentioned by the reporter in the description (i.e. 11:20, 11:19, 14:29) unfortunately.

> the records are of type
> 
> " arthur-d :0 :0 Fri May 1 20:34 - down (02:05)"

Yes, but there is also:
arthur-d :0           :0               Sat May  2 13:08 - crash  (08:32)   

> is that the right format? it looks like the "logout" event is missing if you

Yes, this is right format.

> shutdown directly from your session, what is supposed to be recorded in this
> case?

If you see "crash" (e.g. when you shutdown directly from your session), we can't do much with it in control-center. Some component (I am not sure which one) should record logout for :0...

If you see wrong records in control-center and last command records are ok (i.e. no crash), then something is wrong in control-center, or accountsservice. That is the reason why I want to see last output for the mentioned example...
Comment 8 Ondrej Holy 2016-03-11 13:05:54 UTC
(In reply to Sebastien Bacher from comment #6)
> (snap)
> is that the right format? it looks like the "logout" event is missing if you
> shutdown directly from your session, what is supposed to be recorded in this
> case?

Actually, in that case, logouts are determined from shutdown records probably, e.g.:
shutdown system down  4.4.3-300.fc23.x Mon Mar  7 08:13 - 08:14  (00:00)

You can see them using "last -x". You can see "crash" if shutdown record is missing...
Comment 9 Ondrej Holy 2016-03-11 13:12:43 UTC
Created attachment 323704 [details] [review]
user-accounts: Fix missing records in the history dialog

I tested the patch and it shows me some missing "Session Ended" records. It would be nice to push it, however you are right, that it is not relevant to this issue...
Comment 10 Ondrej Holy 2016-03-11 14:36:57 UTC
Sorry, you are right, I can see this bug even with Fedora. I see "Session Ended" 15:26, but it should be 15:21. There is the following line:
shutdown system down  4.2.0-0.rc5.git0 Fri Mar 11 15:21 - 15:26  (00:05)

So it seems that the first time should be used and not the second one. Hmm I am almost convinced that those times used to be same earlier...

So this is probably bug in accountsservice, where this logic is handled...
Comment 11 Ondrej Holy 2016-03-11 15:11:30 UTC
See accountsservice bug report:
https://bugs.freedesktop.org/show_bug.cgi?id=94497

I am letting this bug open due to the attached patch...
Comment 12 Ondrej Holy 2016-06-28 12:59:37 UTC
Fix for this issue has been pushed to accountsservice. Bastien, can you please take a look at attachment 323704 [details] [review]?
Comment 13 Bastien Nocera 2016-06-28 13:20:54 UTC
(In reply to Ondrej Holy from comment #12)
> Fix for this issue has been pushed to accountsservice. Bastien, can you
> please take a look at attachment 323704 [details] [review] [review]?

Looks fine for 3.20, but I'll let you talk to Felipe who's done work in that area recently.
Comment 14 Felipe Borges 2016-06-29 08:18:45 UTC
Review of attachment 323704 [details] [review]:

sure!
Comment 15 Ondrej Holy 2016-06-29 08:35:45 UTC
Comment on attachment 323704 [details] [review]
user-accounts: Fix missing records in the history dialog

Thanks! I've pushed it to master as commit 83afdd3 and gnome-3-20 as commit 8b224ed.
Comment 16 Inactive account 2016-06-30 18:07:20 UTC
This only fixes the issue if the logins and logouts are on separate weeks, the issue here is much larger than that (as described in the description). This issue affects every login and logout no matter when it is done, even if on the same day. And applying this patch does not fix that issue.

Though the patch does fix an issue (the weeks issue), it does not fix the main big one here that I originally reported.
Comment 17 Ondrej Holy 2016-07-01 06:10:44 UTC
You are right that the attached patch is slightly irrelevant, however the root of this bug is in accountsservice and should be already fixed by another patch, see:
https://bugs.freedesktop.org/show_bug.cgi?id=94497

Let's close it with NOTGNOME, which is probably more suitable in this case...
Comment 18 Inactive account 2016-10-12 11:08:14 UTC
Well, I don't know, but the accountsservice patch did not fix this bug for me...
Comment 19 Ondrej Holy 2016-10-12 13:36:00 UTC
Hmm, we need some more info what is wrong...

What versions of accountsservice and gnome-control-center are you using? Do you  still see the same bug?

Can you please provide output from the following command:
last -xF --since=-7days > last.log
and the corresponding screenshot of the last week from the history dialog (or more weeks) with a comment what is wrong?
Comment 20 Inactive account 2016-10-12 21:55:51 UTC
Now this is very strange, I restarted my machine, it didn't work. But after restarting it the second time for some reason it started working as it should so I assume that the patch does work, just something odd happened somewhere, but it is all fine now.

Sorry for bothering you.