Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fatal: "Failed to connect to the host via scp" #64

Open
JayBraker opened this issue Aug 29, 2023 · 6 comments
Open

fatal: "Failed to connect to the host via scp" #64

JayBraker opened this issue Aug 29, 2023 · 6 comments

Comments

@JayBraker
Copy link

JayBraker commented Aug 29, 2023

Hi, I am running ansible 2.15 on Debian Bookworm (OpenSSH 9.2p1)
The host runs openwrt-23.05.0-rc2

Right now I am unable to even run any playbook, as the included tasks already fail.

ansible [core 2.15.3]
   config file = None
   configured module search path = ['/home/josha/.ansible/roles/gekmihesg.openwrt/library']
   ansible python module location = /home/josha/venv/lib/python3.11/site-packages/ansible
   ansible collection location = /home/josha/.ansible/collections:/usr/share/ansible/collections
   executable location = /home/josha/venv/bin/ansible
   python version = 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0] (/home/josha/venv/bin/python3)
   jinja version = 3.1.2
   libyaml = True

$ ssh -V
OpenSSH_9.2p1 Debian-2, OpenSSL 3.0.9 30 May 2023

$ ~/venv/bin/ansible-playbook ./Documents/router.yml -i ./Documents/inventory.conf

PLAY [openwrt] **************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************
[WARNING]: sftp transfer mechanism failed on [192.168.1.1]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [192.168.1.1]. Use ANSIBLE_DEBUG=1 to see detailed information
ok: [192.168.1.1]

TASK [gekmihesg.openwrt : pin defaults] *************************************************************************************************************************************************************************
ok: [192.168.1.1]

TASK [gekmihesg.openwrt : install recommended packages] *********************************************************************************************************************************************************
included: /home/josha/.ansible/roles/gekmihesg.openwrt/tasks/packages.yml for 192.168.1.1

TASK [gekmihesg.openwrt : check whether opkg caches need update] ************************************************************************************************************************************************
fatal: [192.168.1.1]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via scp: ash: /usr/libexec/sftp-server: not found\nscp: Connection closed\r\n", "unreachable": true}

PLAY RECAP ******************************************************************************************************************************************************************************************************
192.168.1.1                : ok=3    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0

Any idea why or what details I should provide?

Kind regards, Josha

@Jonny007-MKD
Copy link

Hi Josha,
I suspect this is rather related to OpenWRT 23.05 than to Debian Bookworm, but who knows.
Is there some helpful output when running the playbook with ANSIBLE_DEBUG=1?

$ ANSIBLE_DEBUG=1 ~/venv/bin/ansible-playbook ./Documents/router.yml -i ./Documents/inventory.conf

@JayBraker
Copy link
Author

Unfortunately I disagree, switching to an older OpenSSH 7 install (which shipped with ubuntu-18.04) circumvented the issue entirely.
Maybe two separate issues collide here but I am pretty confident it is not just the newer OpenWRT at fault.

I will provide Debug output but I didn't see anything stick out yesterday

@Jonny007-MKD
Copy link

Oh, true, OpenSSH 9 deprecated SCP:
https://www.openssh.com/txt/release-9.0
openwrt/openwrt#9889

Probably the best solution is to set ansible_scp_extra_args = "-O" on the host/group in the inventory:
ansible/ansible#78600

@JayBraker
Copy link
Author

Yes. This was already hinted at in a PR #59
Maybe accepting that or amending the docs appropriately would help avoid confusion by others

@Jonny007-MKD
Copy link

I agree. @gekmihesg doesn't seem to actively maintain this role, though.

@marek22k
Copy link

marek22k commented Apr 2, 2024

I also have this problem. Are there any news in the meantime?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants