bridgectl
The command for inspecting and managing a Linux install, command by command, with the flags, root requirements and what each one touches.
bridgectl manages the Bridge agent on a Linux machine installed with
install.sh. It is the agent binary run under a second
name: /usr/local/bin/bridgectl is a symlink to
/usr/local/lib/bridge/bridge-agent, and the agent acts as the CLI when it
sees that name. bridge-agent <command> does the same thing. It is not called
bridge because iproute2 already ships /usr/sbin/bridge.
Because it is the same binary, it is always the same version as the agent it manages, and it updates when the agent does.
Source: crates/agent/src/cli.rs, join.rs, component.rs and host.rs.
Summary
bridgectl status [--json]
bridgectl join INVITE [--relay-override URL] [--no-auto-update]
bridgectl servers [--wait]
bridgectl leave NAME [--yes]
bridgectl folders [list]
bridgectl folders add PATH [--server NAME | --all]
bridgectl folders remove PATH
bridgectl logs [-f] [-n N]
bridgectl update
bridgectl channel [stable|canary]
bridgectl uninstall [--yes] [--keep-state] [--purge-server]
bridgectl version
bridgectl semantic [status]
bridgectl semantic enable [--force]
bridgectl semantic disable
bridgectl component [list]
bridgectl component install NAME [--force]
bridgectl component remove NAME
bridgectl server setup --owner NAME
bridgectl server invite NAME [--plain]
bridgectl server status
bridgectl metrics [summary|routes|slow|stalls|samples|profiles] [--hours N] [--limit N] [--json] [--db PATH]
bridgectl help
Everything except logs, version, help, metrics, semantic status and a bare channel needs root,
and says "run it with sudo" rather than failing on a permission error. The exit
code is 0 on success and 1 on any error, with the reason on stderr prefixed
bridgectl:.
Where it finds the install
It reads /var/lib/bridge/agent.env (or $BRIDGE_STATE_DIR/agent.env) for the
agent's socket, the library and bin directories, and the tailnet socket, so an
install made with custom paths is managed where it actually lives.
BRIDGE_LIB_DIR and BRIDGE_PREFIX in the environment override the file.
Installs from before these keys existed fall back to the installer's defaults.
Which Bridges the machine is joined to is recorded in
/var/lib/bridge/servers.json (mode 0600), written by join and leave. A
machine installed before that file existed has none; it is read back from
agent.env and the unit files the first time it is needed. Everything else
comes from three places: systemd, each tailnet daemon's CLI, and the agent's
local API on its Unix socket (mode 0600, owned by root, which is why most
commands need root).
status
sudo bridgectl status [--json]
One line each for the services (bridge-agent, and both tailnet units of every
Bridge the machine is on), each tailnet (state, name, address), every server
connection (state, machine id, and the reason when it was refused, such as a
bad enroll secret or a blocked device), shared folders, and the update timer
with its last result. It ends with the same list servers prints. Each part is
asked separately, so a stopped agent still reports the services and tailnet.
--json prints the combined object for scripts; tailnets has one entry per
Bridge, and tailnet is the first of them, as before.
bridge-agent 0.1.60
services bridge-tailscaled active · bridge-tailnet active · bridge-tailscaled-fedcba98 active · bridge-tailnet-fedcba98 active · bridge-agent active
tailnet Red One: Running as build-box (100.100.0.12)
tailnet Friends: Running as build-box (100.64.0.7)
server Red One: enrolled machine 3f2a19c0…
server Friends: enrolled machine 81d0c2aa…
folders 2 shared: /srv/app, /home/dan/code
updates stable channel, daily timer on, last run Mon 2026-10-05 03:00:01 UTC ok
Bridges on this machine:
● Red One connected 7c47ff94, port 2600
● Friends connected fedcba98, port 2601
join
sudo bridgectl join INVITE [--relay-override URL] [--no-auto-update]
sudo bridgectl join --invite-file PATH
Joins this machine to the Bridge the invite came from. install.sh runs it for
you after it has put the binaries in place; run it yourself to add a Bridge to
a machine that already has the agent. The invite can also come from
BRIDGE_INVITE in the environment, which keeps it off the command line.
- First Bridge. Sets up
bridge-tailscaledandbridge-tailneton ports 2600 (tunnel), 2620 (control shim) and 2640 (SOCKS5), the same layout every earlier install has. - Another Bridge. Gets its own pair of units,
bridge-tailscaled-<fp8>andbridge-tailnet-<fp8>(the first eight characters of its fingerprint), its own state in/var/lib/bridge/servers/<fp8>/, and the next free ports in each block (2601, 2621, 2641, and so on). The Bridges already on the machine keep running throughout. It also gets its own agent id, so it sees this machine as a separate device from any other team's. - A Bridge it is already on. Rewrites that Bridge's units for the current binaries and restarts them. It does not join again (an invite works once), and the other Bridges are not touched.
The order is the installer's: start that Bridge's tailnet units, wait until
bridge-tailnet has verified the control plane against the invite's
fingerprint, only then hand the preauth key to tailscale up through a 0600
file, find the server, and register. If any step fails, everything it created
for that Bridge is removed again, the node is logged out if it got that far,
and the machine is as it was.
When a Bridge is added, every folder that was shared with "every server" is first narrowed to the Bridges that were already there, so the new one starts with no folders. The agent is then restarted with the new server list.
It finishes with the same list as servers. --relay-override is for a
machine that hosts the Bridge it is joining (install.sh --server passes it).
servers
sudo bridgectl servers [--wait]
One line per Bridge: a green dot when the agent is connected and enrolled, a
red one with the state and the last error otherwise, then the fingerprint and
tunnel port. With --wait it waits up to 30 seconds for a freshly restarted
agent to connect before printing. Colour only on a terminal, and not when
NO_COLOR is set.
leave
sudo bridgectl leave NAME [--yes]
Removes one Bridge and keeps the rest. NAME is the name shown by servers,
its fingerprint, or the fingerprint's first four characters or more. It logs
that Bridge's node out, removes its two units and its state, takes it out of
the agent's server list and restarts the agent. Refused for the only Bridge on
the machine: use uninstall for that. Afterwards, remove the machine from
that Bridge's device list.
folders
sudo bridgectl folders [list]
sudo bridgectl folders add PATH [--server NAME | --all]
sudo bridgectl folders remove PATH
Lists, shares or stops sharing a folder, through the agent's own API, so the
agent's validation applies: the path must be absolute and a real directory,
and credential folders (~/.ssh, ~/.aws, ~/.gnupg, ~/.kube) are refused.
add canonicalises the path, so bridgectl folders add . works. Sharing only
makes a folder available; add it to a project from Bridge (Add a machine or
folder, then Use a folder). remove accepts a path that no longer exists
on disk, since that is often exactly the one to stop sharing.
On a machine joined to one Bridge, add shares with that Bridge. On a machine
joined to several, say which: --server NAME (a name or fingerprint from
bridgectl servers), or --all for every Bridge on the machine, including
ones joined later.
logs
bridgectl logs [-f] [-n N]
Runs journalctl for bridge-agent, every Bridge's bridge-tailnet and
bridge-tailscaled units, and bridge-agent-update, interleaved. With no arguments it shows the last 100
lines; any arguments are passed to journalctl as they are. Reading the
journal may itself need root, depending on the distribution.
report
sudo bridgectl report [--since T] [--until T] [--note TEXT] [--dry-run]
Sends this machine's Bridge logs and status to Bridge support, for a problem you can describe but nobody can see from outside — most often "Bridge said agent offline for a minute while the machine and its network were fine". It bundles:
- the journal of
bridge-agent, every Bridge'sbridge-tailnetandbridge-tailscaled, andbridge-agent-update, over the window; - restart counts and start times of those units (
systemctl show); bridgectl status --json;- the OS name, uptime, free disk space, and which Bridge ports are listening.
Keys, tokens, enroll secrets and the home directory are redacted before
anything leaves the machine. The window defaults to the last 24 hours; --since
and --until take journalctl times (-2h, "2026-11-18 07:20",
@1795419064). It prints a report id such as R-7KQ2M9 to quote when you tell
support what happened and when.
--dry-run writes the bundle to a file in /tmp and sends nothing, for a
machine that cannot reach the report service or a person who wants to read it
first. BRIDGE_REPORT_URL points it at a different service.
The same machine's logs can also be collected from the web: Report connection problem on a failed tool call, or in a machine's Connection history (Settings → Fleet), asks the agent for them directly once it is connected.
update
sudo bridgectl update
The same as the daily timer: fetch the release manifest, and if it names a newer version, verify and install it, then restart the agent, rolling back if it does not come back. Installed components come along. Exit code 0 means up to date or updated. See Components and updates.
channel
bridgectl channel
sudo bridgectl channel stable|canary
With no argument, prints which release line this machine's updates follow
(stable unless changed). With one, records it in
/var/lib/bridge/update-channel and restarts bridge-agent if it is running,
so Fleet shows the new value.
It does not update by itself:
- Switching to canary takes effect at the next daily check, or straight
away with
sudo bridgectl update. - Switching back to stable never downgrades. The machine keeps its canary build until stable is newer.
The same choice can be made from Fleet in Bridge. See Update channel.
uninstall
sudo bridgectl uninstall [--yes] [--keep-state] [--purge-server]
Lists what it will remove and asks for confirmation unless --yes. Then:
tailscale logouton every Bridge's tailnet, so each control plane drops the node instead of keeping a ghost.systemctl disable --nowevery Bridge unit, including each additional Bridge's pair and the four hosting units if the machine hosts a Bridge.- Removes the unit files,
/usr/local/lib/bridge, both links, and/var/lib/bridge.
| flag | effect |
|---|---|
--yes, -y | Do not ask. |
--keep-state | Keep /var/lib/bridge entirely (tailnet identity, folder list, search index). |
--purge-server | On a machine that hosts a Bridge, also delete /var/lib/bridge/server and /var/lib/bridge/host: the team's data and the control plane. Without it, those two are kept. |
Shared folders themselves are never touched. Afterwards, remove the machine from Bridge's device list.
version
bridgectl version
Prints bridge-agent <version>. Also --version or -V.
semantic
bridgectl semantic [status]
sudo bridgectl semantic enable [--force]
sudo bridgectl semantic disable
| command | effect |
|---|---|
status | on, disabled, not_installed or low_power, and the device when it is low-power. |
enable | Installs the semantic component (the agent built with the embedding engine), verified against the release signature, and switches it on. Refused on a low-power machine. |
enable --force | The same, on a low-power machine too. |
disable | Sets AGENT_RAG_ENABLED=0 and restarts the agent. Keyword search keeps working. |
See Semantic search for what counts as low-power.
component
sudo bridgectl component [list]
sudo bridgectl component install NAME [--force]
sudo bridgectl component remove NAME
The optional pieces of a Linux install:
| name | what it installs |
|---|---|
semantic | bridge-agent built with the embedding engine, swapped in for the slim one. --force overrides the low-power refusal. |
server | bridge-server, its web client, headscale and tailnet-sidecar, into /usr/local/lib/bridge/server. |
A component always matches the running agent's version. It is downloaded from
that version's release manifest and verified by size, SHA-256 and Ed25519
signature before anything is written; a mismatch writes nothing. What is
installed is recorded in /var/lib/bridge/components.json, and self-update
keeps it current. See Components and updates.
server
sudo bridgectl server setup --owner NAME
sudo bridgectl server invite NAME [--plain]
sudo bridgectl server status
Host a Bridge on this machine. install.sh --server runs these for you; see
Self-hosting for what they set up.
| command | effect |
|---|---|
setup --owner NAME | Needs the server component. Writes the control plane's configuration, then starts and enables bridge-headscale, bridge-sidecar, bridge-server-tailscaled and bridge-server. Checks the control plane's fingerprint and joins this machine to its own tailnet as bridge. Safe to re-run: every step checks whether it already happened. --owner defaults to $SUDO_USER. |
invite NAME | Mints a single-use, 24-hour invite key for NAME and prints it in a box, green on a terminal and plain when piped or when NO_COLOR is set. --plain prints only the key. |
status | JSON: the four services, the server's /api/health, and the control plane's fingerprint. |
Names are lowercase letters, digits and dashes, because each becomes a
Headscale user and a tag:user-<name> ACL tag.
For testing beside an existing Bridge, setup, invite and status also take
--root DIR (state somewhere else), --port-offset N (every port shifted by
N) and --no-systemd (plain child processes instead of units; stop them with
server stop --no-systemd).
metrics
bridgectl metrics [summary|routes|slow|stalls|samples|profiles] [--hours N] [--limit N] [--json] [--db PATH]
The hosted server's recorded performance, read directly from its database on
this machine. The server's own /api/metrics/* cannot be used here: it needs a
tailnet identity and rejects loopback connections by design. This reads the
same tables read-only and never contacts the running server. It needs read
access to the database, which on a root-owned install means sudo.
| view | what it shows |
|---|---|
summary | the default: stalls, routes, slow and profiles together |
routes | slowest HTTP routes: count, p50, p95, max, total time, SQLite time, statements and bytes per request, 5xx count. Five-minute buckets kept 7 days; p95 is the worst bucket's |
slow | individual SQLite statements of 50 ms or more, with when, how long and who ran them (chat:<id>, http GET /route, job:<name>). Kept 14 days. --worst sorts by duration |
stalls | minutes where the event loop stalled 250 ms or more, or SQLite used 10 s, with the top owner and the CPU profile kept for it |
samples | the per-minute rollups: lag, CPU, RSS, SQLite time, running turns |
profiles | CPU profiles on disk, newest first |
--hours sets the window (default 24), --limit the rows per view (default
25), and --json prints one JSON object instead of tables. The database
defaults to /var/lib/bridge/server/data/bridge.sqlite; --db reads another.
It runs an embedded script with the installed bridge-server binary acting as a
plain Bun runtime (BUN_BE_BUN=1), so nothing else needs installing. On a
machine without the server component it uses bun from PATH. From a source
checkout the same reader is bun packages/server/scripts/metrics-dump.mjs.
CPU profiles are written to profiles/ beside the database
(/var/lib/bridge/server/data/profiles/ on an install) as
bridge-<time>.cpuprofile. Open one in Chrome DevTools (Performance, Load
profile) or at speedscope.app. The server keeps one automatically for each
event-loop stall of 250 ms or more, at most one every two minutes, and keeps at
most 40 files or 50 MB. Set METRICS_FLIGHT_RECORDER=0 in the server's
environment to turn automatic profiles off.
help
bridgectl help
Prints the summary. Also --help or -h.