[Bug 183729] Re: compat: utmp not cleared on tty logout
Bug Watch Updater
183729 at bugs.launchpad.net
Thu Oct 26 23:10:40 UTC 2017
Launchpad has imported 30 comments from the remote bug at
https://bugzilla.redhat.com/show_bug.cgi?id=470004.
If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.
------------------------------------------------------------------------
On 2008-11-05T07:49:18+00:00 Michal wrote:
Description of problem:
If user switches to terminal (Ctrl+Alt+Fx) use it and then exits, this terminal stays listed in sessions to switch to
Version-Release number of selected component (if applicable):
How reproducible:
always
Steps to Reproduce:
1.switch to terminal (Ctrl+Alt+F2)
2.enter username and password
3.logout
4.kde->switch user
Actual results:
"user: TTY login (vt2)" is listed even if session has been already terminated
Expected results:
only active sessions are listed
Additional info:
if you repeat above steps, you can achieve "user: TTY login (vt2)" to be listed twice (three times, four...)
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/9
------------------------------------------------------------------------
On 2008-11-05T13:55:13+00:00 Rex wrote:
Confirmed.
Interesting, I wonder by what method kde uses to determine users logged
into tty's... either that's broken or console logins are.
"last" gives interesting results for me:
rdieter1 tty2 ... Wed nov 5 08:52 gone - no logout
except, I *did* logout.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/10
------------------------------------------------------------------------
On 2008-11-07T17:45:28+00:00 Rex wrote:
OK, looks like tty logins never finish logging out. For me, ALT-F2 goto
console, login... do stuff... logout... stuck, no login: prompt
Now, who to blame for this? :)
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/11
------------------------------------------------------------------------
On 2008-11-07T17:46:45+00:00 Rex wrote:
bouncing over to util-linux-ng (owner of login), in hopes of some
insight.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/12
------------------------------------------------------------------------
On 2008-11-25T17:50:35+00:00 Rex wrote:
Interesting, I can't reproduce anymore, how about you?
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/13
------------------------------------------------------------------------
On 2008-11-26T04:48:14+00:00 Bug wrote:
This bug appears to have been reported against 'rawhide' during the Fedora 10 development cycle.
Changing version to '10'.
More information and reason for this action is here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/14
------------------------------------------------------------------------
On 2008-11-26T09:29:26+00:00 Michal wrote:
I'm in work now, where I have kde 4.1.3 packages from updates-testing
and it doesn't work for me. Still the "same" problem.
I think there is (maybe) one difference: If I try to switch user via
"start"->Switch user and select tty console, it starts new session with
kdm as if I select "start new session". If I try to switch via screen
saver lock or via kdm, it "works" as usual. I don't know if this is new
change or if it was working this way already.
I can test also on system updated without updates-testing today later if
you want.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/15
------------------------------------------------------------------------
On 2009-01-30T14:57:39+00:00 Rex wrote:
I take back comment #4, console logins are still not registerring
logout, 'last' still reports only 'gone - no logout'
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/16
------------------------------------------------------------------------
On 2009-03-19T13:19:46+00:00 Karel wrote:
It seems that /sbin/init from upstart does not care about utmp at all.
(Note that mingetty(8) and login(1) can create a new utmp entry on systems
where init(8) is broken, but init(8) has to set the entry to DEAD_PROCESS
state when user logout and login process has exited).
See utmp man page:
The first entries ever created result from init(8) processing inittab(5).
Before an entry is processed, though, init(8) cleans up utmp by setting
ut_type to DEAD_PROCESS, clearing ut_user, ut_host, and ut_time with null
bytes for each record which ut_type is not DEAD_PROCESS or RUN_LVL and where
no process with PID ut_pid exists. If no empty record with the needed ut_id
can be found, init(8) creates a new one. It sets ut_id from the inittab,
ut_pid and ut_time to the current values, and ut_type to INIT_PROCESS.
mingetty(8) (or agetty(8)) locates the entry by the PID, changes ut_type to
LOGIN_PRO- CESS, changes ut_time, sets ut_line, and waits for connection to be
established. login(1), after a user has been authenticated, changes ut_type
to USER_PROCESS, changes ut_time, and sets ut_host and ut_addr. Depending on
mingetty(8) (or agetty(8)) and login(1), records may be located by ut_line
instead of the preferable ut_pid.
When init(8) finds that a process has exited, it locates its utmp entry by
ut_pid, sets ut_type to DEAD_PROCESS, and clears ut_user, ut_host and ut_time
with null bytes.
Reassignig to upstart.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/17
------------------------------------------------------------------------
On 2009-05-20T13:18:35+00:00 Petr wrote:
Created attachment 344797
utmp patch
It fixes problem with tty logins which stays in sessions list.
It adds new stanza - utmp - and writes utmp entries and wtmp log
as described in utmp(5).
Needs to add "utmp <id>" to /etc/event.d/tty<id>
Tested againts F10 and devel branch
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/18
------------------------------------------------------------------------
On 2009-05-20T14:31:55+00:00 Bill wrote:
I would greatly prefer to not change the job syntax if at all possible.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/19
------------------------------------------------------------------------
On 2009-05-20T14:37:40+00:00 Casey wrote:
Historically /sbin/init in upstart hasn't directly altered utmp. The
upstart runlevel command does the utmp editing by itself.
Following that pattern, the right way is to create a helper.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/20
------------------------------------------------------------------------
On 2009-05-24T14:39:56+00:00 Rex wrote:
*** Bug 502362 has been marked as a duplicate of this bug. ***
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/22
------------------------------------------------------------------------
On 2009-06-04T14:12:42+00:00 Petr wrote:
it folows upstart 0.5 roadmap https://lists.ubuntu.com/archives/upstart-
devel/2007-October/000468.html:
Finally init will maintain INIT_PROCESS and DEAD_PROCESS entries in utmp
for jobs that require it, through a "utmp id" stanza. The general user
of this will the getty job, where such utmp entries are necessary for
correct behaviour.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/23
------------------------------------------------------------------------
On 2009-06-08T14:08:41+00:00 Petr wrote:
> Following that pattern, the right way is to create a helper.
I can't imagine how this helper should work. Do you have any idea about
that?
Anyway it has to be somehow handled by init. There should be set line
with INIT_PROCESS and right pid (of new process) before running new
getty (or another tty process).
> I would greatly prefer to not change the job syntax if at all possible.
It's a way how to tell init what id (representing terminal name suffix)
use when writes to utmp line with INIT_PROCESS before exec to getty as
long as we don't use inittab for that.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/24
------------------------------------------------------------------------
On 2009-06-17T16:16:08+00:00 Petr wrote:
what do you think about this:
create something called utmp-helper (compat/sysv/utmp-helper.c) with
usage:
utmp-helper --id <terminal suffix> -- <command for what we need utmp
handling>
utmp-helper will do fork(), in child it will save pid of new process, id
and INIT_PROCESS to utmp table, call setsid() for controlling tty and
execv() to <command for what we need utmp handling>, in parrent it will
wait() until child terminates, then set DEAD_PROCESS into utmp table and
log to wtmp log.
and then exec line in /etc/event.d/tty* will be changed to:
exec utmp-helper --id 1 -- /sbin/mingetty tty1
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/25
------------------------------------------------------------------------
On 2009-06-18T12:39:06+00:00 Petr wrote:
looks like upstream will accept patch from Comment #9
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/28
------------------------------------------------------------------------
On 2009-09-08T01:31:33+00:00 Steven wrote:
Has this patch made it into F10/F11/Rawhide?
--
Steven M. Parrish - KDE Triage Master
- PackageKit Triager
Fedora Bugzappers volunteer triage team
https://fedoraproject.org/wiki/BugZappers
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/31
------------------------------------------------------------------------
On 2009-09-08T12:31:26+00:00 Rex wrote:
Afaict, the patch has not been integrated, but I'd love to be wrong.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/32
------------------------------------------------------------------------
On 2009-10-01T15:49:22+00:00 Ville wrote:
Unfortunately it seems you're not wrong, the problem persists with
upstart-0.3.11-1.fc11.x86_64 on F-11, and looks like later versions
don't have it either.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/33
------------------------------------------------------------------------
On 2009-10-01T15:49:58+00:00 Ville wrote:
(In reply to comment #19)
> and looks like later versions don't have it either.
...where with "it" I mean a fix.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/34
------------------------------------------------------------------------
On 2009-10-01T17:34:41+00:00 Casey wrote:
Upstream is not doing any more releases for 0.3.x. Since it doesn't look
like we're advancing to the next version any time soon this should
probably be rolled in by us.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/35
------------------------------------------------------------------------
On 2009-11-12T21:22:01+00:00 Rex wrote:
confirmed issue remains in f12, rebasing.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/36
------------------------------------------------------------------------
On 2009-11-30T12:56:19+00:00 Rex wrote:
*** Bug 542138 has been marked as a duplicate of this bug. ***
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/37
------------------------------------------------------------------------
On 2009-12-04T15:58:33+00:00 Petr wrote:
Created attachment 376109
add utmp_clean_id and call it from post-stop stanza
another helper suggestion:
call umtp_clean_id in post-stop stanza, eg for /etc/event.d/tty2:
post-stop exec /sbin/utmp_clean_id 2
utmp_clean_id is simple utility which cleans (sets type to DEAD_PROCESS
and nulls other rows) lines with given id and type LOGIN_PROCESS or
USER_PROCESS.
these patch is related to initscripts that provides /etc/event.d/tty*
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/38
------------------------------------------------------------------------
On 2009-12-04T16:34:40+00:00 Petr wrote:
http://koji.fedoraproject.org/koji/taskinfo?taskID=1849861 scratch
build
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/39
------------------------------------------------------------------------
On 2010-03-09T13:54:20+00:00 Petr wrote:
Created attachment 398797
set DEAD_PROCESS for died proccess with pid in utmp table
(with this patch) init tries to find utmp entry for each tracked process
which died. If entry is found, it sets type to DEAD_PROCESS and logs to
wtmp log.
mingetty takes care about setting INIT_PROCESS/LOGIN_PROCESS itself.
There is no need to change anything else like it was in previous
patches.
koji scratch build is here
http://koji.fedoraproject.org/koji/taskinfo?taskID=2041266
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/40
------------------------------------------------------------------------
On 2010-03-10T11:50:04+00:00 Fedora wrote:
upstart-0.3.11-4.fc12 has been submitted as an update for Fedora 12.
http://admin.fedoraproject.org/updates/upstart-0.3.11-4.fc12
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/41
------------------------------------------------------------------------
On 2010-03-11T07:20:58+00:00 Fedora wrote:
upstart-0.3.11-4.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update upstart'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/upstart-0.3.11-4.fc12
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/42
------------------------------------------------------------------------
On 2010-03-24T23:35:15+00:00 Fedora wrote:
upstart-0.3.11-4.fc12 has been pushed to the Fedora 12 stable
repository. If problems still persist, please make note of it in this
bug report.
Reply at:
https://bugs.launchpad.net/ubuntu/+source/upstart/+bug/183729/comments/43
** Changed in: upstart (Fedora)
Status: In Progress => Fix Released
** Changed in: upstart (Fedora)
Importance: Unknown => Low
--
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:
Fix Released
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