Bug 636036

Summary: systemd doesn't set utmp entries for tty processes
Product: [Fedora] Fedora Reporter: Petr Lautrbach <plautrba>
Component: systemdAssignee: Lennart Poettering <lpoetter>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: urgent Docs Contact:
Priority: low    
Version: rawhideCC: cdahlin, lakshmipathi.g, lpoetter, metherid, mschmidt, notting, plautrba, pvrabec, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 632568 Environment:
Last Closed: 2010-10-08 14:07:55 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
utmp dump after too many logins none

Description Petr Lautrbach 2010-09-21 11:27:55 UTC
+++ This bug was initially created as a clone of Bug #632568 +++

Description of problem:
I added following line in /etc/security/limits.conf file -

mi2 		   hard    maxlogins     2

and logged as mi2   in tty1 and tty2.
while trying to login to tty3 as mi2 it said "Too many logins" respawned the login process.

Now i logged out from tty1 and tty2...I can't login as mi2 

I can verify this using who command.



Version-Release number of selected component (if applicable):


How reproducible:
1.set maxlogin to 2 for user1
2.user1 logs into two different tty and another try gave message as "Too many login" 
3.Now logout from early logged machine.
4.Now try and login as user1 again. you will error message "Too many users"


Steps to Reproduce:
1.set maxlogin to 2 for user1
2.user1 logs into two different tty and another try gave message as "Too many login" 
3.Now logout from early logged machine.
4.Now try and login as user1 again. you will error message "Too many users"
  
Actual results:

Unable to login
Expected results:
user must be allowed to login

Additional info:
Using Fedora 12.

--- Additional comment from tmraz on 2010-09-13 10:55:27 CEST ---

Can you please post the rpm -q upstart output on your machine?

--- Additional comment from lakshmipathi.g on 2010-09-13 11:27:20 CEST ---

Here its
$ rpm -q upstart
upstart-0.3.11-3.fc12.x86_64

$uname -a
Linux space 2.6.32.16-141.fc12.x86_64 #1 SMP Wed Jul 7 04:49:59 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux

--- Additional comment from tmraz on 2010-09-13 11:41:25 CEST ---

Please update upstart to 0.3.11-4.fc12 - this is in Fedora 12 updates repository.

--- Additional comment from lakshmipathi.g on 2010-09-13 12:00:38 CEST ---

upgraded to current version.

# rpm -q upstart
upstart-0.3.11-4.fc12.x86_64

Testing with user name : ll
#grep 'maxlogins' /etc/security/limits.conf 
ll 		   hard    maxlogins     2


# >/var/log/secure

who shows only laks:
# who
laks     tty1         2010-09-13 15:19 (:0)
laks     pts/0        2010-09-13 15:20 (:0.0)

I tried to login as ll ,as described above steps -
# cat /var/log/secure
Sep 13 15:25:09 localhost login: pam_limits(login:session): Too many logins (max 2) for ll
Sep 13 15:25:09 localhost login: pam_unix(login:session): session opened for user ll by ll(uid=0)
Sep 13 15:25:10 localhost login: pam_limits(login:session): Too many logins (max 2) for ll
Sep 13 15:25:10 localhost login: Permission denied

Is this a know issue/bug ? It's not yet resolved.

--- Additional comment from lakshmipathi.g on 2010-09-13 12:02:18 CEST ---

Please let me know,If you need more info.

--- Additional comment from tmraz on 2010-09-13 12:22:48 CEST ---

Have you rebooted the computer after the upgrade?

--- Additional comment from lakshmipathi.g on 2010-09-13 12:52:48 CEST ---

Yes,after yum install , i rebooted the machine and tested with user "ll".
I have Selinux enabled.

--- Additional comment from lakshmipathi.g on 2010-09-13 13:12:15 CEST ---

Strange, it seems like working now for the first time.-I can live with that -,but not everytime.
=========
see who shows only two logins -
[root@space laks]# who
new1     tty5         2010-09-13 16:26
new1     tty3         2010-09-13 16:27

while trying to login it shows -
# cat /var/log/secure
Sep 13 16:36:20 localhost login: pam_limits(login:session): Too many logins (max 3) for new1
Sep 13 16:36:20 localhost login: pam_unix(login:session): session opened for user new1 by new1(uid=0)
Sep 13 16:36:20 localhost login: pam_limits(login:session): Too many logins (max 3) for new1
Sep 13 16:36:20 localhost login: Permission denied
===========
(above log not related to below steps)
--------
Steps to follow - to reproduce:


0.set maxlogin limit as 3
1.login as new1 in tty1,tty2,tty3
2.whiling logging to tty4 it says "Too many logins"
3.logout of tty3
4.login to tty4 it work now.

But If i randomly logout and login again. this issue comes again.
5.logout of 1,2
6.login to tty5 it says "too many logins"

Something is wrong,i don't know what it is.

--- Additional comment from lakshmipathi.g on 2010-09-14 08:47:17 CEST ---

It works if i wait for a minute and then login again.the issue is fixed for me.

--- Additional comment from tmraz on 2010-09-14 09:08:33 CEST ---

It seems like upstart does not clean the USER_PROCESS entries immediately.

Comment 1 Bill Nottingham 2010-09-21 18:20:24 UTC
Why is this cloned against systemd?

Comment 2 Petr Lautrbach 2010-09-22 06:51:05 UTC
# ls -l /sbin/init
lrwxrwxrwx. 1 root root 14 Sep 21 12:47 /sbin/init -> ../bin/systemd

# rpm -q systemd
systemd-10-3.fc15.x86_64

# cat /etc/security/limits.conf
test        hard       maxlogins       2


login and logout user test on tty1, login and logout user test on tty2, login user test on tty3:

Sep 22 08:51:04 rawhide-systemd login: pam_limits(login:session): Too many logins (max 2) for test
Sep 22 08:51:04 rawhide-systemd login: pam_unix(login:session): session opened for user test by LOGIN(uid=0)
Sep 22 08:51:04 rawhide-systemd login: Permission denied


# w
 08:52:33 up 5 min,  3 users,  load average: 0.08, 0.08, 0.04
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     ttyS0    -                08:49    0.00s  0.14s  0.05s w

Comment 3 Petr Lautrbach 2010-09-22 06:52:51 UTC
Created attachment 448863 [details]
utmp dump after too many logins

Comment 4 Petr Lautrbach 2010-09-22 07:26:33 UTC
Tools like pam, w, destop switch user, ... use utmp table to discover information who is currently logged, see utmp(5). 

systemd should at least set DEAD_PROCESS for utmp entries with already dead tty processes to avoid this issue.

Comment 5 Lennart Poettering 2010-10-08 14:07:55 UTC
Fixed now upstream.