unable to get pty (794 Views)
Reply
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 1 of 27 (794 Views)
Accepted Solution

unable to get pty

Dear All,

I connect to HP-UX server version 11.11 using XDMCP (Xmanager) and I got a terminal warning "unable to get pty" that prevent the prompt to be appeared and I can't run any command.

This case is recovered if I reboot the server and appears again after a few days.
This restart is not acceptable as the server in operation.

Please help.
Exalted Contributor
Steven E. Protter
Posts: 33,806
Registered: ‎08-15-2002
Message 2 of 27 (794 Views)

Re: unable to get pty

Shalom,

insf -e

You may need to increase the number of terminal sessions available. The default is 60. nstrel in the kernel

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 3 of 27 (795 Views)

Re: unable to get pty


Hello Steven,

Kindly tell me what should I do in details as I am new in Unix.

Your reply is highly appreciated.

Thanks in advance.
Honored Contributor
Jeeshan
Posts: 2,084
Registered: ‎11-05-2007
Message 4 of 27 (795 Views)

Re: unable to get pty

i think it's "nstrtel"
a warrior never quits
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 5 of 27 (795 Views)

Re: unable to get pty

>This restart is not acceptable as the server in operation.

I assume restarting once to fix the kernel config is acceptable?

>ahsan: I think it's "nstrtel"

Yes. Though npty(5) and nstrpty(5) may also need to be increased.

>tell me what should I do in details

You need to go into SAM and go into the kernel configuration changes menu and change the above 3 variables to 120 or 200. (If they are currently 60.)

Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 6 of 27 (795 Views)

Re: unable to get pty


Dear All,

Thanks for your interest.

Whatever its nstrel or nstrtel, I don't know what I should do with it as I told you before I am new in Unix.

Please help me with more details.
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 7 of 27 (795 Views)

Re: unable to get pty


Dear Dennis,

Thanks for your response.

How I go into SAM and also the kernel menu?

And how to change these values?

Please be patient as this is my first step in unix and face this problem.

Thanks in advance.
Honored Contributor
johnsonpk
Posts: 361
Registered: ‎05-11-2008
Message 8 of 27 (795 Views)

Re: unable to get pty

1)login to server as root
2)type sam on prompt
#sam
3)terminal version sam window ill open
press enter to get in
4)select kernel configuration
and then select configurable parameters
4)select the kernel parameters by pressing space bar (one at a time)
5)after selecting each parameters that need to change (press TAB and select actions) then select modify tunable parameter and give required value

repeat this step for all three parameters and finally on action menu select the option process new kernel ...

it will ask you the confirmation for reboot



once you did this ur system will reboot with new kernel

Thanks !!
Johnson
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 9 of 27 (795 Views)

Re: unable to get pty


Dear johnsonpk ,

Thank you very very very much.

The reason of this problem that many people connect through XDMCP sessions to an application on the server but they incorrectly close the session so the sessions are still opened.

I set the 3 parameters to 120 so I expect that the problem return after a longer period.

Then I want to know a way to kill these sessions without the need to make reboot.


Again many thanks to you.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 10 of 27 (795 Views)

Re: unable to get pty

>Then I want to know a way to kill these sessions without the need to make reboot.

Do you have an example of a left-over session?
You might be able to use "who -u". For users with a very long time since active "activity" field, you can attempt to kill the process tree.
# UNIX95= ps -Hfu user-name

This will list all of the process trees for "user-name".

You might want to provide the "who -u" output along with the ps(1) output so we can verify what to do next. Please attach a .txt file. (I'm not sure the "retain format" box will work good enough.)
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 11 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

Thanks for your response and sorry to be late.

the the result of "ps -fu" command for user named "noc" is attached.

Thanks in advance.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 12 of 27 (794 Views)

Re: unable to get pty

>"ps -fu" command for user named "noc"

You need to use this exact command, so -H works.
UNIX95= ps -Hfu noc

noc seems to have a bunch of old (May 27):
/usr/dt/bin/dtexec -open ...
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 13 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

It seems that my system doesn't support this option.

I got this error "ps: illegal option -- H".


Please advise.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 14 of 27 (794 Views)

Re: unable to get pty

>It seems that my system doesn't support this option.

Are you using a real shell? Did you type the line exactly how I showed:
UNIX95= ps -Hfu noc

You can also add "-x" to get more of the command lines.
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 15 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

Thanks for your interest.

Really, I ran the command without "UNIX95=",
so kindly tell me what does it mean?

The results of "UNIX95= ps -Hfu noc" and "UNIX95= ps -Hxfu noc" are attached.

Thanks in advance.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 16 of 27 (794 Views)

Re: unable to get pty

>so kindly tell me what does it mean?

It basically temporarily exports UNIX95 during the ps(1) command. Exporting this causes commands to conform to UNIX 95 Standard and makes available extra ps(1) options like -A, -C, -c, -g, -j, -n, -o, -s, -U, -H and -x.

The reason you don't export it permanently is there are all sorts of side effects for other commands. :-)

>The results of ... are attached.

Please provide a simple .txt file with both outputs.
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 17 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

The file is attached.

Regards,
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 18 of 27 (794 Views)

Re: unable to get pty

(I guess we needed that -x.)
You have a bunch of these old processes whose parent is init, 1:
/usr/dt/bin/dtexec -open -1 ... /home/noc/xnmevents.sh

Do you know that that xnmevents.sh script does?
Is this something to do with OpenView?

You seem to have one that its still active:
noc 11291 11289 /usr/dt/bin/dtexec ... /home/noc/xnmevents.sh
noc 11292 11291 /bin/sh /home/noc/xnmevents.sh
noc 11293 11292 /opt/OV/bin/xnmevents

Perhaps you can fix it so when xnmevents.sh dies, it kills its parent?
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 19 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

The script just execute the "xnmevents" command which launch the OpenView Alarm Browser.

But I don't know how to kill this process when the "xnmevents.sh" dies.

any way, Is there any way to kill these processes manually?

Please advise.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 20 of 27 (794 Views)

Re: unable to get pty

>The script just execute the "xnmevents" command which launch the OpenView Alarm Browser.

Any reason you need this since it causes so many problems?

>But I don't know how to kill this process when the "xnmevents.sh" dies.

I suppose you could have a trap for signal 1 (SIGHUP) and then wait N seconds and then kill your parent, since he is unmutual?

>Is there any way to kill these processes manually?

Well, that should be easy. If there is more than one, and it is old, just use kill on that dtexec process.
If that fails, use "kill -9".
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 21 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

Thanks for your patience.

This script was made to allow our NOC agents to open and monitor the Alarm Browser but the problem that they don't correctly close the XDMCP session or the session hangs then he open another one.

Could you please tell me how to modify the script using the mentioned signal trap and how to make it wait N seconds?

I don't konw what I should do.

Please help and many thanks again.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 22 of 27 (794 Views)

Re: unable to get pty

>Could you please tell me how to modify the script using the mentioned signal trap and how to make it wait N seconds?

What's in xnmevents.sh now?

I assume you would add:

LOGFILE=/var/tmp/xnmevents.log
function catch_sighup {
echo "$0: SIGHUP $(date +'%Y%m%d.%H%M%S')" >> $LOGFILE
echo "$0: My PID: $$, parent $PPID" >> $LOGFILE
exit 1
}

And before you execute xnmevents:
trap catch_sighup HUP

This currently logs but doesn't kill its parent. After collecting the log for a few times, we can see where to go next.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 23 of 27 (794 Views)

Re: unable to get pty

>ME: After collecting the log for a few times, we can see where to go next.

I tried it out, it seems to log SIGHUP.

You could try kill and if that fails, kill -9:
# kill dtexec parent to cleanup
kill $PPID
sleep 30
# See if dtexec died?
kill -0 $PPID
if [ $? -eq 0 ]; then # still there
kill -9 $PPID
fi
exit 1
Advisor
Ahmed Zaher
Posts: 23
Registered: ‎12-04-2007
Message 24 of 27 (794 Views)

Re: unable to get pty


Dear Dennis,

Many Thanks for your interest.

But really I am new in Unix and I don't know where to put these commands in the script and how the script will know that the session was terminated in order to kill its process.

Attached is the script.

Kindly write this script to me and I will appreciate this effort.

Thanks in advance.
Acclaimed Contributor
Dennis Handly
Posts: 25,274
Registered: ‎03-06-2006
Message 25 of 27 (794 Views)

Re: unable to get pty

See attached. Basically it is like this:
function catch_sighup {
# logging for SIGHUP
echo "$0: SIGHUP $(date +'%Y%m%d.%H%M%S')" >> $LOGFILE
echo "$0: My PID: $$, parent $PPID" >> $LOGFILE
exit 1 # Remove if you want to kill

# kill dtexec parent to cleanup
kill $PPID
sleep 30
# See if dtexec died?
kill -0 $PPID
if [ $? -eq 0 ]; then # still there
kill -9 $PPID
fi
exit 1
}

Let it run with just logging for a few times.
If you want it to kill, remove that first "exit 1".
If you don't want it to log, you can comment out those "echo"s.
The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.