# argoctl preflight

Source: https://argoctl-docs.pages.dev/docs/reference/cli/preflight

> Prove every node's BMC can boot it from Redfish virtual media, by booting a test image and waiting for it to report back, then restore the BMC.

## Synopsis

```bash
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl preflight <site-file> [flags]
```

**Power-cycles the nodes:**

Run it before the site is installed, or on nodes that aren't in production. Once a node is managed by Ironic (after `provision`), Ironic owns its power state.

## Description

Checks, before anything is installed, that every node's BMC can boot the node from Redfish virtual media, which is how Ironic installs the OS. For each node, in parallel, it boots a small signed test image and waits for the image, running **on that node**, to report back over the provisioning network. "Media inserted" or "powered on" never counts as a pass.

argoctl serves the image itself: mgmt needs no internet access, and no Ironic, DHCP or PXE is involved.

### What it checks, per node

1. **Login**: `GET /redfish/v1/Systems` with the site file's BMC user and password. The password is never printed.
2. **System**: the BMC's only ComputerSystem, the one in `system_id`, or the one whose EthernetInterfaces include the node's provisioning MAC. Notes its power state and boot override.
3. **Secure Boot**: reads `SecureBootEnable` / `SecureBootCurrentBoot`, reported per node (not a failure either way).
4. **Virtual media**, found by following links, never guessed: the System's `VirtualMedia` collection and those of its Managers. It needs a device whose `MediaTypes` include `CD` or `DVD` with the `VirtualMedia.InsertMedia` action. If that CD already holds an image, preflight stops: it never replaces media it didn't insert.
5. **Insert** the node's copy of the test image and check it reads back as inserted.
6. **Boot override** to `Cd` once, then a **cold start**: off (if it was on), then on.
7. **Boot confirmed**: the node passes only when the test image reports back from the node's provisioning IP.
8. **Restore**, always (also after a failure, a timeout or Ctrl-C), undoing only what this run changed: power off, eject, set the boot override back explicitly to what it was, and power back on if the node was on. Anything that can't be put back fails the node, with the commands to do it by hand.

### How the boot is confirmed

- On `mgmt.oob_ip:8780` (the BMC network) argoctl serves each node its own copy of the image, at a URL containing a random per-run token. It supports `HEAD` and byte ranges, which many BMCs use.
- Each copy carries the node's name, provisioning MAC and static IP, and the URL to report to.
- The image's init finds the NIC with that MAC, gives it the static IP and POSTs a report to `mgmt.provisioning_ip:8780`: node, MAC, NIC, kernel and Secure Boot state as the OS saw it.
- argoctl also counts the image requests per node, so a failure says whether the BMC **never fetched** the image (network or firewall between BMC and mgmt) or **fetched it but the node didn't report** (Secure Boot, boot order, NIC or IP).

The test image is a UEFI CD of about 35 MB that boots with Secure Boot on: shim (signed by the Microsoft UEFI CA), signed GRUB and the Ubuntu 24.04 kernel. It ships in the release bundle under `share/preflight/`.

## Flags

| Flag | Default | |
|---|---|---|
| `<site-file>` | | Path to the site file. It must set `mgmt.oob_ip`. |
| `--node <name>` | all | Check only these nodes (repeat the flag). |
| `--json` | | Print the report as JSON on stdout. |
| `--parallel <n>` | `8` | Nodes checked at the same time. |
| `--boot-timeout <d>` | `10m` | Per node, from power-on to the test image reporting back. |
| `--power-timeout <d>` | `2m` | For the BMC to report a power change. |
| `--request-timeout <d>` | `30s` | One Redfish request (InsertMedia gets at least 3m: some BMCs download the image first). |
| `--timeout <d>` | `60m` | The whole run. Nodes still running are stopped and restored. |
| `--port <n>` | `8780` | Port for both listeners. |
| `--iso <path>` | from the bundle | The test image; its `.json` manifest must sit next to it. Default: `share/preflight/` next to the binary's `bin/`, else `/opt/argoctl/releases/argoctl-<version>-x86_64-linux/share/preflight/`. |

## Examples

```bash
export ARGOCTL_BMC_PASSWORD=...     # wherever bmc.password_env / password_file points
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl preflight /etc/argoctl/site.yaml
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl preflight site.yaml --node gpu1 --node gpu2
sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl preflight site.yaml --json > preflight.json
```

## Output

```text
$ sudo --preserve-env=ARGOCTL_BMC_PASSWORD argoctl preflight /etc/argoctl/site.yaml --node gpu1
==> preflight /etc/argoctl/site.yaml: site dc1, 1 node (gpu1); booting each from virtual media, which power-cycles it
    test ISO /opt/argoctl/releases/argoctl-1.0.0-x86_64-linux/share/preflight/argo-preflight.iso (kernel 6.8.0-151-generic)
  gpu1      logging in to https://172.16.0.21 as admin
  gpu1      system /redfish/v1/Systems/1: power On, boot override None (Disabled)
  gpu1      Secure Boot on
  gpu1      virtual CD /redfish/v1/Managers/1/VirtualMedia/CD1 (under Manager 1)
  gpu1      inserting http://172.16.0.10:8780/preflight/[redacted]/argo-preflight-gpu1.iso
  gpu1      boot override -> Cd
  gpu1      powering off, then on
  gpu1      waiting up to 10m for the test image to report from 172.16.1.21
  gpu1      test image reported from 172.16.1.21 after 1m48s (Secure Boot enabled)
  gpu1      booted the test ISO; restoring the BMC settings
  gpu1      restored: power the node off
  gpu1      restored: eject the test ISO
  gpu1      restored: set the boot override back to None (Disabled)
  gpu1      restored: power the node on
  gpu1      pass

✓ preflight of site dc1: 1 node passed (2m31s)
  test ISO served from http://172.16.0.10:8780, reports to http://172.16.1.10:8780

  NODE  RESULT  SECURE BOOT  VIRTUAL MEDIA        BOOT
  gpu1  pass    on           CD1 (Manager 1)      booted the ISO in 1m48s, reported from 172.16.1.21
  Full log: /var/log/argoctl/20261130T101500Z-preflight.log
```

A failure:

```text
✗ preflight of site dc1: 1 of 3 nodes failed (10m42s)

  NODE  RESULT  SECURE BOOT  VIRTUAL MEDIA    BOOT
  cp1   pass    on           CD1 (Manager 1)  booted the ISO in 1m12s, reported from 172.16.1.11
  gpu1  pass    on           CD1 (Manager 1)  booted the ISO in 1m48s, reported from 172.16.1.21
  gpu2  FAIL    on           CD1 (Manager 1)  ISO fetched, no report

✗ gpu2: the BMC fetched the test ISO (35.4 MB) and the node was powered on, but the test image didn't report within 10m (Secure Boot is on) (step: boot the test ISO)
  restored: power the node off; eject the test ISO; set the boot override back to None (Disabled); power the node on
  To fix:
    1. Watch gpu2's console (the BMC's remote console) while running argoctl preflight /etc/argoctl/site.yaml --node gpu2
    2. "Access Denied" or "Security Violation": Secure Boot refused the boot loader; enable the Microsoft UEFI CA (3rd-party CA) in the firmware
    3. "argo-preflight:" lines: the image booted; they say whether it found the NIC with MAC 3c:ec:ef:10:00:22 and reached 172.16.1.10
  Full log: /var/log/argoctl/20261130T101500Z-preflight.log
```

### JSON

`--json` prints, per node: `result` (`pass`/`fail`), `virtual_media` (`path`, `hosted_by`), `secure_boot` (`bmc_enabled`, `bmc_current_boot`, `node_reported`), `original` (power state and boot override before the run), `boot` (`iso_url`, `iso_requests`, `iso_bytes_served`, `reported_after_secs`, `reported_from`, `kernel`, `nic`), `restore` (each action with `ok`) and `failure` (`step`, `reason`, `recovery`).

## Exit codes

| Code | Meaning |
|---|---|
| `0` | Every node passed. |
| `1` | Any node failed, or the run couldn't start. |
| `2` | Usage error. |

## Troubleshooting

| Symptom | Likely cause and fix |
|---|---|
| `can't listen on 172.16.0.10:8780 ... address not available` | Not running on mgmt, or the site file's `mgmt.oob_ip`/`provisioning_ip` aren't mgmt's addresses (`ip -br addr`). |
| `... address in use` | Another preflight (or something else) uses the port: `sudo ss -ltnp 'sport = :8780'`, or `--port`. |
| `mgmt.oob_ip is not set` | Add it to the site file: the BMCs download the image from there. |
| Login: `login refused` | Wrong `bmc.username` or password; try `curl -k -u <user> https://<bmc>/redfish/v1/Systems`. |
| Login: `TLS handshake failed` | Self-signed BMC certificate: `verify_tls: false` for that node, or trust its CA on mgmt. |
| `no VirtualMedia under the System or its Managers` | Virtual media may need a BMC licence (iDRAC Enterprise, iLO Advanced) or newer firmware. |
| `virtual CD ... has no InsertMedia action` | The BMC can't mount by URL over Redfish, which argoCTL and Ironic need. Update the BMC firmware. |
| `the virtual CD already holds ...` | Someone else's media is mounted. Eject it (the report prints the command) and re-run. |
| Boot: `the BMC never fetched the test ISO` | The BMC can't reach `http://<mgmt.oob_ip>:8780`: firewall (`sudo ufw status`), routing, or a BMC that only fetches at boot and failed: watch its console. |
| Boot: `fetched the test ISO ... didn't report` | Watch the node's console. **"Access Denied" / "Security Violation"**: Secure Boot refused the loader; enable the Microsoft 3rd-party UEFI CA. **GRUB menu "Argo preflight test" then `argo-preflight:` lines**: the image booted; they say whether it found the NIC with the site file's MAC and reached mgmt. **Network or disk boot**: the BMC ignored the Cd override (check UEFI mode). Slow hardware: `--boot-timeout 15m`. |
| A node failed at `restore` | Preflight couldn't put something back; the report lists the `curl` commands to do it. |
| Strange results on enrolled nodes | Once a node is in Ironic, Ironic owns its power state and syncs it back. Run preflight before provisioning. |

## Related

- [`argoctl site validate`](https://argoctl-docs.pages.dev/docs/reference/cli/site-validate): run it first.
- [`argoctl provision`](https://argoctl-docs.pages.dev/docs/reference/cli/provision): installs the OS over the same virtual media.
- [Requirements: BMCs](https://argoctl-docs.pages.dev/docs/requirements#bmcs)
