Skip to content

net: network.sh creates /run/mini-router itself — install.sh no longer rolls back on fresh machines - #147

Merged
Cd1s merged 1 commit into
mainfrom
fix/netsh-run-dir
Oct 17, 2026
Merged

Cd1s merged 1 commit into
mainfrom
fix/netsh-run-dir

Conversation

@Cd1s

@Cd1s Cd1s commented Oct 17, 2026

Copy link
Copy Markdown
Owner

What

mr/render.go renderNetwork: network.sh starts with mkdir -p /run/mini-router. Test: TestNetworkShCreatesRunDirFirst (the directory is created before the first use of /run/mini-router/ in the script).

Why

Since #138, network.sh truncates /run/mini-router/modem-aliases and modem-neigh (modemSh). mr apply runs network.sh in place, and on install.sh's first apply mr-network (whose start() creates the directory) has never run on a fresh boot's tmpfs /run. The failed redirection on : ended the script, so the apply rolled back on every fresh machine:

network.sh: exit status 1 /etc/mini-router/gen/network.sh: line 30: can't create /run/mini-router/modem-aliases: nonexistent directory

tools/ci.sh mounts a tmpfs on /run/mini-router, which is why CI did not see it.

Verification

  • sudo ./tools/ci.sh: ALL CHECKS PASSED. The new test fails without the render.go change.
  • Fresh-environment lab (Alpine 3.24 VM, unmodified install.sh): main ce5f0a6 → every install rolls back (5/5). With this branch all five scenarios run: 01 fresh DHCP 6/6, 02 PPPoE + DHCPv6-PD 8/8, 03 PPPoE → same-subnet DHCP modem via the API (net: handle upstream overlap, modem access, and ISP DNS sources #138's .254 modem page and the .1 collision) 11/11, 04 power cut in the confirm window 8/8, 05 live ISP changes 5/6 (the one miss is a doctor message, unrelated).
  • Reviewed by a second agent from a different model family (Gemini): no other generated script or hook writes under /run before its service created the directory.

Closes #145

🤖 Generated with Claude Code

…install.sh no longer rolls back (Closes #145)

Since #138 network.sh truncates /run/mini-router/modem-aliases and modem-neigh. install.sh's apply
runs network.sh in place before mr-network (which creates the directory) ever started, so the
redirection failed, the script exited and the apply rolled back on every fresh machine.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Cd1s
Cd1s merged commit f790e78 into main Oct 17, 2026
2 checks passed
Cd1s added a commit that referenced this pull request Oct 17, 2026
…s with simulated ISPs (DHCP, PPPoE, DHCPv6-PD) and a LAN client (#149)

* tools/lab: add isolated fresh environment harness

* tools/lab: record A1 verification results

* tools/lab: keep veth pairs inside lab namespaces

* tools/lab: isolate LAN and add guest seed installation

* tools/lab: add ISP slirp PPPoE hooks and live scenarios

* tools/lab: record leakage and ISP milestones

* tools/lab: complete cloud-init guest handoff and fallback LAN services

* tools/lab: fix cloud-init seed YAML and document guest limits

* tools/lab: update A1 continuation report

* tools/lab: seed Alpine router package layer for offline install

* tools/lab: protect host resolver and namespace state

* tools/lab: continue guest install with offline packages

* tools/lab: add A1 handover notes

* tools/lab: run the real install.sh — signed offline apk mirror, virtio agent console, deferred install, PPPoE/PD ISP rework

* tools/lab: lts base, virtio agent console, PPPoE + DHCPv6-PD ISP, lab.sh change, scenarios on lib.sh, A1c report

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tools/lab: no host daemon config or services, isp --gw, 03 for same-subnet modems after #138

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tools/lab: README links the product fixes #147 #148

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* tools/lab: review fixes — pinned downloads, image lock, pppd off the host's /run, cleanup on every exit

- the cloud image and the minirootfs are fixed versions with pinned SHA256s (checked against Alpine's
  .sha512 / .sha256); the package chroot is always re-extracted from the verified tarball
- one lock (mr-lab-images/.build.lock) for all shared image initialisation; temp dirs from mktemp;
  loop mounts on fresh mount points, unmounted by the exit trap
- veth pairs are created inside the lab namespaces (ip -n <sw> link add ... peer ... netns <ns>)
- pppoe-server and its pppd run with a private tmpfs /run: no /run/ppp0.pid or pppd2.tdb on the host
- processes are stopped TERM first, KILL after 3 s; isp_stop / ns_del signal everything inside the
  lab namespace, pid files only a process whose name still matches; powercut goes through kill_qemu
- host guard: INT/TERM/HUP run it in dash, symlinks under /etc/ppp, a baseline across commands
  (lab.sh guard-reset); up refuses to run next to host dnsmasq / kea / radvd services
- scenarios: the lab is taken down on any exit (MRLAB_KEEP=1 keeps it), failed setup steps bail out
- README: dependencies (mask services before installing; python3, openssh-client; no socat),
  download trust, host safety

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
@Cd1s Cd1s mentioned this pull request Oct 18, 2026
52 tasks done
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.

install.sh rolls back on every fresh machine since #138: network.sh writes /run/mini-router before it exists

1 participant