# When running a playbook, I get "Couldn't read packet: Connection reset by peer" error.

**URL:** <https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [September 12, 2014, 6:42pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201 "2014-09-12T18:42:07Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [September 12, 2014, 6:42pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/1 "2014-09-12T18:42:07Z")

</div>

When running a playbook, I get “Couldn’t read packet: Connection reset by peer” error.

For playbook, command, and -vvvv output see: [http://pastebin.com/VgAuvrct](http://pastebin.com/VgAuvrct)

Ansible works fine on host1, but I get the error on host2.

If I just use ssh on the command line, both hosts work fine.

I’ve triple checked firewall, ssh\_config, sshd\_config, /tmp permissions, the users authorized\_keys file perms, .ssh dir perms, ssh version, and even the network configuration. Both servers are configured exactly the same.

The remote hosts are running OES11 SP1.

My local desktop is Ubuntu 14.04.

I just pulled the devel branch of Ansible this morning.

Suggestions?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 12, 2014, 7:21pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/2 "2014-09-12T19:21:57Z")

</div>

Can you show /tmp permissions?

Also make sure you are SSH’ing as root and not a different user when doing the SSH check?

---

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [September 12, 2014, 7:58pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/3 "2014-09-12T19:58:50Z")

</div>

/tmp on host1

> drwxrwxrwt 45 root root 4096 Sep 12 11:26 tmp

/tmp on host2

> drwxrwxrwt 47 root root 12288 Sep 12 12:55 tmp

root is blocked from ssh.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 12, 2014, 8:06pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/4 "2014-09-12T20:06:20Z")

</div>

What about permissions on the ansible-tmp directory mentioned above?

You may need to set ANSIBLE\_KEEP\_REMOTE\_FILES=1 in your environment to keep it around.

---

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [September 12, 2014, 8:29pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/5 "2014-09-12T20:29:33Z")

</div>

On host1 (where it works)  
drwxr-xr-x 2 remoteuser users 4096 Sep 12 13:21 ansible-tmp-1410553290.83-203438518100770

tmp/ansible-tmp-1410553290.83-203438518100770:  
total 164  
-rw------- 1 remoteuser users 163033 Sep 12 13:21 setup

On host2 (where it doesn’t work)  
drwxr-xr-x 2 remoteuser users 4096 Sep 12 11:26 ansible-tmp-1410546380.19-138456709998536

# ll tmp/ansible-tmp-1410546380.19-138456709998536

total 0

Like I saw before, the perms are the same.

I initially thought it could be a misconfigured sftp configuration line in the sshd\_config. But the two configs are identical.

Hmm… I did check sudo config in the UI, but I haven’t tried visudo yet. Maybe that’ll show something…

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 12, 2014, 8:35pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/6 "2014-09-12T20:35:04Z")

</div>

If using the SSH connection (which you are by default) you could consider toggling SFTP/SCP in ansible.cfg and see if that helps.

One more thing to try…

But yeah you say those are the same so that’s weird.

---

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [September 12, 2014, 8:45pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/7 "2014-09-12T20:45:41Z")

</div>

scp\_if\_ssh=True made it work. Weird, very weird.

Is there any major difference between using sftp vs scp?

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [September 12, 2014, 8:47pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/8 "2014-09-12T20:47:46Z")

</div>

Basically none.

Sometimes sftp is disabled.

I offhand can’t remember why we didn’t just scp every time - but I think that may encounter occasional reasons as well, perhaps on odd platforms.

---

<div class="post-metadata">

**Author:** ![David\_Reagan](https://avatars.discourse-cdn.com/v4/letter/d/71e660/32.png) [@David\_Reagan](https://forum.ansible.com/u/David_Reagan)\
**Post date:** [September 12, 2014, 9:03pm UTC](https://forum.ansible.com/t/when-running-a-playbook-i-get-couldnt-read-packet-connection-reset-by-peer-error/16201/9 "2014-09-12T21:03:36Z")

</div>

In that case, I’ll just leave it set to use scp.

Thanks for the help! 🙂
