SSH stopped working


14 posts
by notrodash » Fri Nov 02, 2012 1:27 pm
Hello,
I have had my PI for quite a while and SSH was working just fine. Now when I try to connect to it, it either says that there was a timeout or that the host is down. I have tried reinstalling sshd by doing

Code: Select all
sudo bash;
apt-get --purge remove ssh;
apt-get --purge autoremove;
apt-get install ssh;
update-rc.d ssh defaults;
reboot

But I still get this upon reconnecting:
Image
I set the IP to static in /etc/network/interfaces over wifi. I have a lighttpd server running on my Pi right now which can still be accessed (http://pi.notrodash.co.uk/)

Any help would be greatly appreciated
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by obcd » Fri Nov 02, 2012 5:39 pm
I just checked the link you posted and couldn't acces it.
Maybe your browser is having it in his cache?
You could check your Pi process list to see if the ssh server is running.
You can try to ping your pi to figure out if it's network is still up.
But I assume you know all that.
Posts: 890
Joined: Sun Jul 29, 2012 9:06 pm
by bgirardot » Fri Nov 02, 2012 6:45 pm
The website link worked for me just now.

You don't have anything blocking ports on the RPi itself by any chance do you?

As obcd said, does

ps aux | grep -i ssh

show sshd running?
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland
by notrodash » Fri Nov 02, 2012 6:54 pm
obcd wrote:I just checked the link you posted and couldn't acces it.
Maybe your browser is having it in his cache?
You could check your Pi process list to see if the ssh server is running.
You can try to ping your pi to figure out if it's network is still up.
But I assume you know all that.


It was working when I posted the thread :S
I'll reboot the PI quickly...

I tried pinging port 22,
If I did it correctly, this was the output:
Code: Select all
notrobook:~ niv$ ping 192.168.0.199:22
PING 192.168.0.199:22 (67.215.65.132): 56 data bytes
64 bytes from 67.215.65.132: icmp_seq=0 ttl=56 time=17.316 ms
64 bytes from 67.215.65.132: icmp_seq=1 ttl=56 time=17.811 ms
64 bytes from 67.215.65.132: icmp_seq=2 ttl=56 time=19.200 ms
64 bytes from 67.215.65.132: icmp_seq=3 ttl=56 time=17.180 ms
64 bytes from 67.215.65.132: icmp_seq=4 ttl=56 time=17.835 ms
64 bytes from 67.215.65.132: icmp_seq=5 ttl=56 time=16.894 ms
64 bytes from 67.215.65.132: icmp_seq=6 ttl=56 time=18.980 ms
64 bytes from 67.215.65.132: icmp_seq=7 ttl=56 time=17.555 ms
64 bytes from 67.215.65.132: icmp_seq=8 ttl=56 time=17.388 ms
64 bytes from 67.215.65.132: icmp_seq=9 ttl=56 time=17.563 ms
64 bytes from 67.215.65.132: icmp_seq=10 ttl=56 time=18.459 ms
64 bytes from 67.215.65.132: icmp_seq=11 ttl=56 time=17.211 ms
64 bytes from 67.215.65.132: icmp_seq=12 ttl=56 time=16.653 ms
64 bytes from 67.215.65.132: icmp_seq=13 ttl=56 time=16.820 ms
64 bytes from 67.215.65.132: icmp_seq=14 ttl=56 time=22.802 ms
64 bytes from 67.215.65.132: icmp_seq=15 ttl=56 time=19.124 ms
64 bytes from 67.215.65.132: icmp_seq=16 ttl=56 time=16.208 ms
64 bytes from 67.215.65.132: icmp_seq=17 ttl=56 time=16.636 ms
64 bytes from 67.215.65.132: icmp_seq=18 ttl=56 time=17.948 ms
64 bytes from 67.215.65.132: icmp_seq=19 ttl=56 time=18.630 ms
64 bytes from 67.215.65.132: icmp_seq=20 ttl=56 time=17.068 ms
64 bytes from 67.215.65.132: icmp_seq=21 ttl=56 time=17.473 ms
64 bytes from 67.215.65.132: icmp_seq=22 ttl=56 time=16.857 ms
64 bytes from 67.215.65.132: icmp_seq=23 ttl=56 time=16.544 ms
64 bytes from 67.215.65.132: icmp_seq=24 ttl=56 time=16.665 ms
64 bytes from 67.215.65.132: icmp_seq=25 ttl=56 time=17.659 ms
64 bytes from 67.215.65.132: icmp_seq=26 ttl=56 time=17.376 ms
64 bytes from 67.215.65.132: icmp_seq=27 ttl=56 time=17.348 ms
64 bytes from 67.215.65.132: icmp_seq=28 ttl=56 time=19.278 ms
64 bytes from 67.215.65.132: icmp_seq=29 ttl=56 time=16.056 ms
64 bytes from 67.215.65.132: icmp_seq=30 ttl=56 time=16.081 ms
64 bytes from 67.215.65.132: icmp_seq=31 ttl=56 time=16.942 ms
64 bytes from 67.215.65.132: icmp_seq=32 ttl=56 time=17.305 ms
64 bytes from 67.215.65.132: icmp_seq=33 ttl=56 time=17.027 ms
64 bytes from 67.215.65.132: icmp_seq=34 ttl=56 time=17.112 ms
64 bytes from 67.215.65.132: icmp_seq=35 ttl=56 time=17.024 ms
64 bytes from 67.215.65.132: icmp_seq=36 ttl=56 time=17.204 ms
64 bytes from 67.215.65.132: icmp_seq=37 ttl=56 time=17.077 ms
^C
--- 192.168.0.199:22 ping statistics ---
38 packets transmitted, 38 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 16.056/17.534/22.802/1.185 ms
notrobook:~ niv$


The sshd process is also running (at least I think so):
Code: Select all
ps aux | grep sshd;
root 2451 0.0 0.5 6200 1052 ? Ss 18:41 0:00 /usr/sbin/sshd
pi 3587 0.0 0.4 3532 804 tty1 S+ 18:52 0:00 grep --color=auto sshd
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by notrodash » Fri Nov 02, 2012 6:59 pm
bgirardot wrote:The website link worked for me just now.

You don't have anything blocking ports on the RPi itself by any chance do you?

As obcd said, does

ps aux | grep -i ssh

show sshd running?


Yes, the process is running. What do you mean with ports? Physical ports? I have the Micro USB lead plugged in, 1A, 5V. I also have an Edimax wifi dongle which was apparently supported out of the box. I also have an unpowered usb hub plugged in for emergency keyboard access. Works just fine. As for network ports, I don't think so. It is a pretty stock configuration, with Lighttpd, PHP5, phpMyAdmin and MySQL. I am also ssh'ing into it using it's LAN IP, since I did not forward port 22 in my router, only port 80.

[edit]
And I have the HDMI plugged into my monitor. My current public IP is: 92.21.254.142
Last edited by notrodash on Fri Nov 02, 2012 7:03 pm, edited 1 time in total.
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by bgirardot » Fri Nov 02, 2012 7:01 pm
No, I meant the ports like port 22, port 80 stuff.

sudo iptables -L

would list any of the built in firewall rules, very unlikely, but I thought I would ask.
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland
by notrodash » Fri Nov 02, 2012 7:08 pm
bgirardot wrote:No, I meant the ports like port 22, port 80 stuff.

sudo iptables -L

would list any of the built in firewall rules, very unlikely, but I thought I would ask.

The output of this command is:
Code: Select all
sudo iptables -L;
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination

Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by bgirardot » Fri Nov 02, 2012 7:14 pm
Ya, that means empty.

Anything else you might have done recently? Edit config files on windows? Used the SD Card somewhere else? Install other software recently? Anything with your local router? Changed ethernet ports etc. Anything you can think of?

The error sure looks like ssh just isn't running on that machine, but clearly it is, so it has gone deaf for some reason, or something else is blocking it.
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland
by notrodash » Fri Nov 02, 2012 7:19 pm
bgirardot wrote:Ya, that means empty.

Anything else you might have done recently? Edit config files on windows? Used the SD Card somewhere else? Install other software recently? Anything with your local router? Changed ethernet ports etc. Anything you can think of?

The error sure looks like ssh just isn't running on that machine, but clearly it is, so it has gone deaf for some reason, or something else is blocking it.

Yeah. I have not done anything to it since Monday. On Monday I actually set up everything, over SSH and it worked fine. Then I left it running until today. I only noticed, because I wanted to put a project into the /var/www/ folder to show to a friend.
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by bgirardot » Fri Nov 02, 2012 7:23 pm
All from the same computer that can not connect to it now?
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland
by notrodash » Fri Nov 02, 2012 7:48 pm
bgirardot wrote:All from the same computer that can not connect to it now?

All from the same computer.
The last resort would be flashing the Raspbian image again. Or I could try and restart my router.
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by bgirardot » Sat Nov 03, 2012 1:22 am
I am stumped then.

Definitely try restarting the router, that seems like a zero cost thing to try.

Hopefully one of the more experienced folks here can think of something if that does not/did not work.

You could try connecting again and see if anything shows up in a log file.
I usually:
cd /etc/log
try whatever i am testing, in your case connecting via ssh, then immediately do the ls command on the RPi
ls -latrh (bottom of the list files will be most recently modified)
tail somelogfile.log

to see if anything helpful shows up in the logs
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland
by notrodash » Sat Nov 03, 2012 9:34 am
:shock: A router reboot fixed the problem. I should really get a new router, it is a netgear DGN2000 :?
Thank you very much for your help, this community is one of the best communities that I have been in!
Posts: 7
Joined: Fri Nov 02, 2012 1:17 pm
Location: Hampshire, United Kingdom
by bgirardot » Sat Nov 03, 2012 7:28 pm
Glad to hear its working again. And glad to have you in the community.
Posts: 517
Joined: Wed Oct 10, 2012 6:20 am
Location: Switzerland