Skip to content

In case of invalid networking DNS settings disable MagicDNS to enable the app to start up#662

Open
lmagyar wants to merge 1 commit into
hassio-addons:mainfrom
lmagyar:pr-fix-startup
Open

In case of invalid networking DNS settings disable MagicDNS to enable the app to start up#662
lmagyar wants to merge 1 commit into
hassio-addons:mainfrom
lmagyar:pr-fix-startup

Conversation

@lmagyar

@lmagyar lmagyar commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

Proposed Changes

Currently the app intentionally can't start if MagicDNS is configured in network settings as DNS server and MagicDNS is enabled (ie. userspace networking is disabled).

With this change, if invalid config is detected, userspace networking will be enabled, ie. MagicDNS will be disabled, and a long warning is logged, but the app can start at least.

Related Issues

fixes #659 #651

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Added automatic detection of MagicDNS DNS server configurations during startup, which now intelligently enables userspace networking when needed for optimal compatibility.
  • Refactor

    • Improved error logging formatting for DNS configuration validation.

@lmagyar lmagyar added the bugfix Inconsistencies or issues which will cause a problem for users or implementors. label Apr 7, 2026
@coderabbitai

coderabbitai Bot commented Apr 7, 2026

Copy link
Copy Markdown

Walkthrough

The PR adds DNS preflight validation in the stage2 hook to detect MagicDNS servers and automatically enable userspace_networking when detected, while reformatting an existing fatal error log call in the init script for consistency.

Changes

Cohort / File(s) Summary
MagicDNS Init Script Formatting
tailscale/rootfs/etc/s6-overlay/s6-rc.d/init-magicdns-ingress-proxy/run
Reformatted bashio::log.fatal call to use multi-line invocation with line continuation, preserving identical error handling behavior.
Stage2 Hook DNS Preflight Validation
tailscale/rootfs/etc/s6-overlay/scripts/stage2_hook.sh
Added DNS preflight validation that detects MagicDNS servers (IPv4: 100.100.100.100, IPv6: fd7a:115c:a1e0::53) and programmatically enables the userspace_networking addon option when detected, introducing new control flow before existing service dependency logic.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • frenck

Poem

🐰 A clever rabbit hops with glee,
Detecting DNS and setting it free,
MagicDNS comes to town,
Userspace networking goes down,
Conflicts now smoothly flee! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: detecting invalid MagicDNS DNS settings and disabling MagicDNS (via userspace networking) to allow startup.
Linked Issues check ✅ Passed The PR addresses issue #659 by adding DNS preflight validation to detect MagicDNS configuration conflicts and programmatically enable userspace networking to prevent startup failures.
Out of Scope Changes check ✅ Passed All changes are directly related to resolving the DNS/startup issue: DNS validation logic in stage2_hook.sh and improved fatal error logging in the init script.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

@lmagyar lmagyar mentioned this pull request Apr 8, 2026

@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 the current code and only fix it if needed.

Inline comments:
In `@tailscale/rootfs/etc/s6-overlay/scripts/stage2_hook.sh`:
- Line 95: Change the unguarded Supervisor write so a failed
bashio::addon.option 'userspace_networking' 'true' does not abort startup and
also record the intended setting in a shell variable; specifically, call
bashio::addon.option in a way that ignores failure (so set -e won't exit) and
set a variable like forced_userspace_networking=true when you attempt the write,
then replace later checks that currently use bashio::config.true
"userspace_networking" (at the pruning logic) with a guard that accepts either
the Supervisor config or the local variable, e.g. use bashio::config.true
"userspace_networking" || bashio::var.true "${forced_userspace_networking}" so
removals are gated by either the persisted config or the recorded intended
state.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 79439d36-6732-452d-b0d0-6f20fef7387b

📥 Commits

Reviewing files that changed from the base of the PR and between 25b151d and e276fcf.

📒 Files selected for processing (2)
  • tailscale/rootfs/etc/s6-overlay/s6-rc.d/init-magicdns-ingress-proxy/run
  • tailscale/rootfs/etc/s6-overlay/scripts/stage2_hook.sh

Comment thread tailscale/rootfs/etc/s6-overlay/scripts/stage2_hook.sh
@lmagyar lmagyar added the no-stale This issue or PR is exempted from the stable bot. label May 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix Inconsistencies or issues which will cause a problem for users or implementors. no-stale This issue or PR is exempted from the stable bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0.28.0 Start Error

1 participant