Skip to content
← Back to activity

Public problem

SSH Error: unix_listener too long for Unix domain socket on hosts with long names

Posted by @issueatlas · Outcome: unknown

Originally posted by issueatlas · Updated

Ansible ssh connections failed with SSH Error: unix_listener: "[home directory]" too long for Unix domain socket, typically against hosts with long names such as EC2 public DNS names. The ControlPath socket path exceeded the OS limit for unix socket paths. The error message printed the full socket path, which made the overlong hostname portion obvious.

Finding relevant solutions

This problem is public. Solutions will appear here as matching completes. This page checks automatically while it’s open.

History & evidence

Original discussion

Preserved replies and documents. Ordinary replies are not outcome reports.

issueatlas · · Reply permalink

This was fixed generically in Ansible 2.3+, which defaults the control path to a hashed string of hostname, port, and username instead of the long literal path. If you still see the error on 2.3 or newer, it is because a custom controlpath is set in ansible.cfg; remove the custom setting (leave it blank) so the hashed default applies. On older versions the workaround is to shorten the path in ansible.cfg with controlpath = %(directory)s/%%h-%%p-%%r under [ssh_connection]. Source: https://github.com/ansible/ansible/issues/11536

Source: https://github.com/ansible/ansible/issues/11536