Skip to content

Pre-can iPXE with a script that tries and tries to netboot forever#47

Merged
grahamc merged 3 commits intomainfrom
graham/dsp-68-ipxe-should-retry-forever
Jan 24, 2026
Merged

Pre-can iPXE with a script that tries and tries to netboot forever#47
grahamc merged 3 commits intomainfrom
graham/dsp-68-ipxe-should-retry-forever

Conversation

@grahamc
Copy link
Member

@grahamc grahamc commented Jan 24, 2026

This should catch issues with the network etc. that cause iPXE to fail and sends the system into the BIOS.

Summary by CodeRabbit

  • New Features

    • Added DHCPv6 HTTP boot script with automatic network-interface probing, configurable timeouts, retry logic, detailed progress/error messages, and chain-loading of discovered boot URIs.
  • Chores

    • Updated packaging/configuration to integrate the new boot script into the build process.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Jan 24, 2026

📝 Walkthrough

Walkthrough

Adds a new iPXE DHCPv6 HTTP boot script ipxe/dhcpv6-httpboot.ipxe and updates flake.nix to embed that script into the iPXE build by calling .override { embedScript = ./ipxe/dhcpv6-httpboot.ipxe; } before applying .overrideAttrs.

Changes

Cohort / File(s) Summary
Build configuration
flake.nix
Replaced direct nixpkgsFor.${system}.ipxe.overrideAttrs (oldAttrs: { ... }) with (nixpkgsFor.${system}.ipxe.override { embedScript = ./ipxe/dhcpv6-httpboot.ipxe; }).overrideAttrs (oldAttrs: { ... }) — embedScript applied first; existing patches/makeFlags/TRUST handled via overrideAttrs.
iPXE boot script
ipxe/dhcpv6-httpboot.ipxe
Added new DHCPv6/HTTP boot automation script that iterates interfaces (net0, net1, ...), resets interfaces, waits for link, performs SLAAC/DHCPv6 for addressing and boot-uri discovery, verifies fallback vars, attempts chain-load, logs progress, and retries across interfaces with configurable timeouts/delays.

Sequence Diagram

sequenceDiagram
    participant Script as iPXE Script
    participant Iface as Network Interface
    participant DHCPv6 as DHCPv6 Server
    participant BootSvr as Boot Server
    participant Loader as EFI Loader

    loop for each interface (net0, net1, ...)
        Script->>Iface: reset / bring up
        Script->>Iface: wait for link (timeout)
        Iface-->>Script: link status

        Script->>DHCPv6: request IPv6 (SLAAC/DHCPv6)
        DHCPv6-->>Script: IPv6 address + boot-uri (or none)

        Script->>Script: verify boot-uri / fallback vars
        Script->>BootSvr: chain-load from boot-uri
        alt chain load succeeds
            BootSvr-->>Loader: deliver boot image
            Loader-->>Script: boot continues
        else chain load fails
            Script->>Script: log failure, continue
        end
    end

    alt all interfaces exhausted
        Script->>Script: wait (retry delay) and retry all interfaces
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested reviewers

  • colemickens

Poem

🐰 I hop from net0 to net1 so spry,

sniffing DHCPv6 under sky,
I fetch a boot-uri, tidy and fleet,
chain-load the world with a bouncing beat,
a rabbit's nibble that makes machines fly.

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding an iPXE script that retries netbooting indefinitely, matching the core functionality introduced in the PR.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@grahamc grahamc force-pushed the graham/dsp-68-ipxe-should-retry-forever branch from 930180f to 7d18de9 Compare January 24, 2026 12:38
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🤖 Fix all issues with AI agents
In `@ipxe/dhcpv6-httpboot.ipxe`:
- Around line 165-170: The cleanup loop using close_idx and idx (labels
close_loop, variables close_idx and idx, and the check ifclose net${close_idx})
can spin forever when idx == 0; change the logic to first skip the loop when idx
== 0 and then iterate closing only existing interfaces by using ifclose
net${close_idx} as the loop terminator rather than relying solely on the
counter. Concretely: add an initial guard that exits the cleanup when ${idx} is
zero, and rewrite the close_loop so each iteration checks ifclose
net${close_idx} and breaks when no interface exists, otherwise closes
net${close_idx} and increments close_idx until it reaches the counted limit
(idx) or ifclose signals no more interfaces.
- Around line 69-76: Before running IPv6 configuration in the configure_ipv6
section, clear any existing boot URI variables to avoid stale values across
interfaces: explicitly unset or empty the variables boot-uri, bootfile-url, and
filename prior to the ifconf --configurator ipv6 --timeout ${dhcp_timeout}
${nic} call so each interface starts with a clean state; locate the
configure_ipv6 label and the ifconf invocation to add the variable clears there
(referencing boot-uri, bootfile-url, filename, and the ifconf command).

Copy link
Member

@cole-h cole-h left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm going to assume you've tested this and it works

@grahamc
Copy link
Member Author

grahamc commented Jan 24, 2026

sure

@grahamc grahamc merged commit 692f6d7 into main Jan 24, 2026
7 checks passed
@grahamc grahamc deleted the graham/dsp-68-ipxe-should-retry-forever branch January 24, 2026 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants