Keeps counting time when user has logged out

Bug #1326847 reported by Matthew Gregg
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
timekpr
New
Undecided
Unassigned

Bug Description

Actually not sure where/how to report bugs since development here seems dead and I am using the version from https://launchpad.net/~mjasnik/+archive/ppa which is ported to 14.04. Anyhow... the issue is that it appears timekpr keeps deducting time after a user has logged out. My fist thought was that a lingering process from that user was still running and making timekpr think the user was still active, but I have confirmed no processes owned by the user are around after logout.

To reproduce...
* Setup a limit for a user.
* Login as that user and then log back out before the limit is reached, making a note of the time remaining.
* Wait some time and then try to log back in. If the limit has not already been reached, again make a note of the time remaining.

Revision history for this message
Kenneth Rawlings (rawlink) wrote :

This bug has to do with systemd and loginctl. It seems that when a user logs out, systemd is continuing to think the user is still active. When loginctl is called to get a list of active users it is incorrectly returning all users who have logged in sometime since the machine was booted.

You can reinstate the desired behavior by editing the /usr/bin/users.timekpr script. It's as simple as commenting out lines so the old non-loginctl behavior is used. See example below.

------------------------EXAMPLE-------------------

!/bin/sh

# check if loginctl is available
#which loginctl > /dev/null

# if not - fallback to old method (unique)
#if [ $? -ne 0 ];
#then
        TKPR_USERS=`users | sed 's/ /\n/g' | tr "\\n" " "\ | sed 's/$/\n/'`
#else
# TKPR_USERS=`loginctl list-users | grep " \+[0-9]\+ .\+" | awk '{print $2}' | tr "\\n" " " | sed 's/$/\n/'`
#fi

# now filter out DM's
TKPR_USERS=`echo $TKPR_USERS | sed 's/ /\n/g' | grep -v -e '^gdm$' -e '^kdm$' -e '^lxdm$' -e '^lightdm$' | sort -u | tr "\\n" " "\ | sed 's/$/\n/'`

# output final user list
echo $TKPR_USERS
~

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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