Debugging an "unreachable" error when connecting to openwrt

316 views
Skip to first unread message

Johannes Kastl

unread,
Mar 3, 2016, 6:23:36 AM3/3/16
to ansible...@googlegroups.com
Hi all,

I want to manage a machine running openwrt with ansible. First I got
stuck just connecting to the machine, and I do not find the error:

> ansible -m setup 192.168.11.1
> 192.168.11.1 | UNREACHABLE! => {
> "changed": false,
> "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
> "unreachable": true
> }

I can ssh into the machine without errors with my ssh key loaded into
ssh-agent.

I tried to ansible to the IP, to the FQDN and to the short hostname.
No change, but each works with ssh (.ssh/config contains entries for
IP, hostname and FQDN).

I added ansible_port and ansible_user to the host_vars file for this
machine.

I installed python on the machine.

I tried paramiko but got no further than a sftp error.

I deleted all lines for this host from my ~/.ssh/config file, but
still unreachable.

Using ansible -vvvv shows lots of output, shows that remote port and
user are configured but otherwise no

> ansible -vvvv -m setup 192.168.11.1
> Using /Users/XYZ/.ansible.cfg as config file
> Loaded callback minimal of type stdout, v2.0
> <192.168.11.1> ESTABLISH SSH CONNECTION FOR USER: XYZ_remote_user
> <192.168.11.1> SSH: EXEC ssh -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=XYZ_remote_user -o ConnectTimeout=10 -o ControlPath=/Users/XYZ/.ansible/cp/ansible-ssh-%h-%p-%r -tt 192.168.11.1 '/bin/sh -c '"'"'( umask 22 && mkdir -p "` echo $HOME/.ansible/tmp/ansible-tmp-1457003393.13-114556537372930 `" && echo "` echo $HOME/.ansible/tmp/ansible-tmp-1457003393.13-114556537372930 `" )'"'"''
> <192.168.11.1> PUT /var/folders/p7/9skq460x09qb37swmbc4thww0000z8/T/tmpr80zDZ TO /home/XYZ_remote_user/.ansible/tmp/ansible-tmp-1457003393.13-114556537372930/setup
> <192.168.11.1> SSH: EXEC sftp -b - -C -vvv -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=XYZ_remote_user -o ConnectTimeout=10 -o ControlPath=/Users/XYZ/.ansible/cp/ansible-ssh-%h-%p-%r '[192.168.11.1]'
> 192.168.11.1 | UNREACHABLE! => {
> "changed": false,
> "msg": "SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh",
> "unreachable": true
> }

########################

Funny enough, using the raw module to call date kinda works:
> ansible -v -m raw -a date 192.168.11.1
> Using /Users/XYZ/.ansible.cfg as config file
> 192.168.11.1 | SUCCESS | rc=0 >>
> shell-init: error retrieving current directory: getcwd: cannot access parent directories: Success
> Thu Mar 3 12:17:21 CET 2016

I do not know where the shell-init error is from, as both bash and
python seem to be in standard places:
/bin/bash
/usr/bin/python

Any hints are highly appreciated.

Johannes

signature.asc

Johannes Kastl

unread,
Mar 4, 2016, 4:13:57 PM3/4/16
to ansible...@googlegroups.com
Hi,

Am 03.03.16 schrieb Johannes Kastl:

> I want to manage a machine running openwrt with ansible. First I got
> stuck just connecting to the machine, and I do not find the error:
[...]
> Funny enough, using the raw module to call date kinda works:

This seems to be related to dropbear. When using openssh-server (with
openssh-sftp-server installed) I can connect and get a warning about a
missing python module.

Installing python rather than python-light seems to solve these issues...

Johannes

signature.asc
Reply all
Reply to author
Forward
0 new messages