Newer Older
8f00f0f 3 months ago History
146 lines | 6.523kb
Bogdan Timofte authored 3 months ago
1
# Madagascar's Thunderbolts
2

            
3
Thunderbolt networking toolkit for three Proxmox hosts (`baobab`, `ebony`, `tapia`).
4
The goal is to bring up a high-MTU Thunderbolt bridge (`thunderbridge`) early in boot,
5
enlist hot-plugged Thunderbolt NICs as they appear, and keep management networking
6
configs consistent across the cluster.
7

            
8
## Repository layout
9

            
10
```
11
deploy/attempt1/
12
├── common/                    # Shared bits copied to every host
13
│   ├── systemd/system/
14
│   │   ├── tb-bridge.service  # Ensures the bridge device exists and is up
15
│   │   └── tb-enlist@.service # Enlists hotplugged NICs into the bridge
16
│   └── udev/rules.d/
17
│       └── 90-…systemd.rules  # Starts tb-enlist@ for thunderbolt* devices
18
├── baobab/…                   # Node-specific /etc/network config
19
├── ebony/…
20
├── tapia/…
21
└── deploy_tb.sh               # Main deployment script
22
```
23

            
24
The repo currently holds a single deployment attempt (`deploy/attempt1`). If you
25
iterate on the design, prefer adding a new attempt directory so older snapshots
26
stay reproducible.
27

            
28
## Standardized lifecycle
29

            
30
This project now has two distinct operational paths:
31

            
32
- Full bootstrap: `deploy/attempt1/deploy_tb.sh`
33
  - can update host-specific network configuration
34
  - use for initial deployment or deliberate network template rollout
35
- Shared runtime reinstall: `./setup.sh`
36
  - standardizes the shared runtime artifacts only
37
  - installs/removes `tb-recover.sh`, the shared systemd units, and the udev rule
38
  - intentionally leaves `/etc/network/interfaces` and `/etc/network/interfaces.d/10-thunderbolt` untouched
39

            
40
Standardized host paths for the shared runtime:
41

            
42
- canonical uninstall: `/usr/local/lib/xdev/thunderbolts/uninstall.sh`
43
- canonical shared script: `/usr/local/lib/xdev/thunderbolts/tb-recover.sh`
44
- operator wrapper: `/usr/local/sbin/tb-recover.sh`
45
- installed docs: `/usr/local/share/doc/xdev/thunderbolts`
46

            
47
Use:
48

            
49
```bash
50
./setup.sh                 # reinstall shared runtime on baobab ebony tapia
51
./setup.sh baobab          # single host
52
./setup.sh --uninstall baobab
53
```
54

            
55
## Prerequisites
56

            
57
- Machine with Bash ≥3, `ssh`, and `scp` available.
58
- Access to the target hosts as `root` (default username) over the management or
59
  Thunderbolt network; passwordless SSH is assumed.
60
- Target hosts run Proxmox (or any Debian-like system with ifupdown2 and systemd).
61
- `ip`, `systemctl`, and `udevadm` available on the remote hosts.
62

            
63
## How deployment works
64

            
65
`deploy_tb.sh` is idempotent. For each target host it:
66

            
67
- Chooses an IP by trying management first, then Thunderbolt (`get_mgmt_ip`/`get_tb_ip`).
68
- Uploads shared udev and systemd units that prepare the `thunderbridge` device and
69
  attach Thunderbolt NICs when they hot-plug.
70
- Replaces `/etc/network/interfaces` with the host-specific template and places the
71
  Thunderbolt overlay in `/etc/network/interfaces.d/10-thunderbolt`.
72
- Reloads udev and systemd, triggers network reloads, enables the services, and
73
  prints a short status report (bridge state, enlisted NICs).
74

            
75
Run it from inside the attempt directory so relative paths resolve correctly.
76

            
77
```bash
78
cd deploy/attempt1
79
./deploy_tb.sh            # deploys to baobab, ebony, tapia
80
./deploy_tb.sh baobab     # deploys to a single host
81
./deploy_tb.sh tapia ebony
82
```
83

            
84
## Customising host lists and addresses
85

            
86
Edit the `get_mgmt_ip()` and `get_tb_ip()` helpers near the top of
87
`deploy/attempt1/deploy_tb.sh` to match your environment. Each host that you want
88
to target must:
89

            
90
1. Have a subdirectory named after the host inside `deploy/attempt1`.
91
2. Provide the full `/etc/network/interfaces` template.
92
3. Provide `etc/network/interfaces.d/10-thunderbolt` with the bridge definition
93
   and hotplug rules for Thunderbolt interfaces.
94

            
95
To add a new host, copy one of the existing directories, adjust static IPs and
96
interface names, then extend both helper functions so the script can locate it.
97

            
98
## What the systemd/udev pieces do
99

            
100
- `tb-bridge.service` (oneshot) makes sure the `thunderbridge` device exists as a
101
  Linux bridge, sets MTU 65520, and brings it up during early boot.
102
- `tb-enlist@.service` attaches Thunderbolt NIC instances to the bridge, aligning
103
  their MTU and keeping them hotplug friendly; systemd stops the unit cleanly on
Bogdan Timofte authored 3 months ago
104
  device removal and keeps it ordered before `network.target` during shutdown so
105
  remote filesystems over `thunderbridge` can unmount before the ports detach.
Bogdan Timofte authored 3 months ago
106
- `90-thunderbolt-net-systemd.rules` tags `thunderbolt*` NICs so udev starts the
107
  enlist service automatically.
108

            
109
These files live under `deploy/attempt1/common/` and are copied verbatim to the
110
remote host’s `/etc/systemd/system` and `/etc/udev/rules.d`.
111

            
112
## Validation checklist
113

            
114
After running the deploy script on a host:
115

            
116
- `systemctl status tb-bridge.service` should show an *active* oneshot unit.
117
- `systemctl list-units 'tb-enlist@*'` should list one unit per detected Thunderbolt
118
  NIC, each *loaded* and *active*.
119
- `ip -d link show thunderbridge` should display MTU 65520 and `state UP`.
120
- `bridge link` should list your Thunderbolt interfaces as ports of `thunderbridge`
121
  once cables are connected.
122

            
123
If you change the network definitions, re-run `./deploy_tb.sh <host>` to push the
124
updates. The script re-applies permissions, reloads systemd, retriggers udev, and
125
refreshes the interfaces.
126

            
127
## Troubleshooting tips
128

            
129
- *SSH unreachable*: Confirm management and Thunderbolt IPs in the helper functions
130
  are correct, and that firewalls allow SSH. The script prints which IP it tried.
131
- *Bridge missing after reboot*: Ensure `tb-bridge.service` is enabled; run
132
  `systemctl enable --now tb-bridge.service` on the host.
133
- *NICs not joining*: Check `journalctl -u tb-enlist@thunderbolt0` for logs and make
134
  sure the udev rule is present under `/etc/udev/rules.d`.
Bogdan Timofte authored 3 months ago
135
- *Slow shutdown with NFS on thunderbridge*: Verify the host has the updated
136
  `tb-enlist@.service` with `Before=network.target`; otherwise `thunderbridge`
137
  can disappear before Proxmox unmounts NFS storages and shutdown waits on NFS
Bogdan Timofte authored 3 months ago
138
  timeouts. Full incident context is tracked in cluster issue `ISSUE-2026-002`.
Bogdan Timofte authored 3 months ago
139
- *MTU mismatch complaints*: The service forces MTU 65520 on both sides; verify the
140
  connected devices also support it.
141

            
142
## Extending beyond attempt1
143

            
144
Prefer copying `deploy/attempt1` into a new versioned folder (for example,
145
`attempt2`) when you experiment with alternate topologies or addresses. This keeps
146
previous rollouts reproducible and eases diffing of changes.