I have an RPi4 (4GB) that I use as a local development server running ubuntu 20.04. I connect to it using SSH and use git to download source code from my projects and run npm install to install the dependencies.

In projects with many dependencies, the ssh session would freeze in the middle of an install. After spending a few hours unsuccessfully fixing this, I decided to install the dependencies on another computer and transfer the node_modules as a zip using FTP. Unfortunately, I found that the ssh session would freeze in the middle of unzipping the file, and then it eventually ends the ssh session automatically without completing the task.

My first suspicion was that it had run out of RAM, so I ran top -i to check on the RAM and CPU usage. RAM usage never exceeded 200 MB, and CPU usage never exceeded 30%. Another suspect was that the RPi was overheating, so I ran sudo vcgencmd measure_temp every few seconds to check on the temperature, but that never exceeded 40C.

Does anyone have any idea what might be going on?

  • Doesn't sound like npm is doing anything.. Probably deadlocked.. Make sure there isn't another npm running... and you can always run 'strace npm' and look at the system calls its making.. Aug 19, 2021 at 9:11

1 Answer 1


If there is no input from the user during a command that's taking a long time to complete, it's possible for the SSH session to time out. Check the ClientAliveInterval parameter in sshd_config: you can either increase it, or make the client send a keep-alive packet before the interval expires.

  • Thanks! I just tried this but the session still froze. I don't think it's a timeout issue because another concurrent SSH session that I was using to monitor the system resources and temperature also froze around the same time.
    – Panpaper
    Aug 21, 2021 at 17:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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