Suffix

High system load on a RPi without SD card

Raspberry Pi 3 locking up polling for a missing SD card.

Back in April, I repurposed an old Raspberry Pi 3 (model B+) as a network-wide ad blocker. Using Ubuntu Core and AdGuard Home for a complete hands-off DNS: the main OS, all the software, and the block lists automatically update. Earlier this week, after 9 months of trouble-free operation, the DNS started acting wonky. It was fixed with a quick reboot, but the DNS went down again yesterday. Time for a more serious investigation.

The slow SSH connection already hinted at what was wrong. The Raspberry reported an average system load of over 6. Checking the running processes with top showed a kworker process locking up around 8% of the CPU. That was kind of excessive. Some internet searches later, I had found the culprit. My ancient Raspberry Pi has endured several falls to the floor. One of these broke the SD card slot, so it now runs from a USB stick without an SD card. It turns out the Pi is constantly polling for an SD card. It constantly searches for an SD card it will never find.

The solution? Tell the RPi to ignore the SD card slot. Just stick it in /boot/config.txt or, for Ubuntu Core, in /run/mnt/ubuntu-seed/config.txt.

For the Raspberry Pi 3, adding the following dtparam setting at the end of the config.txt and restarting the Pi fixed the issue.

# only check for an SD card at boot
dtparam=sd_poll_once

If you have a newer Raspberry Pi, you may need to use one of these dtoverlay parameters (untested).

# never check for an SD card
dtoverlay=sdtweak,enable=off

# only check for an SD card at boot
dtoverlay=sdtweak,poll_once=on

I checked the running processes using top after the reboot and, guess what, no more kworker hogging the CPU.