Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm attempting to do an Ansible ping ansible all -m ping --ask-pass but I get SSH failures. As the debug log is rather extensive, I've trimmed down the below quote to where I think the problem occurs. Earlier in the log, I am able to connect to the remote host (a headless RHEL5 VM) but when actually executing the "ping", it fails with the below error(s).

debug1: Entering interactive session.
debug2: set_control_persist_exit_time: schedule exit in 60 seconds
debug1: multiplexing control connection
debug2: fd 4 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 1: new [mux-control]
debug3: channel_post_mux_listener: new mux channel 1 fd 5
debug3: mux_master_read_cb: channel 1: hello sent
debug2: set_control_persist_exit_time: cancel scheduled exit
debug3: mux_master_read_cb: channel 1 packet type 0x00000001 len 4
debug2: process_mux_master_hello: channel 1 slave version 4
debug2: mux_client_hello_exchange: master version 4
debug3: mux_client_forwards: request forwardings: 0 local, 0 remote
debug3: mux_client_request_session: entering
debug3: mux_client_request_alive: entering
debug3: mux_master_read_cb: channel 1 packet type 0x10000004 len 4
debug2: process_mux_alive_check: channel 1: alive check
debug3: mux_client_request_alive: done pid = 9664
debug3: mux_master_read_cb: channel 1 packet type 0x10000002 len 264
debug2: process_mux_new_session: channel 1: request tty 1, X 0, agent 0, subsys 0, term "xterm", cmd "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1392125626.39-45498424175459 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1392125626.39-45498424175459 && echo $HOME/.ansible/tmp/ansible-tmp-1392125626.39-45498424175459'", env 0
debug3: mux_client_request_session: session request sent
mm_receive_fd: no message header
process_mux_new_session: failed to receive fd 0 from slave
debug1: channel 1: mux_rcb failed
debug2: channel 1: zombie
debug2: channel 1: gc: notify user
debug3: mux_master_control_cleanup_cb: entering for channel 1
debug2: channel 1: gc: user detached
debug2: channel 1: zombie
debug2: channel 1: garbage collecting
debug1: channel 1: free: mux-control, nchannels 2
debug3: channel 1: status: The following connections are open:

I connected by conventional SSH to the host machine then checked to see if xterm runs on the remote box and while it's installed. It runs but bombs out with the following error:

xterm Xt error: Can't open display:
xterm:  DISPLAY is not set

My hunch is that ssh connects, attempts to run the commands then can't because xterm bombs out. I've gone looking for a way to change which terminal to use but haven't been able to find anything in the documentation. Any input or suggestions are greatly appreciated.

share|improve this question
ssh -X perhaps? "-X Enables X11 forwarding. This can also be specified on a per host basis in a configuration file." – Cristian Ciupitu Feb 11 '14 at 15:31
up vote 3 down vote accepted

As of this writing, there's something weird about running Ansible in Cygwin on Windows. Not sure what it is but it's not anything I can fix. I switched over to a Linux VM and things have started to work properly.

share|improve this answer

I got it working on cygin with some 2 hours of googling freaky errors with the following set-up:

cat /etc/ansible/ansible.cfg
host_key_checking = False

probably bad for security ..., also:

 cat /etc/ansible/hosts
 [dbservers]   ansible_ssh_port=22     ansible_ssh_user=ssh_user


ansible -vvvv all -a "/bin/echo hello"

I had to make sure that public private key authentication is configured correctly

cat >> ~/.ssh/authorized_keys
cat ~/.ssh/authorized_keys
chmod 0600  ~/.ssh/authorized_keys
ls -al ~/.ssh/authorized_keys
rm -fv ~/

I would suspect the turning point for the configuration for groups and users on cygwin: and chown -v local_pc_user:local_pc_user ~/.ssh/

and finally the output is:

    <> REMOTE_MODULE command /bin/echo hello
    <> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o',
    '-o', 'StrictHostKeyChecking=no', '-o', 
    'Port=22', '-o', 'KbdInteractiveAuthentication=no',
    '-o', 'PreferredAuthentications=gssapi-with-mic,
    gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ssh_user', '-o', 'ConnectTimeout=10',
    '', "/bin/sh -c 'mkdir -p
    $HOME/.ansible/tmp/ansible-tmp-1397676665.28-153356552524280 &&
    chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1397676665.28-153356552524280 &&
    echo $HOME/.ansible/tmp/ansible-tmp-1397676665.28-153356552524280'"]
    <> PUT /tmp/tmprELaVU TO /export/home/ssh_user/.ansible/tmp/ansible-tmp-1397676665.28-153356552524280/command
    <> EXEC ['ssh', '-C', '-tt', '-vvv', '-o', 'ControlMaster=auto',
    '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/local_pc_user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'StrictHostKeyChecking=no', '-o', 'Port=22',
    '-o', 'KbdInteractiveAuthentication=no', '-o', 
    'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'User=ssh_user', '-o', 'ConnectTimeout=10'
    , '', "/bin/sh -c '/usr/bin/python 
    rm -rf /export/home/ssh_user/.ansible/tmp/ansible-tmp-1397676665.28-153356552524280/ 
    >/dev/null 2>&1'"] | success | rc=0 >>
share|improve this answer

This behaviour started after some Ansible update. In older Ansible versions I had no problems with it. It indeed seems to be xterm that is the problem. Why would Ansible need to run xterm? I'd class it as a bug in Ansible.

Anyway, I worked around the issue in Cygwin by adding the following to ~/.ssh/config:

ForwardX11 yes
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.