berth

Server management

Rescue mode

What to do when the panel itself does not work: a static recovery page, a watchdog that heals what it safely can, a console menu that needs no database, a separate rescue web service over the VPN, and a printable emergency card.

Updated 6 min readrescue · recovery · emergency · watchdog · console · outageView as Markdown

On this page
  1. Layer 1: the recovery page
  2. Layer 2: self-healing by the watchdog
  3. Layer 3: berth rescue on the console
  4. Layer 4: the rescue web service over the VPN
  5. The emergency card
  6. A short runbook
  7. Related

Every other article assumes the panel is there to click in. This one is about the day it is not: the panel daemon does not start after an update, the disk is full and MariaDB has stopped, or you are locked out by your own firewall rule. Berth prepares for that in four layers, from fully automatic to fully manual, and none of them depends on the thing that is broken. System → Rescue mode shows what is ready and what the watchdog has done.

Layer 1: the recovery page

When the panel does not answer, nginx does not show a bare 502. It shows a static page with the state the watchdog writes every round, which needs neither the panel nor its database.

  • An ordinary visitor only sees that the panel is temporarily unavailable and when the monitoring last checked.
  • Someone who comes in through the VPN (Tailscale, WireGuard, or the server itself) sees the details: which services are down, what the watchdog did about it, the last update, and where to reach the rescue web service.

The page refreshes itself, and as soon as the panel is back you are on the panel again. The diagnosis warns if the page is no longer being updated.

Layer 2: self-healing by the watchdog

The watchdog runs on a timer, independently of the panel and without the database. Besides restarting crashed services (see notifications and alerts), it handles these situations by itself, each with a strict limit so it cannot end up in a loop:

  • A failed panel update. If the panel stops answering shortly after a successful update while the database and the agent still work, the watchdog puts the previous version of Berth back. The version that caused the problem is not installed automatically again.
  • A panel that hangs. If the panel has not answered for a few minutes and there was no recent update, the watchdog restarts it, a few times per hour at most; after that it only notifies you. A panel that keeps crashing is reported as a crash loop.
  • A full disk with the database down. It runs the safe clean-up actions (old journal files, the package cache, rotated logs, crash dumps, expired sessions, unused container images), restarts MariaDB and starts the services that stopped because of the full disk. It does not do this when your clean-up policy is set to off; see disks and snapshots.
  • No panel database. When MariaDB is down, the watchdog still starts the web servers, PHP-FPM, mail and the DNS resolver if they stopped, after a configuration test and with a cap per service, because they run on their rendered files and do not need the database.

Every intervention is listed on the rescue page, in the watchdog's journal, and sent to your channels through the watchdog's emergency route, which delivers directly to the administrators' channels without the database or the local mail server.

Layer 3: berth rescue on the console

berth rescue is a menu that works without the database, without the agent and without the network. Use it on the console of your hypervisor or hosting provider, or over SSH through the VPN.

sudo berth rescue

It offers the state of the server, the diagnosis, restarting services, repairs, rolling back the Berth update, restoring the panel database from a dump, opening access for your address, resetting a login's password or second step, and the state of the network and VPN. Every action also works as a command, for scripts and for documentation:

sudo berth rescue status
sudo berth rescue doctor
sudo berth rescue restart --service=berthd --yes
sudo berth rescue repair --areas=services --yes
sudo berth rescue rollback --yes
sudo berth rescue db-snapshots
sudo berth rescue db-restore --snapshot=20261014-030000-systeem.sql --yes
sudo berth rescue open --ip=203.0.113.9 --login=admin --yes
sudo berth rescue mfa-reset --login=admin --yes
sudo berth rescue password-reset --login=admin --yes
sudo berth rescue network

Anything that changes something asks for --yes, or a confirmation in the menu.

  • open lifts a fail2ban ban for that address, lets it through the firewall and outside the panel's geo-blocking until the panel applies its own rules again, and with --login adds it to that login's allowed addresses. Add the address in the panel afterwards so it stays.
  • db-restore first dumps the current state and keeps the panel stopped while it restores. Berth dumps the panel database automatically before each schema migration, so there is usually a recent dump to go back to. A database that no longer starts because of corruption is not something rescue mode repairs; that remains manual work with InnoDB's recovery modes.
  • mfa-reset and password-reset need the database to be up.

Layer 4: the rescue web service over the VPN

For when you cannot reach the console but the VPN still works, berth-rescue is a small separate service, running as root, that offers the same actions in a browser. It listens only on the server's VPN addresses and on the server itself, never on the public interface.

It has its own recovery password and its own TOTP code, separate from your panel account. Set them as root on the server:

sudo berth rescue password

You see the TOTP secret and a QR code once: put the code in two authenticator apps and the password in your password vault. The credentials are owned by root and the panel can neither read nor change them, so a compromised panel cannot alter the emergency entrance. Without a recovery password nobody can sign in.

From the VPN, geo-blocking, allowed-address lists and fail2ban do not apply to this sign-in screen, so you can still get in when exactly those rules lock you out. Repeated wrong attempts are temporarily blocked per address, every sign-in and every action is sent to the administrators as a notice, and sessions are short and end after a period of inactivity.

The diagnosis warns when berth-rescue has no recovery password yet or listens on no VPN address.

The emergency card

System → Rescue mode → Emergency card is one A4 page to print (or save as PDF) and keep with your vault: the panel address, the VPN addresses with the SSH command, the address of the rescue web service, the console commands, and lines to fill in by hand saying where the secrets are kept: the recovery password, the TOTP, the recovery codes of your second step, and the emergency account. The secrets themselves are never on the card. Print it again after changing the VPN or the recovery password.

A short runbook

  1. Open the panel address. If you see the recovery page, connect to the VPN and reload it for the details: often the watchdog has already acted.
  2. Through the VPN, open the rescue web service shown on the recovery page and on your emergency card. Check the state, then restart, repair or roll back.
  3. No VPN? Use the console of your hypervisor or provider and run sudo berth rescue.
  4. Locked out by a ban or allow-list? sudo berth rescue open --ip=<your address> --login=<you> --yes.
  5. Afterwards, open System → Rescue mode and System → Diagnosis to see what happened, and fix the cause.

If the server itself is lost, rescue mode cannot help; that is what disaster recovery is for.