User accounts login history showing incorrect history - patch

Bug #1443052 reported by Wise Melon
32
This bug affects 5 people
Affects Status Importance Assigned to Milestone
Ubuntu GNOME
Triaged
Low
Unassigned
accountsservice
Unknown
Unknown
accountsservice (Ubuntu)
Fix Released
Low
Unassigned
Trusty
Fix Released
Low
Unassigned
Xenial
Fix Released
Low
Unassigned

Bug Description

Impact
-------

Logout times for users are correct if user logs off and then shutdown
from GDM, however logout times are wrong if user shutdowns directly
from the user session, because DEAD_PROCESS record is missing in that
case and BOOT_TIME record is used instead.

Therefore the logout time will be shown in the login-history (in the gnome-control-center) just before the next login time rather than when the logout actually occurred.

Test case
----------

1. Make sure that you have turned on and logged into the machine and then turned off from the user session several times with enough distance between them for you to tell that the timestamps are correct.

2. Check that after applying the patch that the timestamps show the correct times for the logins and logouts and not what is described in the Impact section above.

Regression potential
--------------------

I have not encountered any regressions while testing this patch.
[bdmurray] - What could go wrong? What should a user testing this look for?

----------------------

Original description:

I have found that in "System Settings > User Accounts" that if you select an account and then select the button called "History" (which is meant to show the login history for that account), 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.

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 have attached a screenshot to show my example as I see it in the History GUI.

I have found this bug to be present in Ubuntu 14.04, Ubuntu 15.04, Ubuntu GNOME 15.10 with GNOME 3.18, and Ubuntu GNOME 16.04 with GNOME 3.20.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :
Revision history for this message
Sebastien Bacher (seb128) wrote :

Thank you for your bug report. Do you log out and stop the machine? Can you check if after logout some processes from your user session are still active on the system? That could explain the behaviour

Changed in unity-control-center (Ubuntu):
importance: Undecided → Low
status: New → Incomplete
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

Yes, I have checked, and no, no processes are still running from my user session.

Changed in unity-control-center (Ubuntu):
status: Incomplete → Confirmed
status: Confirmed → New
status: New → Incomplete
status: Incomplete → Confirmed
Revision history for this message
Sebastien Bacher (seb128) wrote :

can you run "loginctl" and "loginctl session-status <sessionid>" where "<sessionid>" is the c<number> from the output of the first command corresponding to the session still showed as active?

Changed in unity-control-center (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

Yes, I have done that and it just tells me that that session does not exist. The only other session other than the current it says is lightdm.

Changed in unity-control-center (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

This is the output of the 'last' command:

reboot system boot 3.19.0-15-generi Sun May 3 18:34 - 22:38 (1+04:03)
arthur-d pts/5 :0.0 Sat May 2 22:07 - 22:07 (00:00)
arthur-d pts/18 :0.0 Sat May 2 22:07 - 22:07 (00:00)
arthur-d pts/11 :0.0 Sat May 2 22:07 - 22:07 (00:00)
arthur-d pts/5 :0.0 Sat May 2 22:07 - 22:07 (00:00)
arthur-d pts/6 :0 Sat May 2 21:42 - 22:10 (00:28)
arthur-d :0 :0 Sat May 2 21:42 - down (00:53)
reboot system boot 3.19.0-15-generi Sat May 2 21:41 - 22:35 (00:54)
arthur-d pts/5 :0 Sat May 2 16:15 - 16:16 (00:00)
arthur-d pts/5 :0 Sat May 2 16:15 - 16:15 (00:00)
arthur-d pts/5 :0 Sat May 2 15:43 - 15:43 (00:00)
arthur-d pts/5 :0 Sat May 2 15:13 - 15:42 (00:29)
arthur-d pts/5 :0 Sat May 2 15:06 - 15:07 (00:00)
arthur-d pts/5 :0 Sat May 2 14:56 - 15:02 (00:05)
arthur-d pts/5 :0 Sat May 2 14:55 - 14:56 (00:01)
arthur-d pts/5 :0 Sat May 2 13:55 - 14:50 (00:54)
arthur-d pts/5 :0 Sat May 2 13:24 - 13:55 (00:30)
arthur-d pts/5 :0 Sat May 2 13:24 - 13:24 (00:00)
arthur-d pts/7 :0 Sat May 2 13:09 - 13:17 (00:08)
arthur-d pts/7 :0 Sat May 2 13:09 - 13:09 (00:00)
arthur-d :0 :0 Sat May 2 13:08 - crash (08:32)
reboot system boot 3.19.0-15-generi Sat May 2 13:07 - 22:35 (09:27)
arthur-d pts/1 :0 Fri May 1 22:04 - 22:11 (00:06)
arthur-d pts/1 :0 Fri May 1 22:04 - 22:04 (00:00)
arthur-d pts/1 :0 Fri May 1 20:43 - 22:04 (01:20)
arthur-d pts/4 :0 Fri May 1 20:35 - 20:42 (00:07)
arthur-d pts/4 :0 Fri May 1 20:35 - 20:35 (00:00)
arthur-d :0 :0 Fri May 1 20:34 - down (02:05)
reboot system boot 3.19.0-15-generi Fri May 1 20:33 - 22:40 (02:06)
arthur-d pts/1 :0 Fri May 1 16:08 - 16:08 (00:00)
arthur-d pts/1 :0 Fri May 1 16:08 - 16:08 (00:00)
arthur-d pts/1 :0 Fri May 1 16:08 - 16:08 (00:00)
arthur-d pts/1 :0 Fri May 1 12:36 - 12:37 (00:00)
arthur-d pts/1 :0 Fri May 1 12:33 - 12:36 (00:03)
arthur-d pts/1 :0 Fri May 1 12:12 - 12:33 (00:21)
arthur-d pts/1 :0 Fri May 1 12:08 - 12:11 (00:03)
arthur-d pts/1 :0 Fri May 1 12:07 - 12:08 (00:00)
arthur-d pts/1 :0 Fri May 1 12:07 - 12:07 (00:00)
arthur-d pts/1 :0 Fri May 1 11:54 - 12:03 (00:09)
arthur-d pts/1 :0 Fri May 1 11:54 - 11:54 (00:00)

description: updated
description: updated
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

This bug is still present on 15.10.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

And is also present on Ubuntu GNOME 15.10 with GNOME 3.18, I have filed a report on it here: https://bugs.launchpad.net/ubuntu-gnome/+bug/1486558

Should one be marked as a duplicate of the other and then the affected packages changed to incorporate all affected products? Or is that not how it works?

tags: added: trusty vivid wily
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

As this issue also affect the gnome-control-center I will add this GNOME Bugzilla bug to this report: https://bugzilla.gnome.org/show_bug.cgi?id=762346

description: updated
Changed in gnome-control-center:
importance: Unknown → Medium
status: Unknown → Incomplete
Changed in gnome-control-center:
status: Incomplete → Confirmed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

A fix for this bug has been released upstream for the gnome-control-center (see the linked upstream bug report).

Changed in ubuntu-gnome:
status: New → Confirmed
Changed in gnome-control-center (Ubuntu):
status: New → Confirmed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

The issue also affected Ubuntu GNOME 16.04 with GNOME 3.20.

tags: added: xenial
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

It seems as though the GNOME upstream change if applied to the 'unity-control-center' will also fix the problem as it is the same file, same code.

description: updated
Revision history for this message
Sebastien Bacher (seb128) wrote :

the g-c-c fix only deal with the case where login and logout are on different weeks which is not the main issue there

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

Oh, oh dear, so I'm guessing the upstream bug should be reopened then?

Revision history for this message
Jeremy Bícha (jbicha) wrote :

The real fix is probably in the attached accountsservice bug.

Changed in gnome-control-center (Ubuntu):
importance: Undecided → Low
Changed in accountsservice (Ubuntu):
importance: Undecided → Low
Revision history for this message
Sebastien Bacher (seb128) wrote :

Note that currently the history dialog is empty under unity-control-center, I've started discussing it with Robert who maintains lightdm in context of bug #1380364

Changed in gnome-control-center:
status: Confirmed → Unknown
Changed in accountsservice (Ubuntu):
status: New → Confirmed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

The accountsservice bug has now been closed as "RESOLVED FIXED", so if it does really fix the problem then we should backport the fix in.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package gnome-control-center - 1:3.20.1-2ubuntu2

---------------
gnome-control-center (1:3.20.1-2ubuntu2) yakkety; urgency=medium

  * Cherrypick commits from the 3.20 branch since there was never a 3.20.2
    release. See patch headers or git for descriptions of issues fixed.
    - 0002-mouse-Make-touchpad-capability-checking-on-wayland-w.patch
    - 0007-universal-access-allow-focus-on-row-switches.patch
    - 0008-mouse-allow-focus-on-switches-in-the-Touchpad-sectio.patch
    - 0014-network-fix-some-SSID-escaping-issues.patch
    - 0016-user-accounts-Fix-missing-records-in-the-history-dia.patch
      (LP: #1443052)
    - 0020-privacy-React-to-changes-in-permissions-store.patch
    - 0021-privacy-Update-for-PermissionStore-DBus-API-changes.patch
    - 0025-power-Fix-hiding-wi-fi-mobile-broadband-toggles.patch
    - 0026-power-Fix-wifi-device-state-when-opening-power-panel.patch
    - 0027-printers-Fix-compilation-warning.patch
    - 0028-display-Fix-possible-crash-on-startup.patch

 -- Jeremy Bicha <email address hidden> Tue, 04 Oct 2016 06:52:59 -0400

Changed in gnome-control-center (Ubuntu):
status: Confirmed → Fix Released
Jeremy Bícha (jbicha)
Changed in accountsservice (Ubuntu Xenial):
importance: Undecided → Low
status: New → Triaged
Changed in gnome-control-center (Ubuntu Xenial):
importance: Undecided → Low
status: New → Triaged
Changed in unity-control-center (Ubuntu Xenial):
importance: Undecided → Low
status: New → Triaged
Jeremy Bícha (jbicha)
Changed in ubuntu-gnome:
status: Confirmed → Triaged
importance: Undecided → Low
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package accountsservice - 0.6.42-0ubuntu1

---------------
accountsservice (0.6.42-0ubuntu1) yakkety; urgency=medium

  * New upstream bugfix release.
    - allow a user to change his own data even if he's remote
    - add way to set password hint independent of password
    - conform to modern systemd library naming scheme
    - disable GVFS support in service, since it's not needed and has
      bad side effects
  * Drop patches applied in new version:
    - 0014-libsystemd.patch
    - change-own-data-inactive.patch
  * Add debian/patches/wtmp-fix-logout.patch:
    - Backport 0.6.43 commit to fix logout records when a user
      shuts down or restarts their computer (LP: #1443052)

 -- Jeremy Bicha <email address hidden> Tue, 04 Oct 2016 09:04:41 -0400

Changed in accountsservice (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

This update still doesn't fix the issue for me.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

I tried it in my Ubuntu GNOME 16.10 with GNOME 3.20 VM.

Changed in gnome-control-center (Ubuntu):
status: Fix Released → Confirmed
Changed in accountsservice (Ubuntu):
status: Fix Released → Confirmed
tags: added: yakkety
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

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.

Changed in accountsservice (Ubuntu):
status: Confirmed → Fix Released
Changed in gnome-control-center (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

So this update should be backported in to prior releases as I can confirm that it does now fix the problem, I think that it didn't work for me immediately because of a local issue on my system caused by something else earlier.

Changed in ubuntu-gnome:
assignee: nobody → Nikita Yerenkov-Scott (yerenkov-scott)
Changed in accountsservice (Ubuntu):
assignee: nobody → Nikita Yerenkov-Scott (yerenkov-scott)
Changed in accountsservice (Ubuntu Xenial):
assignee: nobody → Nikita Yerenkov-Scott (yerenkov-scott)
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :
description: updated
tags: added: patch
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Accountsservice patch sponsored to the Xenial queue. Thanks!

Changed in accountsservice (Ubuntu Xenial):
status: Triaged → In Progress
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

You're welcome! It seems as though I accidentally gave it a .patch extension when I should have given it a .debdiff extension. Shall I change that or just leave it as it is?

Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

If you mean the extension of the file you attached in comment #24, it doesn't matter. But can you please unsubscribe ubuntu-sponsors.

no longer affects: unity-control-center (Ubuntu)
no longer affects: gnome-control-center (Ubuntu)
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

The patch does not seem to be compatible with the version of accountsservice on Precise, however I have adapted it for Trusty and tested it in a VM and it works. So here is a debdiff for it.

Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :
summary: - User accounts login history showing incorrect history
+ User accounts login history showing incorrect history - patch
Revision history for this message
Gunnar Hjalmarsson (gunnarhj) wrote :

Precise is soon EOL anyway, so non-essential changes are not worth it.

I have sponsored the accountsservice debdiff to the trusty queue. Please unsubscribe ubuntu-sponsors again. ;)

no longer affects: gnome-control-center (Ubuntu Xenial)
no longer affects: unity-control-center (Ubuntu Xenial)
Changed in accountsservice (Ubuntu Trusty):
assignee: nobody → Nikita Yerenkov-Scott (yerenkov-scott)
importance: Undecided → Low
status: New → In Progress
Revision history for this message
Brian Murray (brian-murray) wrote : Please test proposed package

Hello Nikita, or anyone else affected,

Accepted accountsservice into xenial-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/accountsservice/0.6.40-2ubuntu11.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

description: updated
Changed in accountsservice (Ubuntu Xenial):
status: In Progress → Fix Committed
tags: added: verification-needed
Revision history for this message
Brian Murray (brian-murray) wrote :

Hello Nikita, or anyone else affected,

Accepted accountsservice into trusty-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/accountsservice/0.6.35-0ubuntu7.3 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, and change the tag from verification-needed to verification-done. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Changed in accountsservice (Ubuntu Trusty):
status: In Progress → Fix Committed
Revision history for this message
Wise Melon (wise-melon-deactivatedaccount) wrote :

I have tested the packages from -proposed on both Trusty and Xenial and I can confirm that they both solve the problem with no currently noticeable regressions.

The package versions I tested were:

- Xenial: 0.6.40-2ubuntu11.3
- Trusty: 0.6.35-0ubuntu7.3

I tested the Xenial one in an Ubuntu GNOME 16.04.1 (GNOME 3.18) 64-bit VM, and I tested the Trusty one in an Ubuntu (Unity) 14.04.5 64-bit VM.

tags: added: verification-done
removed: verification-needed
Mathew Hodson (mhodson)
Changed in gnome-control-center:
importance: Medium → Undecided
status: Unknown → New
affects: gnome-control-center → ubuntu-translations
no longer affects: ubuntu-translations
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package accountsservice - 0.6.35-0ubuntu7.3

---------------
accountsservice (0.6.35-0ubuntu7.3) trusty; urgency=medium

  * debian/patches/wtmp-fix-logout.patch:
     - Backport 0.6.43 commit to fix logout records when a user
       shuts down or restarts their computer (LP: #1443052)

 -- Nikita Yerenkov-Scott <email address hidden> Mon, 31 Oct 2016 20:12:38 +0000

Changed in accountsservice (Ubuntu Trusty):
status: Fix Committed → Fix Released
Revision history for this message
Brian Murray (brian-murray) wrote : Update Released

The verification of the Stable Release Update for accountsservice has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package accountsservice - 0.6.40-2ubuntu11.3

---------------
accountsservice (0.6.40-2ubuntu11.3) xenial; urgency=medium

  * debian/patches/wtmp-fix-logout.patch:
    - Backport 0.6.43 commit to fix logout records when a user
      shuts down or restarts their computer (LP: #1443052)

 -- Nikita Yerenkov-Scott <email address hidden> Tue, 25 Oct 2016 16:15:26 +0100

Changed in accountsservice (Ubuntu Xenial):
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.