Skip to content

Fix fresh Linux channel provisioning - #37

Merged
gitcommit90 merged 3 commits into
mainfrom
fix/linux-lxc-state-path
Jul 29, 2026
Merged

Fix fresh Linux channel provisioning#37
gitcommit90 merged 3 commits into
mainfrom
fix/linux-lxc-state-path

Conversation

@gitcommit90

@gitcommit90 gitcommit90 commented Jul 29, 2026

Copy link
Copy Markdown
Owner

Outcome

Fix fresh Linux channel creation in the superseding 0.0.28 installer hotfix.

  • Align the installer and runtime on /var/lib/1helm-lxc/machines.
  • Wait for DHCP, route, DNS, and real outbound IPv4 HTTP before guest bootstrap.
  • Insert narrowly owned LXC filter jumps ahead of host policies such as Docker's FORWARD=DROP while retaining 1Helm-owned NAT.
  • Keep bootstrap fail-closed when any apt source cannot update.

Verification

  • npm run typecheck
  • npm run build
  • npm run test:site
  • node --test test/channel-computers.mjs
  • Bash syntax checks
  • Full npm test (running locally on latest commit)
  • Real reproduction on the affected Docker host: exact failed channel now provisions, reports RUNNING, executes as agent in /workspace, has the exact ownership marker, and reaches the Ubuntu archive over outbound HTTP.

This is intentionally a Linux-only prerelease hotfix. Stable macOS and Windows feeds remain on 0.0.26.

@coderabbitai

coderabbitai Bot commented Jul 29, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The release is bumped to 0.0.28 across package metadata, installers, channel image defaults, documentation, and tests. LXC provisioning now uses the shared machines runtime tree and waits for guest route and DNS readiness before apt bootstrap.

Changes

Release 0.0.28 and LXC runtime alignment

Layer / File(s) Summary
0.0.28 release and image wiring
package.json, site/public/install.sh, site/public/install-lxc-runtime.sh, src/server/..., README.md, CHANGELOG.md, test/channel-computers.mjs, test/site.mjs
Version references, channel machine image defaults, release notes, compare links, and pinned expectations are updated from 0.0.27 to 0.0.28.
LXC runtime path alignment
site/public/install-lxc-runtime.sh, test/site.mjs
The LXC state path changes from $LXC_ROOT/containers to $LXC_ROOT/machines, with assertions covering shared state usage and removal of the obsolete directory.
Guest network readiness before bootstrap
scripts/1helm-lxc-runtime, test/site.mjs
Guest provisioning polls for the expected DHCP route and Ubuntu DNS resolution before running apt-get update; tests validate the readiness gate and bootstrap ordering.

Estimated code review effort: 2 (Simple) | ~15 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LXC_Runtime
  participant LXC_Guest
  participant Ubuntu_DNS
  LXC_Runtime->>LXC_Guest: Start guest and poll default route
  LXC_Guest->>Ubuntu_DNS: Resolve Ubuntu archive domains
  Ubuntu_DNS-->>LXC_Guest: Return DNS resolution
  LXC_Runtime->>LXC_Guest: Run apt-get update after readiness
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers outcome and verification, but it omits required template sections like Summary, Type of change, Release notes, and the acceptance ledger. Add the missing template sections with a concise Summary, Type of change, Release notes, numbered acceptance ledger, and post-merge checklist items.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly matches the main change: fixing fresh Linux channel provisioning.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/linux-lxc-state-path

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@test/site.mjs`:
- Around line 175-177: Extend the regression assertions around lxcHelper to also
reject the obsolete $LXC_ROOT/containers path, alongside the existing
lxcInstaller check. Keep the current positive LXC_PATH assertions unchanged and
use the same does-not-match behavior and descriptive message for both runtime
and installer content.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 9d54f5b7-11a9-48ca-95e3-597292ac51d1

📥 Commits

Reviewing files that changed from the base of the PR and between 3b8bad4 and c7dc6cb.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (9)
  • CHANGELOG.md
  • README.md
  • package.json
  • site/public/install-lxc-runtime.sh
  • site/public/install.sh
  • src/server/channel-computers.ts
  • src/server/db.ts
  • test/channel-computers.mjs
  • test/site.mjs

Comment thread test/site.mjs
Comment on lines +175 to +177
assert.match(lxcInstaller, /LXC_PATH="\$LXC_ROOT\/machines"/, "installation and the runtime use the same LXC state directory");
assert.match(lxcHelper, /LXC_PATH="\$LXC_ROOT\/machines"/, "the runtime reads the installer-created LXC state directory");
assert.doesNotMatch(lxcInstaller, /LXC_ROOT\/containers/, "the obsolete mismatched LXC state directory is not installed");

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Also reject obsolete paths in the runtime helper.

The test verifies that lxcHelper defines the new LXC_PATH, but only checks for $LXC_ROOT/containers in lxcInstaller. A separate hardcoded obsolete reference in the helper could therefore pass this regression test.

Suggested assertion
  assert.doesNotMatch(lxcInstaller, /LXC_ROOT\/containers/, "the obsolete mismatched LXC state directory is not installed");
+ assert.doesNotMatch(lxcHelper, /LXC_ROOT\/containers/, "the runtime helper does not use the obsolete LXC state directory");
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
assert.match(lxcInstaller, /LXC_PATH="\$LXC_ROOT\/machines"/, "installation and the runtime use the same LXC state directory");
assert.match(lxcHelper, /LXC_PATH="\$LXC_ROOT\/machines"/, "the runtime reads the installer-created LXC state directory");
assert.doesNotMatch(lxcInstaller, /LXC_ROOT\/containers/, "the obsolete mismatched LXC state directory is not installed");
assert.match(lxcInstaller, /LXC_PATH="\$LXC_ROOT\/machines"/, "installation and the runtime use the same LXC state directory");
assert.match(lxcHelper, /LXC_PATH="\$LXC_ROOT\/machines"/, "the runtime reads the installer-created LXC state directory");
assert.doesNotMatch(lxcInstaller, /LXC_ROOT\/containers/, "the obsolete mismatched LXC state directory is not installed");
assert.doesNotMatch(lxcHelper, /LXC_ROOT\/containers/, "the runtime helper does not use the obsolete LXC state directory");
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@test/site.mjs` around lines 175 - 177, Extend the regression assertions
around lxcHelper to also reject the obsolete $LXC_ROOT/containers path,
alongside the existing lxcInstaller check. Keep the current positive LXC_PATH
assertions unchanged and use the same does-not-match behavior and descriptive
message for both runtime and installer content.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/1helm-lxc-runtime`:
- Around line 79-100: The wait_for_guest_network function only bounds retries,
not individual lxc-attach or DNS operations. Add a per-probe timeout to each
lxc-attach invocation, including the getent DNS check, so stalled commands fail
and the loop continues toward its existing final die path without changing the
retry behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 65600af4-3d78-4f22-be3e-514a0e1e2d50

📥 Commits

Reviewing files that changed from the base of the PR and between c7dc6cb and 717fa86.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • scripts/1helm-lxc-runtime
  • test/site.mjs
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Comment thread scripts/1helm-lxc-runtime
Comment on lines +79 to +100
wait_for_guest_network() {
local name="$1" attempt
for attempt in {1..300}; do
if lxc-attach -P "$LXC_PATH" -n "$name" --clear-env -- /bin/sh -c '
ip -4 -o addr show dev eth0 scope global | grep -q " inet 10\.0\.3\." \
&& ip -4 route show default | grep -q " via 10\.0\.3\.1 dev eth0"
' >/dev/null 2>&1; then
lxc-attach -P "$LXC_PATH" -n "$name" --clear-env -- /bin/sh -c '
rm -f /etc/resolv.conf
printf "nameserver 10.0.3.1\n" >/etc/resolv.conf
'
if lxc-attach -P "$LXC_PATH" -n "$name" --clear-env -- /bin/sh -c '
getent ahostsv4 archive.ubuntu.com >/dev/null \
&& getent ahostsv4 security.ubuntu.com >/dev/null
' >/dev/null 2>&1; then
return
fi
fi
sleep 0.2
done
die "container started but its private DHCP route and DNS did not become ready"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Bound the lxc-attach and DNS probes, not only the loop.

The 300-iteration loop is not a hard timeout: a stuck lxc-attach or getent resolver query can block an iteration, causing installation to exceed the intended ~60-second retry window by potentially many minutes. Add a per-probe timeout and treat timeout failures as retries/final failure.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/1helm-lxc-runtime` around lines 79 - 100, The wait_for_guest_network
function only bounds retries, not individual lxc-attach or DNS operations. Add a
per-probe timeout to each lxc-attach invocation, including the getent DNS check,
so stalled commands fail and the loop continues toward its existing final die
path without changing the retry behavior.

@gitcommit90 gitcommit90 changed the title Fix fresh Linux LXC state path Fix fresh Linux channel provisioning Jul 29, 2026
@gitcommit90
gitcommit90 merged commit 94e64a9 into main Jul 29, 2026
6 checks passed
@gitcommit90
gitcommit90 deleted the fix/linux-lxc-state-path branch July 29, 2026 18:15
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.

1 participant