SSH to container fails with: sh: $(if [ -f /usr/bin/balena ]

Issue trying to SSH into container from running on RPi2 from Windows 10 machine, possibly related to:

When attempting from same environment (Win10, Git Bash, MinGW64), I get:

$ balena local ssh balena-rpi2-dev.local --container main_1_1
sh: -c: line 0: syntax error near unexpected token `then'
sh: -c: line 0: `$(if [ -f /usr/bin/balena ]; then echo \"balena\"; else echo \"docker\"; fi) exec -ti main_1_1 /bin/sh -c $\'if [ -e /bin/bash ]; then exec /bin/bash; else exec /bin/sh; fi'"'
Connection to balena-rpi2-dev.local closed.

But when I try to connect via PowerShell, I get:

PS C:\WINDOWS\system32> balena local ssh 192.168.0.17 --container main_1_1
sh: $(if [ -f /usr/bin/balena ]; then echo "balena"; else echo "docker"; fi): No such file or directory
Connection to 192.168.0.17 closed.

I can ssh into the host with no problem at all, but not the container.

root@balena-rpi2-dev:~# balena-engine version
Client:
Version: 17.12.0-dev
API version: 1.35
Go version: go1.9.7
Git commit: dceb2fc48071b78a8a828e0468a15a479515385f
Built: Thu Jan 17 15:08:33 2019
OS/Arch: linux/arm
Experimental: false
Orchestrator: swarm

Server:
Engine:
Version: 17.12.0-dev
API version: 1.35 (minimum version 1.12)
Go version: go1.9.7
Git commit: dceb2fc48071b78a8a828e0468a15a479515385f
Built: Thu Jan 17 15:08:33 2019
OS/Arch: linux/arm
Experimental: true

balena-cli version is 10.8.0

Any thoughts?

Hi @webtop,

Thanks for letting us know there’s an issue. There’s a duplicate thread here: SSH connection to device in local mode fails

We’ve posted a workaround (although it looks like you can get into the host, which means you should be able to use this), and the relevant engineer has been contacted. When we have more information, we’ll certainly update you all.

Best regards, Heds

Thanks Heds :slight_smile: