fix(install): inject resolv.conf + hosts on fast-install AND restore (no-DNS fix)#25
Merged
Merged
Conversation
The fast-install path (download latest_<tier>_<arch>.meta4 -> extract our prebuilt rootfs) never wrote /etc/resolv.conf, so a fast-installed system booted with no DNS resolver (proot has no resolver daemon) -> no name resolution -> 'no internet'. Only the reset / advanced-reset bootstrap paths wrote it. Our standalone build script intentionally strips resolv.conf from the artifact (network config shouldn't be baked into a downloadable tarball; the app owns runtime network state). So the app must inject it on fast-install too. Mirror the reset path: write nameserver 1.1.1.1/8.8.8.8 and 127.0.0.1 localhost into the rootfs right after extraction, before the companion-data (maps/kiwix) steps that themselves need DNS.
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Mark the imperative resolv.conf/hosts write as a quick add inside the DeployFragment god-object, to be folded into the rootfs domain/data slice during the ongoing Clean Architecture strangler refactor.
The reported 'no internet' repro uses the RESTORE path (import backup from external storage -> restore as internal backup -> boot), NOT fast-install. That path extracted the rootfs and only updated the UI; it never wrote /etc/resolv.conf, so the booted guest had no resolver -> name resolution failed (ping: Temporary failure in name resolution; /etc/resolv.conf absent). - Extract a single helper ensureRuntimeNetworkConfig(debianRootfs) that writes resolv.conf (1.1.1.1/8.8.8.8) + hosts, guarded by an etc/ isDirectory() check (logs instead of silently creating files in the wrong place) and logging. - Call it from BOTH fast-install and restore onComplete (restore targets installed-rootfs/iiab, matching the artifact layout). - Keeps the tech-debt note: imperative, belongs in the rootfs Clean-Arch slice.
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. The fast-install path (download
latest_<tier>_<arch>.meta4-> extract our prebuilt rootfs intorootfs/installed-rootfs/iiab) never wrote/etc/resolv.conf. proot has no resolver daemon, so a fast-installed system booted with no DNS -> name resolution fails -> apparent 'no internet'. Only the reset (MainActivity) and advanced-reset bootstrap (DeployFragment) paths wrote it.Why the app, not the build. Our standalone
tools/build-iiab-rootfs.shintentionally stripsresolv.conffrom the artifact: runtime network config should not be baked into a publicly downloadable tarball (the app is the single owner of system/network state, and it's easy to change here). So the app must inject DNS on fast-install too.Fix. Right after extraction (and before the companion-data maps/kiwix steps, which also need DNS), write
nameserver 1.1.1.1 / 8.8.8.8toetc/resolv.confand127.0.0.1 localhosttoetc/hostsintodebianRootfs-- mirroring the existing reset path. Wrapped in try/catch; failure only logs a warning.Touches only
DeployFragment.java. Will trigger the APK sanity-check (real app code).