in reply to Net:SSH2 channels

Ensure you are using the latest version of the module and of libssh2. Then, don't follow any advice about using the module more than a couple of years old (It used to have lots of bugs needing ugly work arounds which are now fixed). Though, using the module is still not easy.

Also, try using it through Net::SSH::Any which provides a much friendly interface and knows how to handle most errors.

libssh2 has a debugging mode that you can activate, but the library needs to be compiled with it enabled