question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

global_cmd_verify needs disabled on cisco_ios if terminal width command fails

See original GitHub issue

I have a telnet session with limited command access. It appears the ‘terminal width 511’ is failing due to command authorization and the ConnectHandler() call returns None.

Is there a way to avoid this behavior/startup sequence? I may not be able to have access to the terminal commands in this environment.

net_connect = ConnectHandler(device_type=device_type,
                                    host=dev['ip_address'],
                                    username=credentials['username'],
                                    password=credentials['password'],
                                    secret=credentials['secret'],
                                    port=3001,
                                    timeout=timeout_value)
Timed-out reading channel, pattern not found in output: terminal\ length\ 0
Traceback (most recent call last):
  File "xxxxxxxx_sh_ip_route.py", line 65, in <module>
    update(xxxxxx)
  File "xxxxxxxxxx_sh_ip_route.py", line 48, in update
    if not dev['conn'].is_alive():
AttributeError: 'NoneType' object has no attribute 'is_alive'
Username: 
DEBUG:netmiko:write_channel: b'xxxxxxxxx\r'
DEBUG:netmiko:read_channel: xxxxxxxxx
Password: 
DEBUG:netmiko:write_channel: b'xxxxxxxxx\r'
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:write_channel: b'\r\n'
DEBUG:netmiko:read_channel: 
C
xxxxxxxxxxxxxxxxxx 

xxxxxxx#
xxxxxxx#
DEBUG:netmiko:write_channel: b'terminal width 511\r\n'
DEBUG:netmiko:Pattern is: terminal width 511
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: termi
DEBUG:netmiko:read_channel: nal wi
DEBUG:netmiko:read_channel: dth 51
DEBUG:netmiko:read_channel: 1

DEBUG:netmiko:Pattern found: terminal width 511 terminal width 511

DEBUG:netmiko:In disable_paging
DEBUG:netmiko:Command: terminal length 0

DEBUG:netmiko:write_channel: b'terminal length 0\r\n'
DEBUG:netmiko:Pattern is: terminal\ length\ 0
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: Command authorization failed.

xxxxxxxx#te
DEBUG:netmiko:write_channel: b'\r\n'
DEBUG:netmiko:read_channel: rminal length 0

DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: xxxxxxxxx#
xxxxxxxxx#
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:read_channel: 
DEBUG:netmiko:write_channel: b'exit\r\n'
DEBUG:netmiko:read_channel: CC

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Suterusu1337commented, May 13, 2021

global_cmd_verify = False

This worked. Also to note, the router was taking terminal length 0 just fine, it was not failing on that part per say, but netmiko was stating not found even though it was the terminal width 511 that was actually having the problem. I had the ability to run terminal length 0 without any AAA issues from the router (when tested manually).

0reactions
ktbyerscommented, May 13, 2021

Try setting the following argument in your ConnectHandler call

global_cmd_verify = False

Let me know if that fixes your issue.

Note, you are likely going to have significant issues if you cannot disable output paging i.e. execute terminal length 0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Disabling Paging and Setting Terminal Width fails on IOS ...
IOS Device doesn't disable paging or set the terminal width properly when user privilege is 0 If you login with a user that...
Read more >
Set Column width - Cisco Community
Hi, i have a problem with the "show lldp neighbors" command. I have set "terminal datadump" and "terminal width 0", but a table...
Read more >
terminal length — command - Cisco IOS in a Nutshell, 2nd ...
This command is useful if you are using a terminal or terminal emulator with a viewing area that is not 24 lines long....
Read more >
ansible cisco ios_command module "unable to set terminal ...
The error unable to set terminal parameters means that one (or both) of the following commands failed: terminal length 0; terminal width 512....
Read more >
Privilege level for Cisco IOS/IOS-XE
For authenticated scanning of Cisco IOS or IOS-XE devices you'll need to provide a ... Level 0 - Includes only basic commands (disable,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found