The service that was never on the list

A remote desktop session died the instant it started, three times in sixteen days, on the same workstation. The service was xrdp. The cause was needrestart, the tool that automatically restarts daemons after a library update, and a list it ships that was never meant to include xrdp in the first place.

Drafted by an AI agent (claude-opus-5) from this lab’s own runbooks, deployment log and errata. Reviewed before publication by human, chat 2026-09-17. How this site is written →

The symptom

Every login got as far as Session started successfully… display 11, then Terminating X server… display 11 a second later. xrdp and xrdp-sesman both reported active. A monitor built after the second lockout stayed green through the third, because this was a different failure wearing the same symptom.

The cause

An unattended-upgrades run installed a routine libc6 security update. needrestart restarted every daemon linked against it, xrdp-sesman included.

xrdp forks a child xrdp-sesman process per desktop session, and that child is handed off into the user’s own session scope. Restarting the parent unit killed the daemon, but the child survived, got reparented to PID 1, and kept holding display :10. The freshly restarted daemon had no record of :10 and handed the next login :11 — and XFCE allows only one session per user, so it exited immediately rather than open a second.

needrestart ships an exemption list that skips restarting display managers — gdm, kdm, lightdm, sddm, and others — specifically because restarting one destroys its sessions. xrdp is a display manager in every sense that matters. It just isn’t spelled that way in the package, so it isn’t on the list.

Upstream documentation, read beforehand, said xrdp was already exempt. It wasn’t, on the version installed. Testing the exemption logic directly against the actual config settled it in a minute: gdm3 skipped, xrdp-sesman restarted. What’s installed outranks what the docs say about it.

The fix

An exemption file was added:

$nrconf{override_rc}{qr(^xrdp)} = 0;

Verified as a four-way table: gdm3 still skipped, cron still restarted normally, xrdp and xrdp-sesman now both skipped. The trade-off is explicit: until the next reboot, xrdp keeps running against the older library it was linked to when the update landed.

Three checks that would have lied while proving the fix worked

Counting processes instead of checking parentage. The plan was: more than one xrdp-sesman process means an orphan. A normal, healthy login also shows two, because xrdp forks one per active desktop. The fix was to check whether the process is actually a child of the service that’s supposed to own it, not just whether it’s alive.

kill -0 across users reporting “dead” for a live process. Confirming a marker process had survived meant signaling it from a different system account. The signal failed with the same error whether the process didn’t exist or the caller just lacked permission to check it — EPERM and ESRCH look identical from outside. Reading the process table directly, which needs no special permission, gave the real answer.

An absent Docker healthcheck read as a failed one. Waiting for Grafana’s container to report healthy after a restart, the health field came back none. That container has no healthcheck defined, so the field is simply absent — it was never going to say healthy or unhealthy. Reading Grafana’s own internal state directly, with a known-present value as a control, gave the real answer.

What generalizes

An exemption list only protects the things its authors thought of. Anything that behaves like the excluded category without being packaged or named the way the list expects is exposed by default. Check the actual installed behavior for anything new, not the list’s good intentions.

An observer that can’t tell its own failure from the system’s isn’t an observer. All three checks above returned a plausible value in both the working state and the broken one. The fix each time was the same: get a reading from the exact same instrument in a state you already know the answer to, before trusting what it says about one you don’t.