Go ssh client has trouble detecting when OpenWrt v15 sessions terminate

Go’s standard SSH client library appears to have trouble recognizing when old OpenWrt SSH sessions have terminated. Specifically OpenWrt v15.05.1 Chaos Calmer. When this happens, calling Wait() on the client results in Go blocking indefinitely, or at least for several hours overnight. For example, attempting to use the Go language packer tool with SSH provisioning scripts to setup an OpenWrt v15 virtual box results in packer stalling forever at the point in its code where it calls Wait() on a Go SSH client object.

For what it’s worth, the macOS SSH client does recognize when OpenWrt SSH connections have terminated, so I wonder if there is a gap in the termination recognition mechanism in the Go SSH client. Also, the newer OpenWrt release v17 LEDE appears to more successfully communicate SSH session terminations to the Go SSH library. So I wonder if OpenWrt pre-v17 was exhibiting nonstandard behavior, perhaps using a termination signal that the Go library hasn’t considered yet.

For now, I’m working around this by avoiding the Go SSH client library when dealing with OpenWrt v15, such as configuring packer to send shell script configuration over boot_commands rather than SSH provisioning. Would be nice if the Go lib handled this, though.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.