I have set up my Raspberry PI though these instructions and was able to connect to it through SSH. I have installed RASPBIAN WHEEZY.

However, when I run sudo apt-get update it keeps closing the whole terminal. I am connecting to PI through Ubuntu Desktop machine. I am not sure why this is happening. Any ideas?

  • does it do the same when logged in directly (not via SSH)? – Steve Robillard Jan 10 '16 at 19:41
  • I haven't been able to test that as I have no USB keyboard right now :s I also see the same behaviour on some other commends like apt-get install on some circumstances. – tugberk Jan 10 '16 at 19:56
  • what else is connected to your Pi and how are you powering it? – Steve Robillard Jan 10 '16 at 20:11
  • nothing else, it's powered through the 5v MicroUSB input. Is there any logs that I can check for this? It's specifically happening on sudo apt-get update – tugberk Jan 10 '16 at 21:41
  • 1
    you could check the logs in /var/log especially the apt logs which are in /var/log/apt – Steve Robillard Jan 10 '16 at 21:44

If it is a timeout issue (although usually the timeout should be long enough at least for a dist-upgrade; how long does yours take?), then you can configure a keepalive in your SSH config file by adding

Host *
    ServerAliveInterval 60

to the file ~/.ssh/config. See also Keep SSH session alive and How does tcp-keepalive work in ssh?. The fact that it works from a different client suggests it is in fact a timeout issue.

Otherwise, it might be helpful to add -vvv to ssh and see the debug output:

ssh -vvv pi@

Have you configured a static IP for your raspberry? In that case, could it clash with the IP of your Ubuntu machine? (See the output of /sbin/ifconfig of both machines.)

| improve this answer | |

I don't have this issue with Putty connection to Raspbian from MS-Windows, however, you may have this issue on other platforms. Indeed on UBUNTU this was a common case.

On Putty, Change Setting, click on 'Connection' and modify the 'KeepAlive' options. Open the configuration panel and click on Connection and enable 'TCP_KEEPALIVE' sending 'Null packets' every 30 seconds

Now that you are there click on 'Window' -> 'Translation' and select Latin-1, works nice with Raspbian character graphics.

Go back to 'Session', click on a name and 'save' the configuration.

Putty Setup

| improve this answer | |

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.