« ssh: connect to host pi port 22: No route to host » on raspberry pi

I’m sharing this solution because I’ve scratched my head so much, I guess I can’t be the only one, especially now that the Raspebrry pi has reached the 3,000,000 landmark!

My raspberry pi connected to my home WiFi using a USB dongle purchased Adafruit. Since it’s been set up, I struggle to connect to it :

jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host
jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host
jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host
jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host
jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host
jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host
jc@laptop ~ $ ssh jc@pi
ssh: connect to host pi port 22: No route to host

…but randomly it worked…

jc@laptop ~ $ ssh jc@pi
jc@pi's password:

I’ve tried various things from forums, but what actually solved the issue was to change the USB-microUSB cable I use to power the pi. It was not the power adapter itself, just the cable.

microUSB-800x800

7 Responses

  1. Simon
    Simon · at · · Reply

    I have the same problem on 2 raspberry Pi, both connected via WiFi. But also with another cables or adapters, the problem is still there, nothing changes.

  2. harold
    harold · at · · Reply

    Wow – this worked for me. I had the USB dongle connected through my monitor’s USB port. Connected directly to the pi, it works.

    Thanks!

  3. Wen Jiun
    Wen Jiun · at · · Reply

    Thanks for the guide, I have the exact same problem. I have tried to solve whole day by changing /etc/network/interfaces but finally saw your post. Change to a shorter USB cable and it is solved.

  4. Kees
    Kees · at · · Reply

    I purchased a raspberry pi last week and had this error often. Turned out the solution was the same as you had found: replacing the charger. First I had a cheap one I bought on a Chinese website, and now I use my phone charger, it makes a big difference.

Leave a Reply to jc Click here to cancel reply.