The DNS Cluster Locked Us Out of Itself: Graceful Shutdown Rewrites Your Reset
Promoting a Technitium secondary hit 'Invalid username or password' with the correct credential. Deleting the auth file and restarting changed nothing, because the server re-saves its in-memory state on a graceful stop. Only a hard kill let it fall back to the default admin.

Key Architectural Takeaways
- A service that persists state on graceful shutdown will undo a file-delete reset; use a hard kill before deleting.
- Resetting the primary can invalidate the secondary's session token, a second failure mode to recover from.
- Rule out each cause with the real source and logs, and record the mystery you could not explain.
The challenge
We built a Technitium DNS cluster and proved failover. The next step was the actual promote-to-primary action on the secondary. It failed with "Invalid username or password" for a credential that had verified successfully minutes earlier. The failed attempt cost most of a session to understand and recover from.
Ruling things out
- A real password change. The on-disk auth file's modification time had not changed since the last confirmed good login, and the server's own log showed that login. No password change was ever logged.
- The per-IP login lockout. We read the actual
AuthManager.csfrom GitHub. Five failed attempts from one address trigger a five-minute block, but that produces a distinct message. Every failure we saw was the generic one.
The real root cause
Technitium's graceful shutdown handler re-persists its current in-memory auth state to the auth file as part of an orderly stop. So the obvious reset (delete the file, then systemctl restart) is defeated: the dying process writes the same broken state back before the new process starts. A controlled test confirmed it. After a delete-and-restart the fresh-looking file still rejected both the real credential and the plain default.
What worked was a hard kill (systemctl kill -s SIGKILL), which skips the save, followed by deleting the file. The next start fell through to Technitium's code-level default-admin creation.
A second failure while recovering
Resetting the primary's auth file also invalidated the secondary's cached session token for talking to the primary. Its log showed InvalidTokenHttpApiClientException: Invalid token or session expired on every heartbeat. A failed config-refresh attempt then appears to have left the secondary's own auth file in a half-deleted state, missing on disk. We recovered it the same way, and the cluster came back healthy.
What stays unexplained
We never found why the correct credential stopped authenticating in the first place. No legitimate event appears in either node's log between the last good login and the first failure. This is a very new clustering feature, and we recorded the mystery as unresolved instead of blaming operator error.
Verification
Both nodes were reachable and the cluster reported healthy at the end of the session.
Takeaway
Before you reset a daemon's state file, ask what the daemon does with that state when it stops. And write down what you could not explain, because the next person will meet it too.