Tuesday, November 30, 2010

How to disconnect JUNOS TTY sessions with a TTY ID of "qX"

SUMMARY:
How to forcibly disconnect TTY sessions in JUNOS which got a TTY ID starting with either a q or an r or any following letter in the alphabet.
PROBLEM OR GOAL:
More than 32 TTY simultaneous sessions are opened to a router running a JUNOS version prior to 8.2.
As a result all the sessions beyond the 32nd simultaneous session the TTY session ID will start with q .
The CLI command  request system logout terminal X  does not work for the TTY sessions whose ID begin with aq or an r  , and the session is not terminated.


Below there is an example:
  • On the router there are many concurrent TTY sessions:  
  • operator@router> show system users no-resolve
    11:24AM  up 10 mins, 40 users, load averages: 0.11, 0.10, 0.06
    USER     TTY      FROM                              LOGIN@  IDLE WHAT
    operator  p0       172.26.24.43                     11:20AM     - -cli (cli)
    operator  p1       172.26.24.43                     11:22AM     2 -cli (cli)
    [...]
    operator  pv       172.26.24.43                     11:24AM     - -cli (cli)
    operator  q0       172.26.24.43                     11:24AM     - -cli (cli)
    operator  q1       172.26.24.43                     11:24AM     - -cli (cli)
    [...] 
     
  • Focusing on the first session starting with q (e.g. q0)
    operator@router> show system users no-resolve | match q0
    operator  q0       172.26.24.43                     11:24AM     - -cli (cli)
      
  • We try to close this session by using the following command: 
    operator@router> request system logout terminal q0
     
  • But the TTY session is still connected:
    operator@router> show system users no-resolve | match q0
    operator  q0       172.26.24.43                     11:24AM     - -cli (cli)
     
  • A different (expected) result can be observed, when trying to disconnect a TTY session with TTY ID lower than qX, i.e.p1
    operator@router> show system users no-resolve | match p1
    operator  p1       172.26.24.43                     11:22AM     7 -cli (cli)
    operator@router> request system logout terminal p1
    
    operator@router> show system users no-resolve | match p1
    
    operator@router> 
    The TTY session p1 has been disconnected as expected.
SOLUTION:
Use the PID of a certain TTY session to disconnect it, as shown in the example below:

  • Check which PID the TTY session q0 has: 
    operator@router> show system processes |match q0
    3603  ??  Is     0:00.01 mgd: (mgd) (operator)/dev/ttyq0 (mgd)
     
  • Then specify the PID of q0 in the CLI command request system logout terminal
    operator@router> request system logout terminal q0 pid 3603 
  • Verify, that the TTY session has been closed:
    operator@router> show system users no-resolve | match q0 

    operator@router>


Note: This issue has been tracked via PR/80848.

No comments:

Post a Comment