Peer-me a Connection Reset

If you are working with a jailbroken device for testing purposes, take notice of the lightning cable you’re using – its age and intended use. Meaning, did the cable originally come with an old device, like an iPhone 5s? Are you testing with a newer device? Is the cable consistently working for you, or are there instances when it does not charge your test device? Are you having issues connecting to the device using SSH. If you’re having connectivity issues, then check the lightning cable. Doing so could save you some brain-ache.

Recently, I wanted to connect to my device using iPhone Tunnel. I was all set to go, but instead, encountered the following message in Terminal when I tried to SSH in:

kex_exchange_identification: read: Connection reset by peer

This wasn’t the first time encountering this message. A few hours prior, I received this message while attempting to connect to the device. After disconnecting, reconnecting, and restarting my laptop, the error message was no-more. But, where I was… again… with the same ol’ message.

To take things even farther back in time, I had encountered this message about a year ago, and it had something to do with incorrect RSA keys. I had wiped my device, and started fresh. That meant establishing a new trust relationship – something I didn’t know about at the time. After poking around on Google, I tracked down the solution that worked – finding the old keys in a file on my Mac, deleting them, and establishing a new handshake with my test device. It took me forever to identify the underlying issue (or so it seemed). However, this time I had not wiped my device. So why was I seeing this message?

I looked at my device’s screen, and noticed the battery icon was not in charging status. So, I jiggled the lightning cable, which had worked just a few hours before, and couldn’t get the charging status to show. I switched out the cable for one I had recently purchased, and immediately got my device to charge. I was subsequently successful in connecting to my device with iPhone Tunnel. Prest-0, change-0. On to some testing.

I know this was a really long story for just a little bit of information. It could’ve gone – if you encounter [message], then switch out cable. But, I like to provide extra details around issues that end up having a simple solution, but feel a tad-bit complex in the moment. I recall Googling the “…reset by peer” message (originally – a year ago), and didn’t see any solutions talking about lightning cables. So, here we are, and there it is. I hope this can help someone in the future.