HOWTO access the lpar through vterm without using HMC GUI

HOWTO access the lpar through vterm without using HMC GUI

The details are in the HMC for pSeries operation guide, Appendix D: Remote
Connection; however, there are corrections below.

To connect to the virtual terminal without using the HMC Terminal Emulator, you must first build a connect string.

The following is an example of an ASCII string that is sent to the HMC terminal server to establish a connection:

0 1 2 3 4 5 6 7

0:        FFFX            Start of string indicator.
          FFFX            Connect and issue terminal open command
          FFFF            Connect but assume terminal is already open

1:        31              Count in integer ASCII. The number of characters that follow the * character that follow the count.
                          In the above example, count from e in ehsc2 to the end of the string.

2:        ehsc2           Host name or IP address of the HMC workstation.

3:        9734            Port number of control element. In this example, 9734 is the port number.

4:        4               Partition slot number. 0 is used to open a terminal on the managed system in both Partition Standby and Full System Partition modes.
                          You can access the service processor menus from partition 0. Slots 1 to 16 are valid in Partition Standby mode only.
                          View the partition's properties to determine the partition slot number for a partition.

5:        7040-681        Machine type and model of the managed system. Use the managed system's properties panel to get the machine type and model.
                          Do not use the user-assigned managed system name.

6:        6382963         Serial number of the managed system. Use the HMC's properties panel to get the managed system serial number.

7:        1               TTY's session number.

After the connect string is built, you can connect to the HMC terminal server through a socket on port 9735.

After the connection is made, the connect string is sent to the virtual terminal server.

You must set the telnet mode to character.

To write the ctrl ] character into a script, you must use the sequence ctrl v ctrl ].

To end the session, do one of the following:

ctrl ]


Click Telnet and then select quit.

The following script demonstrates one method for connecting to the HMC remotely using telnet.

The following script is executed as:

script_name hostname port partition machine_type/model*serial session_id


hostname = hostname of the HMC
port = fixed at 9734
partition = the ID of the partition, ranging from 000 to 016

The following example shows how you can use a script to connect to a remote system:

#!/usr/bin/expect -f

system `echo [string length $argv]`
system `echo [lindex $argv 0]`
system `echo [lindex $argv 1]`
system `echo [lindex $argv 2]`
system `echo [lindex $argv 3]`
system `echo [lindex $argv 4]`
spawn telnet [lindex $argv 0] 9735
expect `Escape`

# Note that the 
 is not included in the send count
send -- `FFFX[string length $argv]*[lindex $argv 0]*[lindex $argv 1]*[lindex $argv 2]*[lindex $argv 3]*[lindex $argv 4]

sleep .5

send -- `^]
`  # on the document it was send -- `

sleep .5

expect `telnet`

send -- `mode character


How to log the output on vterm.

If you are successful with the 1 topic, you can use AIX command script to log everything in the telnet session.

The other way to log the information is through HMC itself as root (PE passcode or su from ssh).

First, you need to touch a file in /tmp with the same name you’ve seen on the vterm itself. This is something like:



004 partiton slot number
7040-681 machine model,type
024482A machine serial number

After touching this file, open the vterm as above and you should see all the output from that vterm logged into the file.

Comments are closed.