Grok Bot computer update survival (Tailscale)
Why
The Grok Bot computer can be moved to a fresh instance (a Computer Update) at any time, including without the operator doing it. When that happens:
| Wiped |
Survives |
| Installed software (apt, npm, pip, CLIs) |
Everything under /home/box |
| Running processes and daemons |
Injected secrets (environment variables) |
/var/lib, /etc, /tmp, /var/run |
Server-side routines and skills |
Tailscale's default state lives in /var/lib/tailscale. That means a stock install loses its node identity on every update and needs a new login, a new approval, and a new Tailnet Lock signature. It also usually gets a new IP.
Rule: never leave state, keys, configs, or scripts outside /home/box. Anything installed needs a restore script under /home/box, plus an automatic check that runs the script.
One-time setup
- Pick a persistent folder, for example
/home/box/agent-data/infra/, containing scripts/ and tailscale-state/.
- In the Tailscale admin console, mint a reusable, tagged auth key (for example
tag:bot-controller).
- Tagged nodes have no key expiry.
- If Tailnet Lock is on, pre-sign the key, or sign the node once from a signing node. Never put Lock signing keys on the Grok Bot computer.
- Store the key as an injected secret named
TAILSCALE_AUTHKEY_SIGNED, through the secure secret request. Never paste it into chat.
- Start
tailscaled with its state in the persistent folder:
sudo tailscaled --state=$DIR/tailscale-state/tailscaled.state --statedir=$DIR/tailscale-state --socket=/var/run/tailscale/tailscaled.sock &
- Add
--tun=userspace-networking if /dev/net/tun is missing.
- Then run
tailscale up --auth-key=$TAILSCALE_AUTHKEY_SIGNED --advertise-tags=tag:bot-controller --hostname=<name>.
- If the node was already up with state elsewhere, stop it, copy that state into the folder, and restart with the flags above so it keeps the same IP.
- Save
scripts/restore-tailscale.sh, which must be idempotent and never echo secrets:
- Install Tailscale if it's missing (
curl -fsSL https://tailscale.com/install.sh | sudo bash).
- Start
tailscaled with the persistent state if it isn't running.
- Fast path: if BackendState is
Running and the node isn't locked out, exit 0. The identity is kept.
- Otherwise, check that
TAILSCALE_AUTHKEY_SIGNED is present and starts with tskey-auth-. If not, exit 10 (NEED_SECRET). If it's valid, run tailscale up with it.
- If
tailscale status says locked out, exit 20 (NEED_LOCK_SIGNATURE).
- Save
scripts/detect-fresh-box.sh. It exits 0 when a restore is needed: the binary is missing, tailscaled isn't running, or the backend isn't Running or is locked out.
- Create an hourly, every-day routine. It runs detect. If a restore is needed, it runs restore and re-verifies. It stays silent when healthy. It tells the operator RESTORED (with the IP) or BLOCKED (
NEED_SECRET means a secure secret request, NEED_LOCK_SIGNATURE means ask a signing node). Don't use weekday-only schedules, because updates happen on weekends too.
Prove it (drill)
Run this once after setup, and again after changes, at a quiet time:
- Record
tailscale ip -4.
sudo pkill -x tailscaled && sudo apt-get remove -y tailscale. This simulates an update.
- Run detect (expect exit 0), then restore (expect exit 0).
- Pass means the IP matches the one from step 1,
tailscale lock status shows the node signed, and a known tailnet host answers.
- Keep a fallback in the drill (reinstall and start the daemon by hand) so a failed drill never leaves the bot offline.
Recovery guidance for users
- Recover a wedged computer with Update Grok Bot's Computer. It keeps files and logins.
- Avoid Reset unless there's no other option. It restores an older snapshot and can lose recent state.
Checklist before calling any setup on the Grok Bot computer done
- Is every file it needs under
/home/box?
- Does something automatic reinstall or restart it after an update?
- Has the drill passed?
- If any answer is no, say so plainly instead of calling it done.
1---2name: grok-bot-computer-update-survival-tailscale3description: "Use this when setting up Tailscale (or any installed tool, daemon, or key) on the Grok Bot computer, when the computer may have been updated or reset, or when the bot can't reach tailnet hosts. It makes the setup survive a Computer Update and restore itself with no human step."4metadata:5 source: https://skillmd.com/skills/shixuuu/grok-bot-computer-update-survival-tailscale6---78# Grok Bot computer update survival (Tailscale)910## Why11The Grok Bot computer can be moved to a fresh instance (a Computer Update) at any time, including without the operator doing it. When that happens:1213| Wiped | Survives |14|---|---|15| Installed software (apt, npm, pip, CLIs) | Everything under `/home/box` |16| Running processes and daemons | Injected secrets (environment variables) |17| `/var/lib`, `/etc`, `/tmp`, `/var/run` | Server-side routines and skills |1819Tailscale's default state lives in `/var/lib/tailscale`. That means a stock install loses its node identity on every update and needs a new login, a new approval, and a new Tailnet Lock signature. It also usually gets a new IP.2021**Rule:** never leave state, keys, configs, or scripts outside `/home/box`. Anything installed needs a restore script under `/home/box`, plus an automatic check that runs the script.2223## One-time setup241. Pick a persistent folder, for example `/home/box/agent-data/infra/`, containing `scripts/` and `tailscale-state/`.252. In the Tailscale admin console, mint a **reusable, tagged** auth key (for example `tag:bot-controller`).26 - Tagged nodes have no key expiry.27 - If Tailnet Lock is on, pre-sign the key, or sign the node once from a signing node. Never put Lock signing keys on the Grok Bot computer.283. Store the key as an injected secret named `TAILSCALE_AUTHKEY_SIGNED`, through the secure secret request. Never paste it into chat.294. Start `tailscaled` with its state in the persistent folder:30 `sudo tailscaled --state=$DIR/tailscale-state/tailscaled.state --statedir=$DIR/tailscale-state --socket=/var/run/tailscale/tailscaled.sock &`31 - Add `--tun=userspace-networking` if `/dev/net/tun` is missing.32 - Then run `tailscale up --auth-key=$TAILSCALE_AUTHKEY_SIGNED --advertise-tags=tag:bot-controller --hostname=<name>`.33 - If the node was already up with state elsewhere, stop it, copy that state into the folder, and restart with the flags above so it keeps the same IP.345. Save `scripts/restore-tailscale.sh`, which must be idempotent and never echo secrets:35 - Install Tailscale if it's missing (`curl -fsSL https://tailscale.com/install.sh | sudo bash`).36 - Start `tailscaled` with the persistent state if it isn't running.37 - Fast path: if BackendState is `Running` and the node isn't locked out, exit 0. The identity is kept.38 - Otherwise, check that `TAILSCALE_AUTHKEY_SIGNED` is present and starts with `tskey-auth-`. If not, exit 10 (`NEED_SECRET`). If it's valid, run `tailscale up` with it.39 - If `tailscale status` says locked out, exit 20 (`NEED_LOCK_SIGNATURE`).406. Save `scripts/detect-fresh-box.sh`. It exits 0 when a restore is needed: the binary is missing, `tailscaled` isn't running, or the backend isn't Running or is locked out.417. Create an **hourly, every-day** routine. It runs detect. If a restore is needed, it runs restore and re-verifies. It stays silent when healthy. It tells the operator RESTORED (with the IP) or BLOCKED (`NEED_SECRET` means a secure secret request, `NEED_LOCK_SIGNATURE` means ask a signing node). Don't use weekday-only schedules, because updates happen on weekends too.4243## Prove it (drill)44Run this once after setup, and again after changes, at a quiet time:451. Record `tailscale ip -4`.462. `sudo pkill -x tailscaled && sudo apt-get remove -y tailscale`. This simulates an update.473. Run detect (expect exit 0), then restore (expect exit 0).484. **Pass** means the IP matches the one from step 1, `tailscale lock status` shows the node signed, and a known tailnet host answers.495. Keep a fallback in the drill (reinstall and start the daemon by hand) so a failed drill never leaves the bot offline.5051## Recovery guidance for users52- Recover a wedged computer with **Update Grok Bot's Computer**. It keeps files and logins.53- Avoid **Reset** unless there's no other option. It restores an older snapshot and can lose recent state.5455## Checklist before calling any setup on the Grok Bot computer done56- Is every file it needs under `/home/box`?57- Does something automatic reinstall or restart it after an update?58- Has the drill passed?59- If any answer is no, say so plainly instead of calling it done.