General
cancel
Showing results for 
Search instead for 
Did you mean: 

HP-UX 11.0: who -u shows stale users

 
Highlighted
Occasional Advisor

HP-UX 11.0: who -u shows stale users

My users are in a trap'd environment that forces them into an old Oracle application. Every night at midnight, the application shuts down for backup, which forces everyone off the system. But "who -u" disagrees:

martije pts/ts Jul 10 14:33 0:14 27142 131.101.148.4

It says martije has been around since JULY! But pid 27142 does not exist.

ps -ef | grep martije shows that they have no processes.

I've reset my wtmp and btmp files.

who -u shows 22 of these old logins out of 143 total logins. I have 4 zombie processes. The system has been up for 214 days.

What gives? How can I make these old logins go away?

Thanks.
4 REPLIES 4
Highlighted
Honored Contributor

Re: HP-UX 11.0: who -u shows stale users

also take a look at utmp and utmpx in /etc
Highlighted
New Member

Re: HP-UX 11.0: who -u shows stale users

We had the same problem on an 11.23 system. Got rid of them by:

stop utmpd (/stmp/rc1.d/S600utmpd)
>/etc/utmp
>/etc/utmps
>/etc/utmpx
start utmpd

Messed up login records one time, but cleared the stale users out.
Highlighted
Honored Contributor

Re: HP-UX 11.0: who -u shows stale users

I think 11.00 did not yet have utmpd, so just pick a time when there are no other users logged in and truncate the /etc/utmp file to zero size.

(This will of course cause the information on currently logged-in users to be lost, so it's better to do this while there are no other real logins.)

Any program that writes to /etc/utmp will automatically regenerate it if it has been zeroed. For a while, the /etc/utmp file will gradually grow as users are logging in and the data structures in the file for each TTY and pseudo-TTY are reinitialized. Eventually it'll reach the "usual" size (determined by the maximum number of used pseudo-TTYs, most likely).

I think this utmp file corruption tended to happen on pre-11.11 machines mainly if someone had the habit of using "kill -9" (or the equivalent "kill -KILL") to remove old user sessions. You should really use "kill -HUP" instead. Use "kill -9" only for processes that won't stop with either kill -HUP or the regular kill command (without options).

MK
MK
Highlighted
Honored Contributor

Re: HP-UX 11.0: who -u shows stale users

This is the classic Unix problem with utmp (where who gets it's information). When a user logs in a record is written to utmp. And when the user properly logs out, another record is written. If the user simply turns off their PC or in some way breaks the connection, there will not be a finish record and the simple code in who will display the user as still connected. This will be cleaned up when you reboot (utmp is zeroed) but you can zero utmp at any time. You'll lose the old information that who uses, but it will remove the orphaned users.


Bill Hassell, sysadmin