install-proxy: auto-detect default-route interface for IP lookup#6
Open
RobertNils wants to merge 1 commit into
Open
install-proxy: auto-detect default-route interface for IP lookup#6RobertNils wants to merge 1 commit into
RobertNils wants to merge 1 commit into
Conversation
IP detection only probed a hardcoded interface list (eth0 ens3 ens4), so on hosts whose primary NIC has a different name (e.g. ens6 on Ubuntu 24.04 and IONOS VPS) NET_IP came back empty. fresh-start.sh was then called with an empty --ip-address and aborted with "Invalid option for --ip-address". Prefer the host's actual default-route interface (via `ip route`) and prepend it to the existing list, keeping the old names as a fallback so behaviour is unchanged on hosts that already worked. Also silence the "Device does not exist" noise from `ip address show` for absent NICs. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
install/nginx-proxy/install-proxy.shdiscovers the server's IP by probing a hardcoded interface list:On hosts whose primary NIC has a different name this loop never finds an IP, so
NET_IPis empty andfresh-start.shis invoked with an empty--ip-address, aborting the install:Ubuntu 24.04 and IONOS VPS name the primary interface
ens6, which is not in the list, so the install fails out of the box there.Fix
Detect the host's actual default-route interface with
ip routeand prepend it to the existing list, keeping the well-known names as a fallback:eth0/ens3/ens4via the fallback list.ens6,enp0s3,eno1, etc.).2>/dev/nulltoip address showto silence "Device does not exist" warnings for absent NICs.Testing
On a fresh Ubuntu 24.04 host whose primary interface is
ens6, I ran both detection blocks directly:NET_IPempty (reproduces the abort).ens6viaip routeand resolvesNET_IPto the correct public IP.bash -n install-proxy.shpasses.The same problem was hit on three separate Ubuntu 24.04 hosts; the equivalent fix (extending the interface list) was applied there to complete the install. This PR generalises it via auto-detection so no host-specific list edits are needed.