Operating System - HP-UX
1832177 Members
3058 Online
110038 Solutions
New Discussion

Re: Vi editor in single user mode .

 
donne007
Regular Advisor

Vi editor in single user mode .

Hi team.
When i Log in as a single user and set the TERM =Hp after mounting i,m not able to edit any files using Vi editor .. the error it throws is ..
"I don't know what kind of terminal youare on - all I have is 'Unknown' [using open mode]
Can any one help on this.
Thanks in Advance
Asif
7 REPLIES 7
Sridhar Bhaskarla
Honored Contributor

Re: Vi editor in single user mode .

Hi Asif,

It is case sensitive. Use "hp".

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
donne007
Regular Advisor

Re: Vi editor in single user mode .

Yeah sri, I tried usig TERM=hp and could'nt write/edit in any file
Ted Ellis_2
Honored Contributor

Re: Vi editor in single user mode .

any chance that vt100 will work...?
Bill Hassell
Honored Contributor

Re: Vi editor in single user mode .

In (true) single user mode, the automatic features such as identifying what terminal you are using (out out of the hundreds of incompatible terminals there are) will not run since nothing but / and /stand are mounted.

It is impossible to to run vi without properly identifying the terminal you are using. Start by mounting /var and /usr:

mount /var
mount /usr

Then use ttytype to identify the terminal:

eval $(ttytype -s)

Now see what was returned:

echo $TERM

It should match the device that you have connected to the console. Don't force the TERM value to some random terminal ID, vi will not be happy.


Bill Hassell, sysadmin
Martin Robinson
Frequent Advisor

Re: Vi editor in single user mode .

It is possible to use vi when in single user run level. As you say, it says it will use 'open mode'.

Although a bit tricky, this is a perfectly valid way of using vi. It is the fallback mode when it doesn't recognise the terminal type. It just takes a bit of getting used to.

The normal movement keys, hjkl and so on, work as you would expect.

You might prefer to use ex (command line) mode.
Joaquin Gil de Vergara
Respected Contributor

Re: Vi editor in single user mode .

reason is that terminals are compiled under

/usr/lib/terminfo

(see tic and untic man pages)

mount /usr and set TERM variable

Teach is the best way to learn
Andreas Voss
Honored Contributor

Re: Vi editor in single user mode .

Hi,

possibly in single user mode
the variable TERM is not exported.

Try:
TERM=hp ; export TERM
vi .....

Regards