# Stack trace about incorrect padding

**URL:** <https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243>\
**Category:** Ansible Project\
**Created:** [August 1, 2013, 7:08pm UTC](https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243 "2013-08-01T19:08:01Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kavin\_Kankeshwar](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@Kavin\_Kankeshwar](https://forum.ansible.com/u/Kavin_Kankeshwar)\
**Post date:** [August 1, 2013, 7:08pm UTC](https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243/1 "2013-08-01T19:08:01Z")

</div>

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):  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/ansible/runner/connection\_plugins/paramiko\_ssh.py",  
line 318, in close  
&nbsp;&nbsp;&nbsp;&nbsp;self.ssh.load\_system\_host\_keys()  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/paramiko/client.py", line  
149, in load\_system\_host\_keys  
&nbsp;&nbsp;&nbsp;&nbsp;self.\_system\_host\_keys.load(filename)  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/paramiko/hostkeys.py", line  
155, in load  
&nbsp;&nbsp;&nbsp;&nbsp;e = HostKeyEntry.from\_line(line)  
&nbsp;&nbsp;File "/usr/lib/python2.6/site-packages/paramiko/hostkeys.py", line  
67, in from\_line  
&nbsp;&nbsp;&nbsp;&nbsp;key = RSAKey(data=base64.decodestring(key))  
&nbsp;&nbsp;File "/usr/lib64/python2.6/base64.py", line 321, in decodestring  
&nbsp;&nbsp;&nbsp;&nbsp;return binascii.a2b\_base64(s)  
Error: Incorrect padding

Regards,

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 1, 2013, 7:43pm UTC](https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243/2 "2013-08-01T19:43:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Kavin\_Kankeshwar](https://avatars.discourse-cdn.com/v4/letter/k/35a633/32.png) [@Kavin\_Kankeshwar](https://forum.ansible.com/u/Kavin_Kankeshwar)\
**Post date:** [August 1, 2013, 7:50pm UTC](https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243/3 "2013-08-01T19:50:19Z")

</div>

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

Regards,

---

<div class="post-metadata">

**Author:** ![Jonathan1](https://avatars.discourse-cdn.com/v4/letter/j/f14d63/32.png) [@Jonathan1](https://forum.ansible.com/u/Jonathan1)\
**Post date:** [January 7, 2014, 7:49pm UTC](https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243/4 "2014-01-07T19:49:58Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![tannerjc](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/tannerjc/32/985_2.png) [@tannerjc](https://forum.ansible.com/u/tannerjc)\
**Post date:** [January 8, 2014, 10:08pm UTC](https://forum.ansible.com/t/stack-trace-about-incorrect-padding/13243/5 "2014-01-08T22:08:36Z")

</div>

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