- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: user id processes not get killed
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 12:05 AM
03-12-2009 12:05 AM
user id processes not get killed
we are using ssh for all of our servers.
their is one problem we have no users login in server but still it shows some user in who output.When i kill that process it is not getting killed.So user not able to login because we have the policy that user can login only 3 times.Please see output below and help me .Its urgent.
smsc2@root:/>who -u
amogh pts/0 Feb 3 14:43 old 16316 172.16.18.184
amogh pts/3 Jan 30 16:27 old 5956 172.16.202.154
srikanth pts/2 Mar 12 09:58 . 20506 172.16.18.184
smsc2@root:/>kill -9 16316
kill: 16316: The specified process does not exist.
smsc2@root:/>kill -9 5956
kill: 5956: The specified process does not exist.
You have mail in /var/mail/root
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 12:10 AM
03-12-2009 12:10 AM
Re: user id processes not get killed
What does ps -ef |grep 16316 shows..?
Regards
john
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 12:12 AM
03-12-2009 12:12 AM
Re: user id processes not get killed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 12:25 AM
03-12-2009 12:25 AM
Re: user id processes not get killed
>/var/adm/wtmp
After some time
# who -u
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 12:36 AM
03-12-2009 12:36 AM
Re: user id processes not get killed
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 01:10 AM
03-12-2009 01:10 AM
Re: user id processes not get killed
sh: /var/adm/btmp: Execute permission denied.
it could be zombe but i have to remove that entry from utmp
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 01:10 AM
03-12-2009 01:10 AM
Re: user id processes not get killed
If all users have now logged out, you can clear the utmp and utmpx files. The command to do this is "> /etc/utmp" for the utmp file and "> /etc/utmpx" for the utmpx file.
After doing this, you should log out. At next login, the utmp file(s) will be automatically recreated.
Normally the process that is managing the user's login session will write to /etc/utmp and/or /etc/utmpx when it exits, to mark that the session has ended. When someone logs in again and gets the same pts/number, the session record is automatically recycled. But if the session is ended with "kill -9", this process may be disrupted and the incorrect session information may remain until the next reboot or until the utmp files are manually cleared.
You should use "kill -HUP" and/or just an ordinary "kill" (without -9) to remove old sessions whenever possible. Use "kill -9" only in special cases, when the gentler forms won't work. An interactive shell won't usually die with an ordinary "kill", but will die with "kill -HUP".
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 01:20 AM
03-12-2009 01:20 AM
Re: user id processes not get killed
# cd /var/adm
# cat /dev/null > wtmp
# cat /dev/null > btmp
# login
# who -u
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 01:26 AM
03-12-2009 01:26 AM
Re: user id processes not get killed
I went via man page of who command
DESCRIPTION
The who command can list the user's name, terminal line, login time,
elapsed time since input activity occurred on the line, the user's
host name, and the process-ID of the command interpreter (shell) for
each current system user. It examines the "/etc/utmp" file to obtain
its information. If file is given, that file is examined. Usually,
file is /var/adm/wtmp, which contains a history of all of the logins
since the file was last created.
## you could follow Matti's plan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 02:14 AM
03-12-2009 02:14 AM
Re: user id processes not get killed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 02:42 AM
03-12-2009 02:42 AM
Re: user id processes not get killed
# who -u
If you like to remove those users
# kill -9
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 02:44 AM
03-12-2009 02:44 AM
Re: user id processes not get killed
" I have assigned points to 12 of 91 responses to my questions. "
Please assign point to your thread if you get your answers.
No points for this please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 03:48 AM
03-12-2009 03:48 AM
Re: user id processes not get killed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 05:36 AM
03-12-2009 05:36 AM
Re: user id processes not get killed
you may try to reboot your server.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 08:12 PM
03-12-2009 08:12 PM
Re: user id processes not get killed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2009 09:51 PM
03-12-2009 09:51 PM
Re: user id processes not get killed
You will manually have to edit the /etc/utmp and /etc/utmpx files.
You may have to stop utmpd(1M) if on 11.23.
You can use fwtmp(1M) to format the /etc/utmp file but after you restart utmpd, it says it reads utmps. So you'll have to write a program like fwtmp to work on utmps(4) formats.
>MK: But if the session is ended with "kill -9", this process may be disrupted and the incorrect session information may remain
This is a broken design and basically says this info isn't important. There should be a system demon that makes sure this works correctly. That's probably why there is now utmpd(1M).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 01:02 AM
08-06-2009 01:02 AM
Re: user id processes not get killed
> You can use fwtmp(1M) to format the /etc/utmp file but after you restart utmpd, it says it reads utmps. So you'll have to write a program like fwtmp to work on utmps(4) formats.
...
> This is a broken design and basically says this info isn't important. There should be a system demon that makes sure this works correctly. That's probably why there is now utmpd(1M).
As far as I can tell from 2 days of investigation you are absolutely right on both accounts.
Reality as of 11v3 aka B.11.31 seems to be like this:
- there are utmpd + bunch of files
- /etc/utmp: good old legacy utmp
- /var/adm/wtmps: utmp log, updated (by utmpd?) too
- /var/adm/btmps: btmp log, updated (by utmpd?) too
- /etc/utmpx: newest utmp, reads deprecated (only if utmpd is not running); updated by utmpd
- /etc/utmps: utmpd saves state here on exit
- plus in-memory utmpd database, which is currently Right Way to access
- different programs use different DBs
- who uses utmpd, but 'who /etc/utmp' is ok too
- last/lastb use wtmps/btmps, last -f use /var/awm/wtmp
- utmpd is good but not fully reliable solution
- if shell is killed with -9, its tty record is forever in utmpd database
- restarting utmpd (whith /sbin/init.d/utmpd stop/start) does not help -- all is saved
in utmps and read back
- it would be good if HP added periodic check for dead PIDs of process leaders or at least
some cleanup at restart
- current crop of tools are unable to fix utmpd-related things
- fwtmp -X < /var/adm/wtmps is ok, fwtmp < /etc/utmp is ok too, but utmps and utmpx are
not accessible with fwtmp (different format)
- ./fwtmp < /etc/utmpx seems to work but resuls are total and obvious crap
- so there is no way to get rid of stale entries in utmpd DB except reload
- or maybe stopping utmpd and 'echo > /etc/utmps' before start, loosing current logins
I wrote 2 small tools to fix utmpd DB without reboot. Maybe they'll be userful to someone.
- read_utmps.c
#include
#include
int main()
{
// see /usr/include/utmps.h
struct utmps *wtmps;
// read in-memory utmpd DB
while ((wtmps = getutsent(sizeof(struct utmps))) != NULL) {
printf("%-16.16s %-8.8s %-12.12s %5ld %2hd %lu %s\n",
wtmps->ut_id, // unique ID
wtmps->ut_user,
wtmps->ut_line,
wtmps->ut_pid,
wtmps->ut_type, // 7 USER_PROCESS, 8 DEAD_PROCESS
wtmps->ut_tv.tv_sec,
wtmps->ut_host
);
}
}
- write_utmps.c
#include
#include
int main(int argc, char **argv)
{
// see /usr/include/utmps.h
struct utmps *wtmps;
if (! argv[1]) {
fprintf(stderr, "ERROR: pleas give ut_id of stale session as argument\n\n");
fprintf(stderr, "procedure is usually as follows:\n");
fprintf(stderr, "- find dead sessions like 'who -u | grep old'\n");
fprintf(stderr, " - ensure they're really dead with 'ps -xp
fprintf(stderr, "- find ut_id with read_utmps\n");
fprintf(stderr, " - 1st field, usually ==
fprintf(stderr, "- end session with write_utmps
fprintf(stderr, " - requires root privs\n");
return(1);
}
// read in-memory utmpd DB
while ((wtmps = getutsent(sizeof(struct utmps))) != NULL) {
if (strcmp(wtmps->ut_id, argv[1]) == 0) {
printf("bingo, %s found\n", argv[1]);
printf("%-15.15s %-8.8s %-12.12s %5ld %2hd %lu %s\n",
wtmps->ut_id, // unique ID
wtmps->ut_user,
wtmps->ut_line,
wtmps->ut_pid,
wtmps->ut_type, // 7 USER_PROCESS, 8 DEAD_PROCESS
wtmps->ut_tv.tv_sec,
wtmps->ut_host
);
// mark it as DEAD to end session
if (wtmps->ut_type == USER_PROCESS) {
wtmps->ut_type = DEAD_PROCESS;
time(&wtmps->ut_tv.tv_sec);
pututsline(wtmps, sizeof(struct utmps));
}
}
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2009 01:59 AM
08-06-2009 01:59 AM
Re: user id processes not get killed
I may have spent that long on it, over several questions.
>if (!argv[1]) {
You might want to do the more obvious test:
if (argc < 2) {
fprintf(stderr, "ERROR: please give ut_id of stale session as argument\n\n");
You can combine all of these fprintf into one so you don't make libc sweat:
fprintf(stderr, "ERROR: please give ut_id of stale session as argument\n\n"
"procedure is usually as follows:\n"
" - ensure they're really dead with 'ps -xp
"- find ut_id with read_utmps\n"
" - 1st field, usually ==
"- end session with write_utmps
" - requires root privs\n");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2009 11:16 PM
08-10-2009 11:16 PM
Re: user id processes not get killed
> >if (!argv[1]) {
> You might want to do the more obvious test: if (argc < 2) {
I rarely write C -- only then there is no ready-made perl module for a task :)
Style aside, there is definitely room for improvement in write_utmps --
iterating whole DB is unnesessary because getutsid/getutsline allows us to
fetch session record by ID. Those 2 utils are quick hacks not intended for
continuous industrial use but to fill the void and maybe spare someone a
reboot or two.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2010 09:00 AM
03-10-2010 09:00 AM
Re: user id processes not get killed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2010 07:42 PM
03-10-2010 07:42 PM
Re: user id processes not get killed
i am not sure, have u tried with
fuser -cu vgname of the home dir
fuser -ck vgname of home dir.
regards
MC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2010 07:44 PM
03-10-2010 07:44 PM
Re: user id processes not get killed
assign points for those who helps u in spending their valuable times in finding u a solution..
regards
MC
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-10-2010 08:24 PM
03-10-2010 08:24 PM
Re: user id processes not get killed
Have you read the problem and every reply?
This is wtmp phantom user corruption.