Operating System - HP-UX
1832609 Members
2480 Online
110043 Solutions
New Discussion

Re: stty::not a typewriter

 

stty::not a typewriter

hi get this message everytime when a login using ssh,when i use normal telnet its fine.This happens when there is about 10 users on the system - stty::not a typewriter
19 REPLIES 19
RAC_1
Honored Contributor

Re: stty::not a typewriter

You have somrthing in profile that expects a erminal, but doesn't get one.
set -vx in your profile (may be it is in /etc/profile) and check where the message is coming from.
There is no substitute to HARDWORK
Prashanth.D.S
Honored Contributor

Re: stty::not a typewriter

Re: stty::not a typewriter

attached is my profile

@(#)B.11.11_LR

# Default (example of) system-wide profile file (/usr/bin/sh initialization).
# This should be kept to the bare minimum every user needs.

# Ignore HUP, INT, QUIT now.

trap "" 1 2 3

# Set the default paths - Do NOT modify these.
# Modify the variables through /etc/PATH and /etc/MANPATH

PATH=/usr/bin:/usr/ccs/bin:/usr/contrib/bin
MANPATH=/usr/share/man:/usr/contrib/man:/usr/local/man

# Insure PATH contains either /usr/bin or /sbin (if /usr/bin is not available).

if [ ! -d /usr/sbin ]
then
PATH=$PATH:/sbin

else if [ -r /etc/PATH ]
then

# Insure that $PATH includes /usr/bin . If /usr/bin is
# present in /etc/PATH then $PATH is set to the contents
# of /etc/PATH. Otherwise, add the contents of /etc/PATH
# to the end of the default $PATH definition above.

grep -q -e "^/usr/bin$" -e "^/usr/bin:" -e ":/usr/bin:"\
-e ":/usr/bin$" /etc/PATH
if [ $? -eq 0 ]
then
PATH=`cat /etc/PATH`
else
PATH=$PATH:`cat /etc/PATH`
fi
fi
fi

export PATH

# Set MANPATH to the contents of /etc/MANPATH, if it exists.

if [ -r /etc/MANPATH ]
then
MANPATH=`cat /etc/MANPATH`
fi

export MANPATH

# Set the TIMEZONE

if [ -r /etc/TIMEZONE ]
then
. /etc/TIMEZONE
else
TZ=MST7MDT # change this for local time.
export TZ
fi

# Be sure that VUE does not invoke tty commands

if [ ! "$VUE" ]; then

# set term if it's not set

if [ "$TERM" = "" -o "$TERM" = "unknown" -o "$TERM" = "dialup" \
-o "$TERM" = "network" ]
then
eval `ttytype -s -a`
fi

export TERM

# set erase to ^H, if ERASE is not set
if [ "$ERASE" = "" ]
then
ERASE="^H"
export ERASE
fi
stty erase $ERASE

# Set up shell environment:

trap "echo logout" 0


# This is to meet legal requirements...

cat /etc/copyright

# Message of the day

if [ -r /etc/motd ]
then
cat /etc/motd
fi

# Notify if there is mail

if [ -f /usr/bin/mail ]
then
if mail -e
then echo "You have mail."
fi
fi

# Notify if there is news

if [ -f /usr/bin/news ]
then news -n
fi

# Change the backup tape

if [ -r /tmp/changetape ]
then echo "\007\nYou are the first to log in since backup:"
echo "Please change the backup tape.\n"
rm -f /tmp/changetape
fi

fi # if !VUE

# Leave defaults in user environment.

trap 1 2 3
Peter Nikitka
Honored Contributor

Re: stty::not a typewriter

Hi,

change the statement
if [ ! "$VUE" ]; then
to
if [ ! "$CDE" ]; then

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"

Re: stty::not a typewriter

hi i am still getting the error messages.
After i have commented out the vue line.
As soon as i login the error message "ttytype: couldn't open /dev/tty for reading
stty: : Not a typewriter

above appears & the entire screen is scrambled

rariasn
Honored Contributor
Peter Nikitka
Honored Contributor

Re: stty::not a typewriter

Hi,

just better: change the statement
if [ ! "$VUE" ]; then
to
if [ ! "$CDE" -o ! -t 1 ]; then

so just every condition, where stdout is not available is caught.

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Bill Hassell
Honored Contributor

Re: stty::not a typewriter

The problem is that when you use ssh, somehow there is no terminal assigned to your session. You can verify this with the tty command. It should report something like this:

$ tty
/dev/pts/ta

If instead you get something like "not a pty" then your login is non-standard. Are you running ssh similar to remsh, that is, simply running a remote or batch command and not an interactive session with a shell prompt?

If so, that is the problem. There are several commands in your profiles that require a 'real' terminal. Among these are:

stty ttytype tset tput tabs

All of them will report "not a typewriter" when you are connected in batch mode. Now this is a common error because cron jobs and other batch or background jobs that perform a profile'd login will not have a tty/pty device. And the fix is to always protect these terminal-only commands:

if tty -s
then
ttytype -s
stty ...
tabs ...
fi

Now if this conditin exists only when more than 10 users on the system, I would suspect that your maximum pty/tty kernel parameter does not match your device files, or someone has removed one or more of these files. To fix this, run SAM and change the 3 parameters:

npty nstrtel nstrpty

all equal to 70 or so (actual number depends on the maximum number of connections you expect in the future). SAM will change the parameter and also repair the device files.


Bill Hassell, sysadmin

Re: stty::not a typewriter

gwsae02:moe:/users2/BAK # echo $tty
sh: tty: Parameter not set.
gwsae02:moe:/users2/BAK # $tty
sh: tty: Parameter not set.

Thats the output..

Will check the kernel settings

Re: stty::not a typewriter

Can't do a kernel change it requires a reboot,my server has not be booted in a long time 2:38pm up 479 days, 9:58, 9 users.

The kernel figures are all on 60.I have about 100 cron jobs running,most would be averaging around 30 at atime
Peter Nikitka
Honored Contributor

Re: stty::not a typewriter

Hi,

just call the tty command, no $ in front!

tty

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"

Re: stty::not a typewriter

Silly me

get a response
/dev/pts/21
Peter Nikitka
Honored Contributor

Re: stty::not a typewriter

Hi,

so now try =my corrected= entry in .profile:

if [ ! "$CDE" -a -t 1 ]; then
...
fi

mfG Peter
The Universe is a pretty big place, it's bigger than anything anyone has ever dreamed of before. So if it's just us, seems like an awful waste of space, right? Jodie Foster in "Contact"
Ram_31
Valued Contributor

Re: stty::not a typewriter

Hi Peter,

Even I'm facing the same problem as well. When I manually inserting incidents for a particular message through java consolve the OVO is throwing an error; please check the attachment for ur refernce.





Thanks,
Rama
skt_skt
Honored Contributor

Re: stty::not a typewriter

I would suggest to check your entries in /etc/inittab for stty and getty entries.

Be carefull while you modify/apply (init q)anything on /etc/inittab as it can casue a reboot.Check if any other critical services are mentioned in the file as thay also may get initialised.
skt_skt
Honored Contributor

Re: stty::not a typewriter

what is the OV version?
skt_skt
Honored Contributor

Re: stty::not a typewriter

what is the OS version?
Bill Hassell
Honored Contributor

Re: stty::not a typewriter

As mentioned before, you are trying to run /etc/profile and/or .profile in a batch job, perhaps from cron or at. This will also occur when you use su - oracle, or su - sybase, etc in a batch job.

Standard profiles are badly written. They are not correctly designed for batch operations. You must protect *all* interactive programs so they do not run if there is no tty device. The code would look like this:

if tty -s
then
eval $(ttytype -s)
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
stty susp \^Z dsusp \^Y
tput reset
tabs
TMOUT=3600
export HISTFILE=${HISTFILE:-$HOME/.sh_history}
export HISTSIZE=5000
DISPLAY=$(who -muR | awk '{print $NF}'):0.0
fi

This should be implemented for any flavor of Unix.


Bill Hassell, sysadmin
Ram_31
Valued Contributor

Re: stty::not a typewriter

Hi,

I'm using OVO 8.x and HP-UX hpus01 B.11.11 U 9000/800 versions.



Thanks,
Rama