Summary: A Raspberry Pi 3B running an ADS-B receiver dropped off the network at night several times in one week, and even after a new power supply it still vanished, with the cause not yet found. The investigation found that Pi24's /var/log is on tmpfs (logs vanish on reboot), Wi-Fi power save is a suspect, and the watchdog's temperature protection setting is being ignored. I have since made the logs persist to the memory card and turned off Wi-Fi power save, so the next dropout will show its cause.
The data for my home radar (in Chinese) comes from a Raspberry Pi 3B at home: a USB TV stick receives the ADS-B signals from aircraft, it runs FR24's official Pi24 image, and it connects back to the home network over Wi-Fi. The website reads its status every 30 seconds.
This Pi dropped off several times within a week. This post is the investigation so far: the final cause is not found yet, but I have got to the point where "the next time it drops, I will definitely see why".
The equipment
| Item | What I use |
|---|---|
| Host | Raspberry Pi 3 Model B (4 cores at 1.2 GHz, 1 GB RAM, 2.4 GHz Wi-Fi only) |
| Receiver | USB 2.0 SDR + DAB + FM TV stick: RTL2832U + R820T2 (a DVB-T TV stick used as an SDR) |
| System | FR24's Pi24 image (Debian 12 bookworm), decoded by dump1090-mutability built into fr24feed, gain --gain 40 |
| Storage | 16 GB microSD |
| Network | Wi-Fi (no network cable) |
This stick was originally for watching digital TV. It has two chips: the RTL2832U digitizes the signal and hands the raw samples to the computer (which is why it works as an SDR), and the R820T2 is a tuner covering roughly 24 to 1766 MHz, which includes 1090 MHz, the frequency of aircraft ADS-B. Something that costs a few hundred Taiwan dollars can receive aircraft in the sky, which is where many people's self-built ADS-B receivers start.
Two details that matter for this post:
- After you plug it in, Linux first treats it as a TV stick and loads the
dvb_usb_rtl28xxudriver. Once that driver holds it,dump1090cannot open it. Pi24 unloads that driver at boot, so thermmod: ERROR: Module dvb_usb_rtl28xxu is not currently loadedin the log is a good sign: it means it was not loaded in the first place. - In
lsusbit appears asRTL2838UHIDIR. Whether this line is there is the fastest way to tell "is the stick still alive", and the underpowered section below relies on it.
The first time: it really was the power
On 11/23 in the early morning the whole machine disappeared for 11 hours: no ping, not in the ARP table, and a scan of the whole subnet did not find it (so it had not changed IP). Pulling the power and restarting fixed it, for unknown reasons.
That evening it dropped twice more. This time I happened to get in over SSH, and the first thing I looked at was:
The value is a set of bit flags: the low 4 bits are "now", and bits 16 to 19 are "has happened since boot":
| Bit | Meaning |
|---|---|
| 0 / 16 | Undervoltage |
| 1 / 17 | ARM frequency capped |
| 2 / 18 | Currently throttled |
| 3 / 19 | Soft temperature limit |
0x50005 means "right now undervoltage and throttled, and it has been like that since boot". dmesg had several Undervoltage detected lines within 3 minutes of boot, and lsusb could not even see the TV stick: with too little power, the USB device simply drops off.
The conclusion was clear: replace the power supply.
After the new supply, make the site able to see it
After the change, get_throttled went back to 0x0 and the problem was solved... and at the same time I decided never again to rely on "noticing that the radar page has no aircraft" to know it has failed.
Every 5 minutes, the site's server logs into the Pi over SSH (a dedicated key, only running commands that read status) to run a small shell script, and writes the result as JSON: temperature, CPU, memory, get_throttled, whether the memory card has gone read-only, filesystem state, I/O error count, Wi-Fi signal. The admin has a new tab drawing 24-hour curves, and the watchdog on the desktop reads that JSON and sends email when there is a problem:
- Sends at 75°C and above, and counts as recovered only below 70°C (otherwise flickering around 75 would send mail over and over)
- Undervoltage now, or undervoltage at any time since boot
- Memory card read-only, I/O errors, filesystem not clean
- Space at 90% or more, available memory under 80 MB
- SSH unreadable for an hour, but sent only when the radar itself is still reachable; when the whole machine is gone, the "radar offline" mail already exists, so one event does not get two emails
This shell script is fed from Windows to the remote bash -s over stdin, not stuffed into a command-line argument. Windows quoting rules plus SSH parsing once more will almost certainly eat any command containing $, ' or |.
The second time: everything normal, then gone
At 03:47 the morning after the new supply, it vanished again.
This time I had monitoring data, so I could look at the state before the dropout:
get_throttledwas0x0: not one undervoltage since boot this time- Temperature 69°C, staying within 69 to 72°C all night, with no spike
- 750 MB of memory left, memory card clean, 0 errors
There was no sign that anything was about to go wrong. The last record was fine, and the next one the whole machine was gone.
And the 11/23 incident was also around 4 a.m.
Wanting to see what happened before the dropout, I found logs were never saved
After the reboot, the first thing I wanted was the log of the last few minutes of "the previous boot", and:
Pi24's journald.conf says Storage=volatile, so logs live only in memory. That is deliberate: it reduces writes to the memory card and extends its life. The cost is that every time something goes wrong and I pull the power to restart, the evidence goes with it.
Changing it to Storage=persistent is not enough either, because looking further:
The whole /var/log is a 50 MB tmpfs mounted by fstab. journald's persistent path is fixed at /var/log/journal, and built on tmpfs it is still memory.
The approach is to make a folder on the memory card and bind it to /var/log/journal with a systemd mount unit:
Then turn on persistence with a drop-in (the original journald.conf is untouched, and deleting the drop-in restores it):
Two details:
SyncIntervalSecdefaults to 5 minutes. If the power is pulled, the last 5 minutes of log are still in memory, which means the stretch I most want to see is exactly the one missing. Changing it to 1 minute writes a bit more, but very little.- I first wrote
Requires=var-log.mountin the mount unit, andsystemd-analyze verifyrun on its own says it cannot find that unit (it is generated from fstab). In fact it is not needed: systemd automatically orders a child path's mount after its parent's, and dropping it removes one more thing that can go wrong.
Also, after writing any setting on a Raspberry Pi, run sync. Earlier, after registering an SSH key, the whole machine lost power and authorized_keys became 0 bytes: the file had not really been written to the memory card when the power went.
A suspect: Wi-Fi power save
The log cannot show what happened before, but the boot messages have a line:
The built-in Broadcom Wi-Fi of the Pi 3B with power save on has a long-circulated old problem: after a disconnect it does not reconnect, and the machine itself is alive but cannot be seen on the network. That matches "all data normal, then suddenly the whole machine gone".
Pi24 uses NetworkManager, and the connection's 802-11-wireless.powersave is 0 (default), meaning left to the driver, whose default is on. To turn it off:
2 is off (3 is on, 0 is default, 1 leaves it alone). Also change the existing connection:
To make it take effect right away, I first tried the non-disconnecting nmcli device reapply wlan0, and got:
This field cannot be applied live; the only way is nmcli connection up to reconnect. Doing that from inside SSH kicks you off, so it has to be wrapped as a background job:
A few seconds after the disconnect it reconnected, and dmesg showed power save disabled, so it worked.
I almost broke the watchdog
During the investigation I saw systemctl show -p RuntimeWatchdogUSec was 0 and assumed the hardware watchdog was off: the system would not reboot by itself when frozen, which explained why every time someone had to go home and pull the power.
So I added RuntimeWatchdogSec=14s and applied it with daemon-reexec. Checking the log afterward showed:
Pi24 already has a watchdog.service (a standalone watchdog daemon) that had long been holding /dev/watchdog. The 0 on the systemd side only means "systemd itself is not feeding the dog", not that there is no watchdog. With both sides wanting the same device, which one grabs it first at the next boot is not certain, and the loser stops working. My "improvement" would have turned a working protection into a coin flip. I have already removed it.
This error did give me a lead: the watchdog was there all along, but neither dropout made it reboot the Pi. If the kernel had frozen, it would have rebooted itself within 60 seconds. It did not, which suggests the system may be alive but off the network, or the power was suddenly cut. The first of these is exactly what turning off Wi-Fi power save is meant to address.
A temperature protection I thought was on, but was being skipped
Looking at the watchdog daemon's configuration, /etc/watchdog.conf says to reboot at 80°C:
But there is a line in the boot log:
The newer watchdog no longer recognizes the temperature-device form, and the whole line is ignored. The config file says there is protection, and in reality there is none, and you never find out without reading the log.
And this machine's temperature does need protection: after turning power save off I observed for more than 7 hours, and the network never dropped once, but the temperature climbed from 70°C in the morning to 74.7°C at noon, with CPU use steady at 28%. It is not that the workload grew; the cooling is not enough. The next step is adding a heatsink.
What I learned
- First make it leave a note. "Pulling the power and restarting fixed it" is the worst outcome: it is fixed, and next time it will be the same. Before guessing at causes, make sure the logs are still there the next time it fails. To protect the memory card, Pi24 keeps logs in memory, which is a reasonable trade-off for an ordinary user and destroys evidence for someone who needs to debug.
- Monitoring has to look at "before the dropout", not just "it dropped". For the incident after the new supply, with only a "radar offline" mail I would probably have kept suspecting the power. With the
0x0and 69°C from the 5 minutes before, I could rule the power out. - When a value is 0, first ask whose 0 it is.
RuntimeWatchdogUSec=0means systemd is not using the watchdog, not that there is no watchdog. Looking at what has/dev/watchdog*open before acting would have kept me from almost breaking it. - What the config file says is not what is in effect. Temperature protection and Wi-Fi power save are both like this: one is written but ignored, the other is not written and the driver default is on. Judge by runtime logs (
dmesg,journalctl), not the config file.
Current state: power OK, Wi-Fi power save off, logs saved to the memory card. If it drops again, one line after the reboot, journalctl -b -1 -n 200, will show what it was doing at the end. I will add a follow-up then.