Stack trace about incorrect padding

When i am trying to use Ansible, I am getting the following errors on
all hosts in my playbook.

Any ideas ?

Traceback (most recent call last):
  File "/usr/lib/python2.6/site-packages/ansible/runner/connection_plugins/paramiko_ssh.py",
line 318, in close
    self.ssh.load_system_host_keys()
  File "/usr/lib/python2.6/site-packages/paramiko/client.py", line
149, in load_system_host_keys
    self._system_host_keys.load(filename)
  File "/usr/lib/python2.6/site-packages/paramiko/hostkeys.py", line
155, in load
    e = HostKeyEntry.from_line(line)
  File "/usr/lib/python2.6/site-packages/paramiko/hostkeys.py", line
67, in from_line
    key = RSAKey(data=base64.decodestring(key))
  File "/usr/lib64/python2.6/base64.py", line 321, in decodestring
    return binascii.a2b_base64(s)
Error: Incorrect padding

Regards,

Interesting this is happening when it is loading system host keys.

Can you perhaps share your known hosts file with me privately?

Sounds like paramiko is unhappy which could be a version issue and may require consulting with upstream.

(Alternatively, I would suggest -c ssh, especially if running on Fedora or Ubuntu, which have a new enough SSHd to support ControlPersist.)

–Michael

Sorry i blew my known_hosts file and then ran again. It did not give
that error again.

Regards,

Resurrecting this thread in case other Ansible users encounter this again.

I encountered this on one of my developer’s systems and the root cause was a ssh known_host’s line missing the “==” at the end.

Based on the comments of the paramiko from_line() method, the input is assumed to be in “OpenSSH known hosts format”, which in this case, the text is not (as it was mangled accidentally). Some simplistic regex could be implemented to either skip the line, or eat the exception in the load() method?

I would assume that Paramiko would want to ignore bad lines vs. just barf on them. If anyone from the Ansible team picks this up and has an opinion, I am all ears, otherwise I’ll open an issue with the Paramiko folks and see if they are failing fatally here by design and if they are open to a pull request. From an ansible user perspective, especially when attempting to automating things like developer workstation maintenance, being tolerant of managled host files is a not-very-important, but useful thing to do.

If you are getting a traceback and have instructions for us to reproduce, please file a bug or make a pull request.