[Bug 183729] Re: compat: utmp not cleared on tty logout
Dirley
cpd.dirley at socic.com.br
Mon Dec 17 19:09:06 UTC 2012
This fix will be ported to 0.6 series? On my company, we have more then
50 servers using Ubuntu 10.04 LTS that are affect by this bug.
--
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to upstart in Ubuntu.
https://bugs.launchpad.net/bugs/183729
Title:
compat: utmp not cleared on tty logout
Status in Upstart:
Fix Released
Status in “kdebase-workspace” package in Ubuntu:
Invalid
Status in “upstart” package in Ubuntu:
Fix Released
Status in “upstart” package in Fedora:
In Progress
Bug description:
Log into tty1, then tty2 and then log out of both. Now run a w
command and you should see something similar to the following;
mac at tootoo:~/source/procps-3.2.7/proc$ w
10:39:09 up 33 days, 23:11, 4 users, load average: 1.31, 0.62, 0.39
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
mac tty7 :0 11Jan08 4:34m 7:24m 36.02s x-session-manager
mac pts/1 :0.0 08:54 0.00s 0.19s 0.00s w
It shows that 4 users are logged in. Obviously this is wrong. I
wrote a small C utility to hack out what w and uptime get as
information from utmp.
#include <string.h>
#include <stdlib.h>
#include <pwd.h>
#include <unistd.h>
#include <utmp.h>
#include <stdio.h>
int main(int argc, char *argv[])
{
struct utmp *utmpstruct;
struct utmp entry;
//system("echo before adding entry:;who");
setutent();
//pututline(&entry);
while ((utmpstruct = getutent())){
if ((utmpstruct->ut_type == USER_PROCESS) && (utmpstruct->ut_name[0] != '\0'))
printf(utmpstruct->ut_line);
printf("\t");
printf("%d",utmpstruct->ut_pid);
printf("\n");
}
endutent();
return 0;
}
You'll get an output like this
mac at tootoo:~$ ./a.out
0
50
4305
4306
tty2 14989
4312
tty1 4313
4314
tty7 30255
0
pts/1 9712
0
0
0
0
0
20929
14914
15034
However, running the following , to try to find the pid for the tty1
process, gives;
mac at tootoo:~/source/procps-3.2.7/proc$ ps aux | grep 4313
mac 15524 0.0 0.0 2988 768 pts/1 R+ 10:42 0:00 grep 4313
mac at tootoo:~/source/procps-3.2.7/proc$
This is obviously wrong, utmp still has the old process id's
associated as being logged in.
Running the following gives the new tty pid
mac at tootoo:~/source/procps-3.2.7/proc$ ps aux | grep tty1
root 14914 0.0 0.0 1692 516 tty1 Ss+ 10:33 0:00 /sbin/getty 38400 tty1
mac 15605 0.0 0.0 2988 764 pts/1 R+ 10:44 0:00 grep tty1
mac at tootoo:~/source/procps-3.2.7/proc$
There is now a new pid for tty1
To manage notifications about this bug go to:
https://bugs.launchpad.net/upstart/+bug/183729/+subscriptions
More information about the foundations-bugs
mailing list