Fixing a Home Server That Crashes After Reboot

Repairing a broken systemd unit for Docker Compose

The mystery of the reboot crash

I had a single‑board server running Debian 12 in my living‑room. Every time I rebooted it, the Docker Compose stack that powers my home‑lab services would fail to start, and the machine would hang in a boot loop. The logs were a jumble of “failed to start” messages, but the root cause turned out to be a mis‑configured systemd unit. Below is the exact process I followed to diagnose and fix the issue, with a few trade‑offs and security notes that apply to any Docker‑based deployment on a small server.

[Read More]

Clearing a Full /var/log on a Home Lab Server

Using journalctl vacuuming and a small Bash cleanup command

When /var/log fills up

I’ve run a handful of services on my homelab box—Docker containers, an Nginx reverse proxy, a Samba share, and a few cron jobs that ping my home router. It’s a quiet machine most of the time, but every so often the disk starts choking on logs. When /var/log hits the filesystem limit, new log entries stop, services can silently die, and journalctl starts spitting out “no space left on device”. The fix is usually a quick vacuum of the journal and a tidy‑up of the plain‑text logs. Below is a step‑by‑step recipe that works on Debian, Ubuntu, Arch, and other systemd‑based distros.

[Read More]

Stopping SSH from Spawning New Processes

Using ControlPersist to reuse connections

Why SSH keeps spawning new processes on every connect

Every time I run ssh host, the client forks a new process that talks to the remote sshd.
On the server side, sshd spawns a child for each accepted connection.
The model is simple and works fine for a handful of sessions, but it starts to feel like a drain when you:

  • run a script that opens dozens of SSH connections in a row,
  • use CI/CD pipelines that hit a remote host repeatedly, or
  • have a home‑lab with many small services that need quick SSH access.

Each fork eats a few kilobytes of RAM and a handful of file descriptors.
If you hit the per‑user process limit (ulimit -u) or the system’s max_user_processes, you’ll see “Too many users” or “Connection refused” errors.
Even on a modest machine, the cumulative CPU cost of negotiating the SSH handshake over and over can add up.

[Read More]

Repairing a Broken Initramfs on a Raspberry Pi

Recovering from emergency mode after a kernel update

A Raspberry Pi stuck in emergency mode after a kernel update?

I hit this one last week while upgrading to the 6.6‑raspi kernel. The Pi rebooted, the splash screen faded, and I was greeted with the dreaded “Emergency mode” prompt. I had no idea what was wrong until I dug into the initramfs. Below is a step‑by‑step guide I used to recover, plus a few lessons that apply to any Debian‑based system.

[Read More]

Stopping Laptop Overheating with ionice

Adding ionice -c3 to a nightly rsync backup

Nightly rsync and the heat problem

When I first set up a nightly cron job to copy my home directory to an external SSD, the laptop’s fan stayed at full blast all night. The CPU hit 90 °C, and the battery life dropped noticeably. I blamed the SSD’s sluggish write speed, but the real culprit turned out to be the I/O scheduler giving the backup process too much priority. Adding ionice -c3 (the idle class) to the rsync command brought the temperature back to sane levels without sacrificing backup reliability.

[Read More]

Running Nightly Backups After Logout

Using systemd user units instead of nohup

Running a nightly backup script after logout with systemd user units – no nohup needed

I set up a little home‑lab server last year and wanted a way to snap my home directory every night without tying the job to a terminal. The old nohup trick works, but it leaves orphaned processes and you end up chasing logs in the dark. Systemd user units give a cleaner, more reliable solution that plays nicely with the rest of the system.

[Read More]

Restoring SSH Access After a 777 Permission Mistake

Recovering a home server with a live USB

I hit a wall yesterday when I accidentally set /home/user to 777 and lost SSH access.
The server was a 2026‑era Debian‑based homebox running systemd‑managed services.
SSH refuses to log in if any file under the user’s home directory is writable by others, so the key‑based login failed immediately.
The only way to fix it was to boot from a live USB, mount the root filesystem, and restore the correct ownership and permissions.

[Read More]

Reducing PulseAudio CPU Usage on a Laptop

A small configuration change to stop audio from hogging the CPU

PulseAudio CPU Hogging

If your laptop’s fan has been doing the back‑and‑forth dance or the CPU clock keeps climbing while you’re just listening to a playlist or watching a video, you’ve probably run into PulseAudio’s infamous CPU bloat. The daemon is built for flexibility, not for squeezing every watt out of a laptop, and its out‑of‑the‑box settings can turn a modest machine into a little CPU hamster.

Why PulseAudio Can Be a CPU Hamster

The resampling engine runs in user space and gets hit for every stream that needs a sample‑rate or format change. By default it uses soxr, a high‑quality but heavy algorithm. Combine that with the default 48 kHz sample rate and 32‑bit float format, and you’re looking at a few percent of a core even when the system is otherwise idle. On older hardware or when the battery is low, that overhead shows up as a fan spin or a temperature spike.

[Read More]

Pulling the top 10 HTTP status codes from an Nginx access log with awk

Pull the top 10 HTTP status codes from an Nginx access log with awk

When you’re running a small site or a homelab server, the access log is the first place you look for clues about what’s happening. A quick glance at the most frequent status codes can tell you whether a recent change broke something, if a bot is hammering your API, or if a mis‑configured rewrite is returning 404s for legitimate pages.
Below is a practical, one‑liner‑heavy walk‑through that shows how to extract the top ten status codes from a standard Nginx log using only awk. It covers common pitfalls, performance tricks, and a few security‑related notes that fit naturally into a daily‑use workflow.

[Read More]

Restoring a Half‑Completed Borg Backup That Stopped at 50%

When a Borg backup stops halfway

You’re in the middle of a nightly backup of your homelab server, the progress bar hits 50 % and then the process dies. Maybe a sudden power loss, a network hiccup, or a disk error. The archive on the remote storage looks like a half‑filled container. You’re left with a repository that has a partially written archive. How do you recover the data you already captured, and how do you finish the backup without starting from scratch?

[Read More]