1827249 Members
2708 Online
109716 Solutions
New Discussion

SAM

 
SHADRACH AMARH
Advisor

SAM

hi all
i am facing a very dificult problem..i want to access the kernel configuration from sam,but when i when i go to sam and i try to access the kernel configuration option, it says,.....The environment variable TERM is not set or set to an unsupported terminal Exiting.

Press to continue sam...
cna some one please help me ?.....
6 REPLIES 6
TTr
Honored Contributor

Re: SAM

So what is TERM set to before you run sam?

How are you connecting to the server to run sam?

# echo $TERM
# sam
Steven E. Protter
Exalted Contributor

Re: SAM

Shalom,

export TERM=vt100
# pick a terminal type that works for you.
sam

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
Bill Hassell
Honored Contributor

Re: SAM

You are seeing a very old problem with standard HP profiles. The profile checks if TERM is assigned a value at the start of the profile and if so, assumes that TERM makes sense to HP-UX tools like SAM. That is a very bad assumption as well as the fix to hardcode TERM=vt100. There are hundreds of terminals and emulators and HP-UX has a comprehensive database to handle all of them in /usr/lib/terminfo.

To fix this problem, you must remove the defective code that looks like this:

# Be sure that VUE does not invoke tty commands
if [ ! "$VUE" ]; then
# Set up the terminal:
if [ "$TERM" = "" ]
then
eval ` tset -s -Q -m ':?hp' `
else
eval ` tset -s -Q `
fi
stty erase "^H" kill "^U" intr "^C" eof "^D"
stty hupcl ixon ixoff
tabs
echo
echo "Value of TERM has been set to \"$TERM\". "
export TERM
EDITOR=vi
export EDITOR
fi # if !VUE

= = = = = = = = = = = =

And replace that code with:

# Bypass interactive-only code
tty â s
RTN=$?
if [ $RTN â eq 0 ]
then

# ID the terminal
eval $(ttytype â s)

# In case we are on a GSP/MP that blocks ttytype,
# use resize to query the LINES and COLUMNS
LINES=${LINES:-â â }
[ â $LINESâ = â â ] && eval $(resize)

# Set stty and tabs
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
stty susp \^Z dsusp \^Y
tabs

# Turn off the softkey labels 'cause they burn
# terminal screens and are annoying when editing
# or watching commands and data.
# (no effect for non-softkey terminals)
# Also send an sgr0 (end enhancements) in case it is ON
echo "$(tput rmln)$(tput sgr0)\c"

# Set user's shell to always timeout so forgotten logins will go away
# Change TMOUT to readonly to remind users how important this is.
# For development/deployment, this can be left as a writable variable
# that will require changing at each login..again, to remind users
# that leaving a session open is a security risk.
# To avoid a shell error from TMOUT set to readonly, check using the
# shell readonly builtin for a list of readonly variables and
# skip setting TMOUT if it is already readonly.
STDTMOUT=6000
if [ $(readonly | grep -c TMOUT) -eq 0 ]
then
export TMOUT=${TMOUT:-$STDTMOUT} # undefined
[ $TMOUT = 0 ] && export TMOUT=$STDTMOUT # defined as zero, set to $STDTMOUT
fi

# Set HISTFILE and HISTSIZE
export HISTFILE=${HISTFILE:-$HOME/.sh_history} # if not set already
export HISTSIZE=5000 # history file size

# Set PS1 (customize as needed)
# PS1=â ${PWD##*/} $â (this shows current directory)
[ $(id â u) â eq 0 ] && PS1=â # â || PS1=â $ â

# Clear any extra input lines that may be buffered

while :
do
ANS=$(line -t 1)
ERR=$?
[ $ERR -ne 0 ] && break
done
fi

= = = = = = = = = = = =

They key to your specific problem is the ttytype -s command. It will automatically figure out your terminal and set TERM, LINES, COLUMNS and ERASE. The rest of the code handles many future problems you may see with default profiles. Be sure to check /etc/profile as well as .profile in all user $HOME directories.


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: SAM

Sorry about the Windows special characters in the second listing. Here is the clean version:

# Bypass interactive-only code
tty â s
RTN=$?
if [ $RTN â eq 0 ]
then

# ID the terminal
eval $(ttytype â s)

# In case we are on a GSP/MP that blocks ttytype,
# use resize to query the LINES and COLUMNS
LINES=${LINES:-â â }
[ â $LINESâ = â â ] && eval $(resize)

# Set stty and tabs
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
stty susp \^Z dsusp \^Y
tabs

# Turn off the softkey labels 'cause they burn
# terminal screens and are annoying when editing
# or watching commands and data.
# (no effect for non-softkey terminals)
# Also send an sgr0 (end enhancements) in case it is ON

echo "$(tput rmln)$(tput sgr0)\c"

# Set user's shell to always timeout so forgotten logins will go away
# Change TMOUT to readonly to remind users how important this is.
# For development/deployment, this can be left as a writable variable
# that will require changing at each login..again, to remind users
# that leaving a session open is a security risk.

# To avoid a shell error from TMOUT set to readonly, check using the
# shell readonly builtin for a list of readonly variables and
# skip setting TMOUT if it is already readonly.

STDTMOUT=6000
if [ $(readonly | grep -c TMOUT) -eq 0 ]
then
export TMOUT=${TMOUT:-$STDTMOUT} # undefined
[ $TMOUT = 0 ] && export TMOUT=$STDTMOUT # defined as zero, set to $STDTMOUT
fi

# Set HISTFILE and HISTSIZE
export HISTFILE=${HISTFILE:-$HOME/.sh_history} # if not set already
export HISTSIZE=5000 # history file size

# Set PS1 (customize as needed)
# PS1=â ${PWD##*/} $â (this shows current directory)
[ $(id â u) â eq 0 ] && PS1=â # â || PS1=â $ â

# Clear any extra input lines that may be buffered
while :
do
ANS=$(line -t 1)
ERR=$?
[ $ERR -ne 0 ] && break
done
fi


Bill Hassell, sysadmin
Bill Hassell
Honored Contributor

Re: SAM

One more time...


# Bypass interactive-only code
tty -s
RTN=$?
if [ $RTN -eq 0 ]
then

# ID the terminal
eval $(ttytype -s)

# In case we are on a GSP/MP that blocks ttytype,
# use resize to query the LINES and COLUMNS
LINES=${LINES:-""}
[ "$LINES" = "" ] && eval $(resize)

# Set stty and tabs
stty erase "^H" kill "^U" intr "^C" eof "^D" -parity ixoff
stty susp \^Z dsusp \^Y
tabs

# Turn off the softkey labels 'cause they burn
# terminal screens and are annoying when editing
# or watching commands and data.
# (no effect for non-softkey terminals)
# Also send an sgr0 (end enhancements) in case it is ON

echo "$(tput rmln)$(tput sgr0)\c"

# Set user's shell to always timeout so forgotten logins will go away
# Change TMOUT to readonly to remind users how important this is.
# For development/deployment, this can be left as a writable variable
# that will require changing at each login..again, to remind users
# that leaving a session open is a security risk.

# To avoid a shell error from TMOUT set to readonly, check using the
# shell readonly builtin for a list of readonly variables and
# skip setting TMOUT if it is already readonly.

STDTMOUT=6000
if [ $(readonly | grep -c TMOUT) -eq 0 ]
then
export TMOUT=${TMOUT:-$STDTMOUT} # undefined
[ $TMOUT = 0 ] && export TMOUT=$STDTMOUT # defined as zero, set to $STDTMOUT
fi

# Set HISTFILE and HISTSIZE
export HISTFILE=${HISTFILE:-$HOME/.sh_history} # if not set already
export HISTSIZE=5000 # history file size

# Set PS1 (customize as needed)
# PS1='${PWD##*/} $' (this shows current directory)
[ $(id -u) -eq 0 ] && PS1="# " || PS1="$ "

# Clear any extra input lines that may be buffered
while :
do
ANS=$(line -t 1)
ERR=$?
[ $ERR -ne 0 ] && break
done
fi


Bill Hassell, sysadmin
Jupinder Bedi
Respected Contributor

Re: SAM

you can simply do as follows and I am sure it will work for you

#TERM=vt100;export TERM

#sam


Best of luck
All things excellent are as difficult as they are rare