2

Lately I haven't been able to connect to my Pi without rebooting it every day. After a reboot, I am able to connect to it for a few hours and then it starts giving the "Network error: Connection timed out" message over Putty. I also tried using WinSCP and that gives me a "Host unreachable" error. What should I do?

4
  • 1
    which model pi? is the connection wired or wireless? is it running the latest raspberry pi OS? Have you messed around with any settings that could be the cause of this? How are you "addressing" the pi, ip address? hostname? zeroconf? Apr 9, 2021 at 9:24
  • 1
    It's a 3B+, it's connected via the wifi, it's not the latest Raspbian and I'm connecting via the local ip address.
    – emredesu
    Apr 9, 2021 at 9:59
  • This is almost certainly a problem with your client and/or network. All of my Pi run for months without reboot.
    – Milliways
    Apr 9, 2021 at 22:18
  • I had a similar problem. Try switching off WiFi power saving mode raspberrypi-spy.co.uk/2015/06/…
    – Mark
    Apr 12, 2021 at 19:56

2 Answers 2

0

There are several things to check:

  1. is the Pi completely frozen? Attach HDMI-Monitor and USB-Keyboard to check
  2. if it's still alive check the logs for errors
  3. maybe the SD card is bad?

Edit: Attach Monitor and Keyboard and check if sshd is still running

ps aux | grep sshd

check logs

sudo journalctl _COMM=sshd

restart sshd

sudo service ssh restart
1
  • The Pi still works and keeps its processes running properly inclusing those that access to the Internet, I just cannot connect to it.
    – emredesu
    Apr 9, 2021 at 7:53
0

It's not a problem I have seen with a pi but have seen it on a server running SuSE Linux. The SSHD daemon was aborting and not restarting. I fixed it by editing the service definition file

nano /etc/systemd/system/sshd.service

I commented out a line preventing it from restarting after failure and and added a line forcing it to restart.

[Unit] Description=OpenSSH Daemon After=network.target

[Service] Type=notify EnvironmentFile=-/etc/sysconfig/ssh ExecStartPre=/usr/sbin/sshd-gen-keys-start ExecStartPre=/usr/sbin/sshd -t $SSHD_OPTS ExecStart=/usr/sbin/sshd -D $SSHD_OPTS ExecReload=/bin/kill -HUP $MAINPID KillMode=process Restart=restart-always RestartSec=5 #RestartPreventExitStatus=255 TasksMax=infinity

[Install] WantedBy=multi-user.target


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.