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.

inconsistent 'failed to enter configuration mode'

See original GitHub issue

I have a script that iterates through a list of interfaces and enables PIM sparse-mode on Cisco IOS devices.

I have started receiving an error today that I’m unfamiliar with:

Traceback (most recent call last):
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 1531, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "/Applications/PyCharm.app/Contents/helpers/pydev/pydevd.py", line 938, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "/Users/tiger/PycharmProjects/enable_pim_sparse_mode/enable_pim_sql.py", line 80, in <module>
    ssh.send_config_set(updatePIM) # netmiko command to send to the switch
  File "/Library/Python/2.7/site-packages/netmiko/base_connection.py", line 606, in send_config_set
    output = self.config_mode()
  File "/Library/Python/2.7/site-packages/netmiko/ssh_connection.py", line 43, in config_mode
    return super(SSHConnection, self).config_mode(config_command=config_command)
  File "/Library/Python/2.7/site-packages/netmiko/base_connection.py", line 529, in config_mode
    raise ValueError("Failed to enter configuration mode")
ValueError: Failed to enter configuration mode
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pytz/__init__.py:29: UserWarning: Module logging was already imported from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/logging/__init__.pyc, but /Library/Python/2.7/site-packages is being added to sys.path
  from pkg_resources import resource_stream

Debugs show that it’s sourced from this line of code in base_connection.py:

        output = ''
        if not self.check_config_mode():
            output = self.send_command(config_command, strip_prompt=False, strip_command=False)
            if not self.check_config_mode():
                raise ValueError("Failed to enter configuration mode")
        return output

any ideas on where I can start my investigation?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
ktbyerscommented, Apr 8, 2016

@calvinchristopher Yes, I did a lot of work recently to improve the reliability of enable and config_mode methods (i.e. methods for going into, checking, and exiting these states).

I will probably try to push a new Netmiko version up to pypi in the next week or two.

0reactions
ghostcommented, Apr 8, 2016

upgrading to 0.4.3 seems to have resolved it. That will teach me to rely on pypi distros

/usr/bin/python /Users/tiger/PycharmProjects/enable_pim_sparse_mode/enable_pim_sql.py
please enter your username:
cisco
please enter your password:
cisco
================================================================
                             BR3 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: True
Action Taken: None

total time spent on BR3: 0:00:09.482675

================================================================
                             BR4 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: True
Action Taken: None

total time spent on BR4: 0:00:09.520650

================================================================
                             CE1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/3 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: True
Action Taken: None

total time spent on CE1: 0:00:12.901924

================================================================
                             CE2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on CE2: 0:00:24.716862

================================================================
                             RR2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on RR2: 0:00:22.807373

================================================================
                             PE2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/4 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on PE2: 0:00:31.041407

================================================================
                             SW1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Vlan2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on SW1: 0:00:11.851978

================================================================
                             CE2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/3 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: True
Action Taken: None

total time spent on CE2: 0:00:13.861730

================================================================
                             PE1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/4 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on PE1: 0:00:30.930158

================================================================
                             P1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/4 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/5 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/6 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on P1: 0:00:36.261775

================================================================
                             P2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/4 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/5 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/6 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on P2: 0:00:41.833375

================================================================
                             PE1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/3 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/4 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: True
Action Taken: None

total time spent on PE1: 0:00:14.611078

================================================================
                             PE2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/3 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/4 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on PE2: 0:00:18.804288

================================================================
                             PE3 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on PE3: 0:00:22.383493

================================================================
                             PE4 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on PE4: 0:00:24.292118

================================================================
                             RR1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/1 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/2 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface GigabitEthernet0/3 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

Interface Loopback0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on RR1: 0:00:23.810491

================================================================
                             RR2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/1 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/2 
Multicast Enabled: True
Action Taken: None

Interface GigabitEthernet0/3 
Multicast Enabled: True
Action Taken: None

Interface Loopback0 
Multicast Enabled: True
Action Taken: None

total time spent on RR2: 0:00:13.879310

================================================================
                             SW1 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: True
Action Taken: None

Interface Vlan2 
Multicast Enabled: True
Action Taken: None

total time spent on SW1: 0:00:06.053473

================================================================
                             SW2 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on SW2: 0:00:07.335349

================================================================
                             SW3 
================================================================

Interface GigabitEthernet0/0 
Multicast Enabled: False
PIM Sparse-Mode added to interface configuration

total time spent on SW3: 0:00:07.924848



Finished running the script in 0:06:28.193587 seconds

Process finished with exit code 0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solved: Running db may be inconsistent - Cisco Community
Solved: NSO 4.5.5.1 I am seeing the following in ncs_cli on the "master" in a high availability configuration just after adding a "slave"....
Read more >
Failed to enter configuration mode in Netmiko while trying to ...
I;m trying to use netmiko to login to aruba switches. while i pass on some commands using send_config_set, it is erroring out saying...
Read more >
DFS Namespaces service and configuration - Windows Server
Provides information about the Distributed File System (DFS) Namespaces service to help you create a new namespace.
Read more >
Inconsistent Databases and Recovery
If you receive an “inconsistent database” error after recovery is complete, ... To examine the configuration file of your database, enter the infodb...
Read more >
Resolve an Amazon RDS instance that is in an incompatible ...
Configurations can fail if you attempt to associate a different parameter group, scale the DB instance type, change the engine version, or ...
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