19

I have raspberry Pi model B whith raspbian OS which has been working well for 2-3 months and since last week I've noticed that every time when logging in ( over ssh ) when inputting username there is a delay ( well over 1 minute ) before system respond with password line.

Is this a sign of malfunctioning SD card or something else...? ( Also, I've noticed that doing certain commands, like arp,netstat etc is taking a longer time to compute..)

  • It most likely is an SD card problem. Try and find some class10 8GB Kingstons. They seem to work really well for me for long periods of time with moderate read write to them – Piotr Kula Apr 29 '14 at 8:36
  • Just to exclude DNS issues. Does the same thing happen when you log into SSH using IP address only, not the HOstname – Piotr Kula Apr 29 '14 at 9:06
  • logging in with hostname or ipadress is same..slow and it appears to be something more than this, I loaded basic version from february and problems persists... – zsn Apr 29 '14 at 10:25
  • it may also be useful if you could post your dmesg and /var/log/messages output. – kolin Apr 29 '14 at 10:45
  • to large for comments..but there is odd line that i didn notice before which explains a lot...FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck // dmesg... – zsn Apr 29 '14 at 12:30
26

It could be that your Pi is trying to do a reverse DNS lookup of the client's connecting hostname for security reasons, which is okay, but leads to the timeouts if you don't have a working reverse DNS.

when you do finally login, try adding

UseDNS no

to your /etc/ssh/sshd_config file, and see if that helps improve things, of course don't forget to reload and you are good to go!

service ssh reload

And you should have a near instant SSH

You can also try SSH-ing with the -v verbose option to provide output to the client that may help in diagnosing where the timeouts are occuring.

This behaviour isn't unique to the Raspberry Pi nor Raspbian also see SuperUser: Top causes of slow ssh logins where UseDNS no is the common solution.

  • Can you please explain how DNS will affect general usage of the Pi? DNS resolution doesn't take that long, after it has resolved for the first time. – Piotr Kula Apr 29 '14 at 8:33
  • 1
    @ppumkin I'd had this issue before on a standard linux box inside a network where reverse DNS lookups couldn't take place, took 30-odd seconds before i got a password prompt. Using the solution i've just provided fixed it for me, so i'm unsure as to why my answer has been downvoted? – kolin Apr 29 '14 at 8:52
  • It sounds like you had a very specific problem to reverse DNS or something. As the OP said, it worked fine for months, nothing changed on his network and all the apps, after logging in take allot longer too. I seriously doubt this will fix all those problems, that is why -1 . Also, I never had to do this, in any situation. DNS is very important and that should work properly. One way to proove its not DNS, is loggin in with IP instead. Then no DNS lookups are made – Piotr Kula Apr 29 '14 at 9:05
  • 1
    @ppumkin, The OP doesn't mention that nothing has changed? he is also having issues with other commands (arp and netstat) that would use DNS lookups unless he specified the arp -an and netstat -rn which would turn off lookups. both are a good test to resolve whether this is indeed a dns issue. – kolin Apr 29 '14 at 9:10
  • Well, editing ssh_config improved my login response time,but still I belive this is more of a sd card problem since arp(and similiar commands) takes about 2-3 minutes to return any values..I've kept backups and rewrote them to card when things were Ok and it ain't working properly..Now I will try to test sd card and reformat it on another machine and see what happends with clean install..tnx guys.. – zsn Apr 29 '14 at 10:11
1

My official WiFi dongle by Raspberry Pi themselves was getting a 64% packet loss from one computer to the Pi through my LAN. While every other WiFi dongle worked like a charm with < 1% packet loss.

Use:

ping address (Windows, Linux, Mac) or ping address -t (Windows, runs until Ctrl + C) on another machine on your local area network to see if it's a network issue, replacing address with the private IP address of your Pi.

To find your private IP address for your Pi, hover over the network icon in Raspbian or use the command hostname -I.

Windows DOS Pinging

  • Is -t a valid flag for ping? I am trying it on my Mac, but it isn't working. It displays a message: usage: ping [-AaDdfnoQqRrv] [-b boundif] [-c count] [-G sweepmaxsize] [-g sweepminsize] [-h sweepincrsize] [-i wait] [−k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] [-S src_addr] [-s packetsize] [-t timeout][-W waittime] [-z tos] host ping [-AaDdfLnoQqRrv] [-b boundif] [-c count] [-I iface] [-i wait] [−k trafficclass] [-l preload] [-M mask | time] [-m ttl] [-p pattern] – IgorGanapolsky Aug 22 '16 at 15:12
  • @IgorGanapolsky On Windows it makes it act like other shell's ping command, repeating packets over and over until you stop it. I'm assuming Mac's terminal already has this or it's a different flag. – evelynhathaway Aug 22 '16 at 15:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.