Problem communicating with Timekpr-nExT

Asked by Scott Pakin

I'm having trouble getting Timekpr-nExT to enforce the specified time limits on my Ubuntu 19.10 system with the MATE desktop environment. I configured everything in the GUI for a single user, and "timekpra --userconfig" shows the expected values. timekprd is running as root. However, when anyone logs in (myself or the target user), that person receives a notification that

    There is a problem communicating with Timekpr-nExT (User "XXXX" is not found)!

Any idea what's going on, how to fix it, or even how to diagnose the problem? I tried restarting timekprd and even rebooting my computer, but neither helped.

Thanks,
— Scott

Question information

Language:
English Edit question
Status:
Solved
For:
Timekpr-nExT Edit question
Assignee:
Eduards Bezverhijs Edit question
Solved by:
Scott Pakin
Solved:
Last query:
Last reply:
Revision history for this message
Eduards Bezverhijs (mjasnik) said :
#1

Please send /var/log/timekpr.log and /tmp/timekpr*log files to my e-mail, I'll take a look.
Probably this is due to specific username or misconfiguration, or a bug :)

Revision history for this message
Scott Pakin (pakin) said :
#2

Thanks to Eduards, the problem is resolved! Although most users are unlikely to encounter the same symptoms that I observed, I'll summarize my and Eduards's email conversation, just in case.

The key piece of information was the following lines in /var/log/timekpr.log:

    NOTE: system user "XXXX" explicitly excluded

Timekpr-nExT does not apply its rules to "system users" (i.e., accounts needed by various programs running on the system). For some reason, it was considering user XXXX as a system user. /etc/login.defs tells Timekpr-nExT what range of user IDs corresponds ordinary users and what range corresponds to system users:

    $ grep -e '^UID_M' -e 'UID_M' /etc/login.defs
    UID_MIN 1000
    UID_MAX 60000
    #SYS_UID_MIN 100
    #SYS_UID_MAX 999

That is, Timekpr-nExT applies only to user IDs 1000–60000, not to user IDs 100–999. However, in my case, user XXXX has a user ID in the 500 range, as indicated in /etc/passwd:

    $ grep XXXX /etc/passwd
    XXXX:x:503:132:Young User,,,:/home/XXXX:/bin/bash

Consequently, Timekpr-nExT concluded that XXXX was a program, not a human, and refused to limit that user's time.

The solution was to edit /etc/login.defs to move the 500 range of user IDs from the "system" range to the "human" range:

    UID_MIN 500
    UID_MAX 60000
    #SYS_UID_MIN 100
    SYS_UID_MAX 499

I then restarted Timekpr-nExT:

    sudo systemctl restart timekpr

Again, most users are unlikely to run into this problem because automatic user ID assignment will select only user IDs in the range [UID_MIN, UID_MAX]. I first installed Ubuntu on my computer about eight years ago. Back then, I either assigned XXXX's user ID manually (for compatibility with an even older installation), or UID_MIN defaulted to a smaller number back then—I can't recall.

In any case, I hope others find this information helpful.

— Scott