Randomly can't SSH into my DietPi install but can ping

Since a few days ago, I randomly can’t SSH into my DietPi for some reason.

The day before this happened, everything was fine. Then the next day, while nothing was changed, I couldn’t SSH in. It doesn’t time out or error out, it literally just stays on a black screen with the rectangular cursor. I can’t even see the log in prompt. I have tried Putty but it’s the same problem.

When I ping the device, it responds, the pings are sometimes quite high 100ms+, sometimes normal 10ms. Never shows any packet loss.

The device, Raspberry Pi Zero W, is connected to my router, assigned a static IP by the router. On the router status page, it shows the device is connected and working.

The problem is completely gone if I unplug the Pi then plug it back in. But it would work for maybe 2 days before the same problem happens again.

How do I go about troubleshooting this problem?
Is it hardware-related?

Raspberry Pi Zero W

DietPi v9.14

Only thing I have on it:
Unbound
AdGuard Home
OpenSSH Client

All settings are default.

Thanks.

Without logs, error messages or a connected screen, it is quite difficult to find out what is happening. One option would be to activate permanent logs. This should make it possible to see what the last activities were before the system stopped working.

persistent system logs:

dietpi-software uninstall 103 # uninstalls DIetPi-RAMlog
mkdir /var/log/journal # triggers systemd-journald logs to disk
reboot # required to finalise the RAMlog uninstall

Then you can check system logs via:

journalctl

which will then show as well logs from previous boot sessions. To limit the size, you can additionally e.g. apply the following:

mkdir -p /etc/systemd/journald.conf.d
cat << '_EOF_' > /etc/systemd/journald.conf.d/99-custom.conf
[Journal]
SystemMaxFiles=2
MaxFileSec=7day
_EOF_

This will limit logs to 14 days split across two journal files, so that with rotation you will always have between 7 and 14 days of logs available.

Thank you, just did those.

After I uninstalled RAMlog and did the reboot.
It immediately went dead. Couldn’t log in.
So I had to power cycle the device.

Then after I logged in after the power cycle and checked the system logs.
First warning I see is

Jun 30 18:12:18 DietPi systemd-fsck[133]: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt.

the last couple lines before the power cycle say

Jun 30 18:12:51 DietPi dropbear[385]: [385] Jun 30 18:12:51 Failed loading /etc/dropbear/dropbear_rsa_host_key
Jun 30 18:12:51 DietPi dropbear[385]: [385] Jun 30 18:12:51 Failed loading /etc/dropbear/dropbear_dss_host_key

Then I did the 2nd part limiting the log size. Then rebooted again.

Then I checked the logs again

some permission warnings on AdGuard Home?

Jun 30 18:39:35 DietPi AdGuardHome[327]: 2025/06/30 18:39:35.221372 [info] permcheck: warning: found unexpected permissions type=directory path=/mnt/dietpi_userdata/adguardhome perm=0777 want=0700
Jun 30 18:39:35 DietPi AdGuardHome[327]: 2025/06/30 18:39:35.221873 [info] permcheck: warning: found unexpected permissions type=directory path=/mnt/dietpi_userdata/adguardhome/data perm=0755 want=0700
Jun 30 18:39:35 DietPi AdGuardHome[327]: 2025/06/30 18:39:35.222247 [info] permcheck: warning: found unexpected permissions type=directory path=/mnt/dietpi_userdata/adguardhome/data/filters perm=0755 want=0700
Jun 30 18:39:35 DietPi AdGuardHome[327]: 2025/06/30 18:39:35.222592 [info] permcheck: warning: found unexpected permissions type=file path=/mnt/dietpi_userdata/adguardhome/data/sessions.db perm=0644 want=0600
Jun 30 18:39:35 DietPi AdGuardHome[327]: 2025/06/30 18:39:35.223343 [info] permcheck: warning: found unexpected permissions type=file path=/mnt/dietpi_userdata/adguardhome/data/stats.db perm=0644 want=0600

And the same two errors from before show up repeatedly

Jun 30 18:45:30 DietPi dropbear[712]: [712] Jun 30 18:45:30 Failed loading /etc/dropbear/dropbear_rsa_host_key
Jun 30 18:45:30 DietPi dropbear[712]: [712] Jun 30 18:45:30 Failed loading /etc/dropbear/dropbear_dss_host_key

I checked the logs on another device with same setup and it doesn’t have any

Failed loading /etc/dropbear/dropbear_rsa_host_key

something wrong with Dropbear?

Since this last reboot, so far it’s working ok. Ping is under 1ms like normal.

This is certainly due to the unclean shutdown

Furthermore, the Dropbear and AGH messages are unrelated to the problem