Errors attempting SSH or firmware upload on OTP >= 23.2

If you are using a system with nerves_system_br >= 1.14.0, you might noticing errors when trying to ssh such as:

$ ssh nerves.local
PTY allocation request failed on channel 0
...
iex(1)>

or unable to upload new firmware over ssh with mix upload or ./upload.sh script getting something like:

$ mix upload nerves.local

uploading to nerves.local...

subsystem request failed on channel 0
** (Mix) Unexpected exit from ssh (:epipe)
...
$

The reason is that OTP SSH was adjusted to follow RFC4254 which essentially states “if you don’t support a request, reject it”. However, the request also dictates if it wants a response or not but OTP wasn’t checking if the request wanted a reply and caused some minor things to be rejected, especially in cases of using PuTTY.

Luckily, this was already fixed while I was tracking it down (Check out this commit). Hopefully the fix will be released with OTP 23.2.3.

But fret not! In the meantime, the workaround is to remove anything in your SSH config that might be throwing unneeded requests in for a Nerves device that aren’t supported.

The biggest offender is probably going to be that you have ForwardAgent yes enabled globally in your config. this sends a request type of auth-agent-req@openssh.com without expecting a reply, but things still fail. Remove that line from your config for Nerves devices and you should be :ok_hand:

:tada::man_dancing::dancer: :clinking_glasses:

3 Likes