Skip to content

Conversation

@douglas-raillard-arm
Copy link
Collaborator

Pass the timeout also as paramiko.SshClient(banner_timeout=...) parameter so that we don't get the following exception too early:

SSH logic error: Error reading SSH protocol banner

Fixes #725

@douglas-raillard-arm
Copy link
Collaborator Author

So after more testing, that fixes the problem when the target has a working network stack and SSH not running (or starting up), but it does not fix it if the board is just disconnected (e.g. very early boot). I'll see how to deal with that and update the PR

@douglas-raillard-arm
Copy link
Collaborator Author

PR updated with manual timeout logic. This was needed as no paramiko SshClient parameter seems to be able to delay exceptions in case the host is not available at all (e.g. not booted yet).

Pass the timeout also as paramiko.SshClient(banner_timeout=...)
parameter so that we don't get the following exception too early:

SSH logic error: Error reading SSH protocol banner

Also fix the case where the target hostname is not even available (e.g.
very early boot before the network stack has been started).
@douglas-raillard-arm
Copy link
Collaborator Author

There still seems to be some cases not covered when devlib tries connecting before the target has been booted (before the network stack is up and running):

  File "/home/dourai01/Work/projects/devlib/devlib/utils/ssh.py", line 421, in _make_client
    with _handle_paramiko_exceptions():
  File "/usr/lib/python3.12/contextlib.py", line 158, in __exit__
    self.gen.throw(value)
  File "/home/dourai01/Work/projects/devlib/devlib/utils/ssh.py", line 104, in _handle_paramiko_exceptions
    raise TargetTransientError('SSH logic error: {}'.format(e))
devlib.exception.TargetTransientError: SSH logic error: Error reading SSH protocol banner[Errno 104] Connection reset by peer

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

Successfully merging this pull request may close these issues.

SshConnection does not honor its timeout parameter

1 participant