All four attempts to sanboot the Alpine raw image through iPXE crash at the same RIP offset (0x35FC from the iPXE image base) regardless of memory (2G or 4G), iPXE binary (universal or snp-only), or image virtual size (2G or 1G). Common factor: all used sanboot to present the URL as a block device.
Replace boot.ipxe with iPXE's kernel/initrd/boot primitive. This bypasses sanboot and the SAN device creation path entirely. The kernel will fail to find a rootfs (no /dev/sda* is exposed) and panic — but kernel boot messages in the journal will tell us whether iPXE's kernel-initrd handoff works at all. If it does, the bug is isolated to the sanboot/SAN-device code path. If it also crashes, the bug is in shared iPXE code (HTTP download buffer management, probably).
The universal UEFI binary ipxe.efi (1.2 MB, all NIC drivers)
crashes at the same offset (0x35FC from the iPXE image
base) whether the VM has 2 GB or 4 GB of RAM, with
RAX = 0xAF...AF (iPXE uninit-memory fill). So this is not
OOM (the memory bump did not help) and not a NIC driver
issue (we use virtio-net, which the universal binary handles);
it is a deterministic bug somewhere in the sanboot/download
buffer path of the universal binary when the image is 2 GB.
snp.efi (310 KB, SNP-only — the driver virtio-net speaks)
is a separate iPXE build with a smaller code path: no UNDI,
no PXE prefix, no multi-NIC code. The same bug may not be
there, or the different code layout may avoid the bad
offset. Worth a try before reaching for GRUB or NFS root.
The opt-in is just bootloader.ipxeBinary = "snp.efi"; on
the pxe-infra attrset. The tmpfiles rule in
modules/pxe-infra/default.nix will symlink the new name
into the served TFTP root, and the next DHCP offer from
dnsmasq will hand it to the firmware.
iPXE's sanboot for an HTTP URL needs to hold the entire image
in its own heap. The raw Alpine image is 2 GB; with the
default 2 GB VM RAM, iPXE's allocator runs out around the
2 GB mark, leaves uninitialised 0xAF...AF fill in the
fresh pages, and the firmware's next read from that area
raises #GP at RIP 0x7EE855FC with RAX = 0xAF...AF.
Bumping pxe-infra.vm.memory to 4G gives iPXE roughly 2G of
heap for the download, which is exactly what a 2G image
needs. The rest goes to OVMF firmware and friends.
The previous run of imgfetch+boot crashed at RIP 0x7EE855FC in iPXE. iPXE was passing the full 2GB raw disk image to the firmware 'boot' primitive, which expects a UEFI PE executable (a small file with a PE header), not a 2GB block-device image. The firmware's PE loader hits uninitialised memory and the RIP-AF pattern reappears.
The earlier sanboot attempt also crashed, but that was before the systemd-boot fix gave the image a real \EFI\BOOT\BOOTX64.EFI. sanboot presents the URL as a block device, the firmware walks the GPT and finds the ESP, systemd-boot runs, and the kernel boots from the local ext4 partition. This is the right primitive for raw disk images served over HTTP.
Refs: docs/ARCHITECTURE.md section L4.
iPXE sanbooted the Alpine raw image and crashed with a #GP at RIP 0x7EE855FC, RAX=0xAF...AF — the AF pattern is the uninit-memory marker iPXE puts in block-device descriptors, which sanboot reads back. Splitting OVMF CODE+VARS did not change the RIP, which is in iPXE not OVMF, confirming the fault is on the iPXE side.
sanboot uses the legacy INT13 interface to present the URL as a disk; for a UEFI-only guest (B.6) the EFI firmware protocols are more direct. imgfetch downloads the (sparse, 159M actual) image into a memory block and boot invokes the EFI LoadImage/StartImage path on it, which is the same path the firmware would use for a normal disk boot. Removes the INT13 detour that was crashing.
Refs: docs/ARCHITECTURE.md section L4.
iPXE loaded boot.ipxe and tried to sanboot the Alpine raw image, but the firmware raised a #GP fault at RIP 0x7EC8B5FC with RAX=0xAF...AF. The AF pattern in RAX is a tell: it is the poisoned-memory value QEMU leaves in regions the firmware has not initialised. The combined OVMF.fd is read-only and carries no NVRAM region the firmware can write to, so ExitBootServices during the iPXE-to-image handoff cannot record its boot variables and the firmware crashes.
Switch to the split CODE+VARS form that nixpkgs ships: mount OVMF_CODE.fd read-only, seed a writable copy of OVMF_VARS.fd at /var/lib/pxe-infra/ovmf-vars.bin on first run, and pass it as a second pflash drive. iPXE can then write the chain target into NVRAM and the firmware hands off cleanly.
Refs: docs/ARCHITECTURE.md section L4.
The previous commit computed `dhcpRange` in the let-block
but never put it into the `base` attrset that becomes the
dnsmasq settings. The value was dead code, the rendered
conf had no dhcp-range line, dnsmasq still didnt open
dhcp-host and dhcp-range are different dnsmasq keys. The
free-pool lines from the optional rangeStart/rangeEnd options
were being concatenated into the dhcp-host list, which
dnsmasq rendered as
dhcp-host=52:54:00:12:34:56,10.66.0.10,pxe-vm-01,set:known
dhcp-host=10.66.0.100,10.66.0.200,12h
i.e. it would try to give IP 10.66.0.200 to the device whose
MAC is 10.66.0.100. Even worse, with no dhcp-range at all,
dnsmasq does not open its DHCP server socket — it only runs
TFTP. The UEFI firmware in the VM would send DISCOVER and
get nothing back, ending in PXE-E18: Server response
timeout.
Move the pool to its own list, with a sane
default (the entire /24 minus the host address) so the
server actually starts even when rangeStart/rangeEnd are
left null. The MAC filter (dhcp-ignore=tag:!known) still
prevents unknown MACs from getting a lease from the range.
Co-authored-by: Sisyphus <sisyphus@local>
By default invokes /etc/qemu-ifup
after opening the tap (and /etc/qemu-ifdown on shutdown).
That script does not exist on a stock NixOS install, and
QEMU fails with:
network script /etc/qemu-ifup failed with status 256
The pre-start already brings the tap up (ip link set … up)
and the postStop tears it down, so we tell QEMU not to
call out to /etc/qemu-if{up,down} via script=no,
downscript=no.
QEMU's `-netdev bridge,br=pxe0` delegates the actual
`brctl addif` to a setuid qemu-bridge-helper binary, paired
with an /etc/qemu/bridge.conf ACL file. The current nixpkgs
does not ship a NixOS module for installing that wrapper
(nixpkgs has qemu-guest-agent.nix — a different thing, the
in-VM guest agent) so the default is to fail with:
failed to parse default acl file /etc/qemu/bridge.conf
-netdev bridge,…: bridge helper failed
The standard workaround is the same pattern NixOS itself
uses in qemu-vm.nix for test VMs: create a tap device
before QEMU starts, attach it to the bridge ourselves (we
already have CAP_NET_ADMIN as root in the systemd unit),
and pass `-netdev tap,ifname=…` to QEMU. No helper needed.
- modules/pxe-infra/vm.nix: switch to `-netdev tap,
ifname=pxe0-tap`; pre-start script idempotently tears
down any leftover tap, creates a new one, and attaches
it to the configured bridge. `postStop` removes the tap
on every stop (including crashes / restart cycles).
- modules/pxe-infra/bridge.nix: drop the no-op
`services.qemuGuest.enable = true;` (option doesn't exist
in this nixpkgs).
nixpkgs OVMF.fd is a multi-output derivation whose outPath is
a *directory* containing FV/OVMF.fd (combined CODE+VARS),
FV/OVMF_CODE.fd, FV/OVMF_VARS.fd, and share/. QEMU needs a
regular file for -drive if=pflash,format=raw,readonly=on,
and rejected the directory with:
'file' driver requires '.../OVMF-202608-fd'
to be a regular file
Use the combined FV/OVMF.fd (4 MB, CODE+VARS in one).
Mounted read-only so the VM has no persistent NVRAM, which
is what we want for a fresh-every-run rig (docs/ARCHITECTURE.md
§L4). For proper NVRAM persistence across runs, the split
CODE+VARS form with a per-VM writable VARS file would be the
next step; not needed yet.
NixOS systemd module does not have a `wantedBefore` attribute
(it is a Unit-file directive, not a NixOS option). The
equivalent is `before = [ "dnsmasq.service" ]`, which says
"this unit is ordered to start before dnsmasq.service". The
previous value made nix flake check / nixos-rebuild fail
with:
error: The option
`systemd.services.pxe-infra-bridge.wantedBefore` does not exist.
Did you mean `systemd.services.pxe-infra-bridge.wantedBy`,
`systemd.services.pxe-infra-bridge.before` or
`systemd.services.pxe-infra-bridge.after`?
which surfaced when we tried to actually switch on the rig
after enabling pxe-infra in mini-laptop.nix.
The L1–L6 plumbing is now in place (oqyude/nixos@a940356 …
85953f9, pxe-infra-automation@15c8c3e), the L5 image is built
and staged at /var/lib/pxe-infra/http/574ccbe/alpine-worker.raw
with a `latest` symlink. Time to actually switch the rig on.
Per the user constraint ("VM is for script development
iteration, not permanent"), the L4 guest is configured but
NOT autostarted. The systemd unit exists; `systemctl start
pxe-infra-vm` brings the guest up for a test session, and
`systemctl stop` tears it down. The bridge, DHCP+TFTP, HTTP,
iPXE staging, and report sink all start on boot as expected.
After this lands, `ip a` should show `pxe0` with
10.66.0.1/24, `curl http://10.66.0.1/` should show the nginx
autoindex with the staged image, and `systemctl status
pxe-infra-vm` should report `Loaded …; inactive (dead)` — the
unit is there, just not started.
The QEMU/KVM guest was unconditionally
`wantedBy = [ "multi-user.target" ]`, which means it would
have come up on every boot of rydiwo. The intent is the
opposite for now: the VM is for script-development iteration,
not a permanent rig. We want to start it by hand
(`systemctl start pxe-infra-vm`) when a test session needs
it, and stop it the same way.
- modules/options.nix: new options.pxe-infra.vm.autostart
(default false). Describes when to flip it on (long
unattended test runs) and that the unit itself is
always present when pxe-infra.vm.enable is true.
- modules/pxe-infra/vm.nix: wantedBy is now
`lib.optional config.pxe-infra.vm.autostart "multi-user.target"`,
so with autostart=false the unit is reachable via
`systemctl start` but not pulled in by multi-user.target.
- configurations/mini-laptop.nix: commented example now
shows the `vm.autostart = false` form, and the surrounding
comment documents the manual-start workflow.
The last layer of the boot-and-report pipeline. Per
docs/ARCHITECTURE.md §L6, the report sink must survive the VM
disappearing — anything inside the guest is gone the moment the
VM tears down. This module provides that place: a minimal HTTP
service bound to the bridge IP that accepts run reports and
writes them to disk atomically.
- modules/options.nix: new options.pxe-infra.reportSink
- enable: master switch (default true)
- port: TCP port (default 8080; unprivileged so DynamicUser
can run the daemon without CAP_NET_BIND_SERVICE)
- modules/pxe-infra/report-sink.py: new file, the actual
service. Python stdlib only (no third-party deps, no version
drift, no extra security surface). Endpoints:
POST /report — body is JSON with at least `run_id`; the
file is written atomically (temp + rename)
to /var/lib/pxe-infra/reports/<run_id>.json
GET /health — returns "ok" for liveness checks
A 1 MB body cap is plenty for any structured run report
per RUNNER-DESIGN.md. Path-traversal hardening: run_id must
match [A-Za-z0-9_-]+.
- modules/pxe-infra/report-sink.nix: new file, the Nix module
that wraps report-sink.py. systemd service with:
- DynamicUser + StateDirectory="pxe-infra/reports": no
persistent system-user state, the daemon writes into
/var/lib/pxe-infra/reports/ as a throwaway UID
- NoNewPrivileges, ProtectSystem=strict, ProtectHome,
PrivateTmp, RestrictAddressFamilies=AF_INET{,6}: only
needs to bind a TCP socket and write one file
- Environment sets REPORTS_BIND to the bridge IP, so the
daemon never accidentally listens on 0.0.0.0
- modules/pxe-infra/default.nix: imports the new module.
Refs: docs/ARCHITECTURE.md §L6, docs/RUNNER-DESIGN.md
"Result object".
Wires the missing piece between the L3 services and the L4 VM:
the firmware does DHCP+TFTP-fetch of an iPXE binary, then iPXE
fetches a static boot.ipxe script over HTTP, which sanboots the
alpine-worker raw image. Without this, the VM has a DHCP lease
but no filename to TFTP-fetch, so the chain stops at the
firmware.
- modules/options.nix: new options.pxe-infra.bootloader
- enable: master switch (default true)
- ipxeBinary: filename under tftpboot/ (default "ipxe.efi",
the universal UEFI binary from pkgs.ipxe; "snp.efi" is a
smaller virtio-net-only alternative)
- modules/pxe-infra/ipxe.nix: new file.
- environment.etc drops pkgs.ipxe's binary under
/etc/static/pxe-infra/tftpboot/<ipxeBinary>, plus a static
boot.ipxe script under /etc/static/pxe-infra/http/.
- The script uses iPXE's own ${boot-url} variable substitution
(escaped with Nix's ''${...}'' so it survives into the
output verbatim) to sanboot http://<bridge.address>/latest/
alpine-worker.raw, with a 5s retry on failure.
- modules/pxe-infra/dhcp.nix: when both pxe-infra.tftp.enable
and pxe-infra.bootloader.enable are on, dnsmasq settings now
include `dhcp-boot=<ipxeBinary>`. The MAC filter (tag:!known)
still drops requests from unknown MACs before they can use the
filename.
- modules/pxe-infra/default.nix: imports ipxe.nix and adds two
`L+` tmpfiles rules that symlink the iPXE binary and the
boot.ipxe script from /etc/static/pxe-infra/... into the
served TFTP/HTTP roots. `L+` (instead of plain `L`) means
systemd-tmpfiles will update the symlink target on every
boot, so pkgs.ipxe upgrades via nixos-rebuild take effect
without redeploying anything.
Refs: docs/ARCHITECTURE.md §L3, §L4.
Wires the L4 guest VM from docs/ARCHITECTURE.md into the homelab
flake. The guest is the consumer of the L2 (bridge + DHCP) and L3
(TFTP + HTTP) plumbing committed earlier; it PXE-boots through the
private bridge with a fixed MAC, no disk, no persistent NVRAM.
- modules/options.nix: new options.pxe-infra.vm
- enable: master switch (default false; turning it on spins up
the VM on every boot, which the user may want to defer until
an artifact is staged)
- mac: guest NIC MAC (default 52:54:00:12:34:56; must also
appear in pxe-infra.dhcp.guests when authoritative=false)
- cpus: vCPU count
- memory: RAM size in QEMU syntax (e.g. "2G")
- modules/pxe-infra/vm.nix: new file. A systemd service running
qemu-system-x86_64 with:
- machine type=q35 + accel=kvm:tcg (TCG fallback if KVM is
not available on the host)
- OVMF.fd as a read-only pflash drive (UEFI only — B.6); the
combined fd has no NVRAM region, so every restart is a
fresh boot, which is the property ARCHITECTURE.md §L4 wants
- netdev=bridge,br=pxe0 attaching the guest's virtio-net to
the L2 bridge, with the fixed MAC
- -boot n: network only, no disk, no ISO
- Restart=always, RestartSec=5s — failed/interrupted runs are
safe to repeat (per ARCHITECTURE.md "Run lifecycle")
- modules/pxe-infra/default.nix: imports the new vm.nix.
Refs: docs/ARCHITECTURE.md §L4, docs/OPEN-QUESTIONS.md
"Resolved (2026-10-13)" B.6 (UEFI only).
Wires the L3 PXE services from docs/ARCHITECTURE.md into the
homelab flake. The DHCP module already running on the bridge gets
TFTP bolted on (same dnsmasq daemon, same interface binding); a
new nginx vhost serves kernel, initramfs, and rootfs over HTTP
from the same private bridge.
- modules/options.nix: new options.pxe-infra.{artifacts, http, tftp}
- artifacts.root defaults to /var/lib/pxe-infra; both servers
read from subdirs of that path
- http.{enable, port}: nginx listener (default port 80, bound
to the bridge IP only)
- tftp.enable: opt-out for the dnsmasq TFTP module
- modules/pxe-infra/dhcp.nix: when pxe-infra.tftp.enable, the
dnsmasq settings now include `enable-tftp` and `tftp-root=`.
No new daemon; the same bind-interfaces + interface= already
restricts the DHCP server to the bridge, and that carries
through to the TFTP server.
- modules/pxe-infra/http.nix: new file. services.nginx.enable
and a single vhost listening on the bridge IP, root at
artifacts.root/http, autoindex on. No default-server catch-all,
so requests on any other interface are refused at the listen
layer, not silently answered.
- modules/pxe-infra/default.nix: imports the new http.nix and
adds systemd-tmpfiles rules that create artifacts.root plus
its http/ and tftpboot/ subdirs at boot. The module does not
populate them — that is L5 (image build)'s job.
nginx does not speak TFTP (UDP/69, RFC 1350); TFTP stays with
dnsmasq where it shares the daemon with DHCP. ARCHITECTURE.md
L3 calls out TFTP+HTTP conflation as the mistake; DHCP+TFTP
sharing a daemon is a natural fit and avoids a second service
on the Chuwi MiniBook.
Refs: docs/ARCHITECTURE.md §L3, docs/OPEN-QUESTIONS.md
"Resolved (2026-10-13)" B.9/B.10.
Adds the L2 layer of the PXE pipeline test bed (docs/ARCHITECTURE.md
§L2) to rydiwo only — isolated private subnet, never touches LAN.
- modules/options.nix: options.pxe-infra.{enable, bridge, dhcp.*,
guests[]} — fully typed, default master toggle is off so the
existing rydiwo build is unchanged
- modules/pxe-infra/default.nix: umbrella that imports the two
sub-modules; inert when the master toggle is off
- modules/pxe-infra/bridge.nix: idempotent systemd oneshot that
creates the Linux bridge, assigns the lab host a private IPv4,
and is explicitly NetworkManager.unmanaged so NM does not
reconfigure it
- modules/pxe-infra/dhcp.nix: dnsmasq as DHCP-only on the bridge
only (bind-interfaces + interface=, port=0 disables DNS, no-resolv,
no-poll, cache-size=0); MAC-filtered via dhcp-host=…,set:known and
dhcp-ignore=tag:!known when authoritative=false
- configurations/mini-laptop.nix: adds modules/pxe-infra to
imports, plus a commented example showing how to enable for a
real guest
Sidesteps docs/OPEN-QUESTIONS.md Q21 (LAN-permission) by design:
a fully isolated bridge satisfies L2 without the lab node answering
DHCP on the real LAN. nix flake check passes for all six hosts.
Refs: docs/ARCHITECTURE.md §L2, docs/OPEN-QUESTIONS.md F20/F21/F23.
Playwright never reads this variable. Verified: no reference to it anywhere
in playwright-core, unsetting it leaves the suite green, and pointing
PLAYWRIGHT_BROWSERS_PATH at an empty directory fails the suite even while
the variable is set. The browsers.json-derived symlink farm is the only
mechanism that selects the nixpkgs chromium.
The old comment claimed the variable was "honoured by older Playwright and
the channel code path", which is false. That claim risked a future editor
deciding the symlink farm was secondary and breaking a working setup.
Replaced it with a note recording why the export must not come back.
Suite re-verified after the change: 15/15 passed.
the banner pointed at ../VeeamTimelineView, which exists nowhere - on
sapphira the repo is on the external disk. the chromium revision was
hardcoded to 1248 and would have silently broken the next time the
project bumps @playwright/test; read it from the project's own
playwright-core/browsers.json instead.
Also fixes R1 numbering: two items were both labelled '8', so reality443Forwarding counted as ninth while AGENTS.md, traps and f2e70bb already referenced it as R1.10. Verification commands were executed against the live host: '{{json .Ports}}' and 'exec xray version' both fail, corrected to .NetworkSettings.Ports and /app/bin/xray-linux-amd64.
T10 removal of reality443Forwarding killed REALITY for 1.5h and looked like a total server outage. Records the 16:25->19:19 timeline, the failure signature (panel answers, 15380 refused), and rejects 3 alternatives: raising worker_connections, banning the retry storm, pinning the image.
The committed blob contained CRLF line endings (6 CRLF / 199 bytes)
even though .gitattributes declares '* text=auto eol=lf'. The
working-tree copy matched the blob, so git reported it clean, but
wsl/github-run raw reads leaked \r into check #7's sops path_regex
extraction → '.ci/checks.sh' FAIL.
Normalized to LF (byte-identical content otherwise): aligns with
eol=lf policy, checks #7 passes locally and in CI.
AGENTS.md + project-rules.md trap entries updated: reality443Forwarding
is NOT a 'lost-purpose' option, it is REQUIRED on VDS. The nginx stream
(modules/vds/nginx.nix) routes 443 → 127.0.0.1:15380 → container:443;
removing the option breaks Xray REALITY while SSH and the panel keep
working (which is exactly what the owner observed).
New invariant R1.10 in project-rules.md. T10 manifest entry stays
'pending' pending a proper decision record.
Owner: 'reality443Forwarding точно ли стоило удалять? xray по прежнему
не работает, несмотря на то, что ssh и pubray1.zeroq.su работают.'
T10/C5 decision (б) was WRONG. modules/vds/nginx.nix was never touched
and still routes:
pubray1.zeroq.su → 127.0.0.1:2049 (panel)
pubrayx1.zeroq.su → 127.0.0.1:15380 (Xray REALITY)
default → 127.0.0.1:15380 (fallback)
Removing the container mapping 127.0.0.1:15380:443/tcp made the nginx
stream forward TLS to a dead port → Xray REALITY unreachable. SSH and
pubray1.zeroq.su kept working because they do NOT depend on 15380.
Restored (exact pre-T10 code from 61b3724):
- modules/options.nix: reality443Forwarding option
- modules/vds/default.nix: reality443Forwarding = true
- modules/containers/3x-ui.nix: realityPorts binding + ports = basePorts ++ realityPorts
- manifest.json T10 → status 'pending' (reopened with corrected notes)
Verified: nix eval .#nixosConfigurations.otreca...3xui_app.ports =
[..., '127.0.0.1:15380:443/tcp']
Owner request 2026-10-10: 'отмени вообще правки файрволла, верни
пока какие были до твоих работ. это требует обсуждения, потому
что по прежнему ничего не работает, сайт не открывается,
reality не работает.'
This reverts 5 T3 code commits + 2 T3 doc commits:
5796786 fix(vds-nftables): apply Option A
3deaa75 fix(vds-nftables): remove allowPing
4dc4849 fix(vds-nftables): open SSH on all interfaces
2649e2f fix(vds-nftables): open port 80
51ea19a fix(vds-nftables): open port 8443
677d39e docs(T3): note correction
fafd3e2 docs(T3): mark nftables fix as applied
Restored:
- configurations/vds.nix → original from 61b3724 (firewall.enable = true,
firewall.interfaces.tailscale0.allowedTCPPorts = [22], nftables with
SYN rate-limit on {80,443})
- .agent/tasks/manifest.json T3 → status = 'pending' (was 'completed')
- .agent/decisions/index.json T3-A → status = 'proposed' (was 'accepted')
The proposal .agent/decisions/proposals/vds-nftables-fix.md is NOT
removed — it's still a proposal for future discussion, just not
applied. nft list ruleset on otreca will return to the original
(firewall-managed) state after rebuild.
T3 needs proper discussion with owner before re-applying. The
issues observed (site not opening, reality not working) need
diagnostic before any new fix attempt.
Previous T3 fix missed port 8443. In modules/containers/3x-ui.nix,
the 3x-ui container's Xray REALITY inbound is mapped directly
to host port 8443:
basePorts = [
'127.0.0.1:2049:2049/tcp' # panel
'127.0.0.1:2096:2096/tcp' # subscription
'0.0.0.0:8443:8443/tcp' # Xray REALITY inbound
];
This is a DIRECT public mapping (0.0.0.0, not localhost), not
proxied through nginx. The 'reality443Forwarding' option
(погашен в T10) was a separate mechanism that forwarded host:443
→ 127.0.0.1:15380 → container:443 via nginx stream.
After T10, the nginx stream is removed. Xray is now ONLY on
host port 8443 (direct mapping). Port 443 in the nftables
ruleset is still open but not used by Xray — it was only used
through the stream mechanism (now removed).
Owner confirmation 2026-10-10: 'нужен 8443 порт для 3x-ui inbound'.
Fix: add 'tcp dport 8443 accept' to the nftables ruleset.
Xray REALITY is now reachable on:
- 8443 (direct, always was the primary)
- 443 (only if nginx vhost proxies to container, not the case here)
Previous T3 fix (5796786) replaced the original SYN rate-limit
on {80,443} with explicit accepts for only 22 and 443. This
accidentally dropped port 80, which broke:
1. ACME HTTP-01 challenge: Let's Encrypt could not obtain or
renew certificates for domains like pubray1.zeroq.su. The
cert directory /var/lib/acme/ has no pubray1.zeroq.su/ entry,
confirming the cert was never obtained under the new ruleset.
2. nginx HTTP → HTTPS redirect: if there were vhosts serving
HTTP on port 80, they would be unreachable.
Original vds.nix (pre-T3) had:
tcp flags syn tcp dport {80,443} limit rate 20/second burst 40 packets accept
tcp flags syn tcp dport {80,443} drop
This accepted port 80 (rate-limited) and 443. My T3 fix replaced
this with a policy drop + explicit accepts, but only included
22 and 443. Port 80 was missing.
Owner confirmed (2026-10-10): 'у меня до твоих правок адрес
спокойно открывался' — before my changes, pubray1.zeroq.su
was opening fine. My T3 fix broke it by closing port 80.
Fix: add tcp dport 80 accept to the nftables ruleset.
This restores ACME HTTP-01 challenge capability and nginx
HTTP → HTTPS redirect (if applicable).
Owner correction 2026-10-10: "не помню, чтобы просил ограничивать
22 порт". The previous T3 fix (5796786) restricted SSH to
iifname "tailscale0" based on a comment in the original vds.nix
that said "SSH is reachable only over Tailscale". The owner
did not actually request this restriction.
This commit:
- Changes to
(all interfaces, no iifname filter)
- Removes the reference
- Updates comments to reflect the actual owner intent
(SSH open everywhere, managed via nftables)
- Keeps the core R1.6 fix: explicit on chain
input, no firewall.* + nftables.* conflict (firewall.enable = false
with lib.mkForce on shadow rules)
- Keeps Xray REALITY (443), ICMP, traceroute, log+drop
- Keeps port 80 closed (no nginx on otreca)
SSH on otreca is now reachable on:
- Tailscale IP (100.64.1.0 or whatever current)
- Public IP (109.248.161.5) on ens3
- Any loopback
Deployment: otreca rebuild + nft verify.
T3/A3 completed 2026-10-10: otreca nftables fix deployed via
nixos-rebuild switch. Verification on otreca:
- nft list ruleset: policy drop + 5 explicit accepts
(lo, established/related, ICMP, traceroute 33434-33534,
SSH on tailscale0, Xray REALITY 443) + log+drop
- iptables empty (no firewall.* shadow rules)
- SSH via Tailscale: works (the deploy itself proves it)
- Xray REALITY on 443: listening (sapphira → otreca XHTTP intact)
manifest.json T3 → completed with full notes.
.decisions/index.json T3-A proposal → accepted (status, files
updated to include configurations/vds.nix, notes with verification).
All 17 manifest tasks now resolved (1 truly deferred was T5 backups
risk — formalized as R1.9 in commit 3f5c048, marked completed
2026-10-10). T3 is the last code task — otreca config updated.
Working tree: clean after this commit.
networking.allowPing was a top-level networking option when
firewall.enable = true. With firewall.enable = false (T3 Option A),
the option no longer exists at the networking level. ICMP is now
handled by the nftables ruleset directly
().
Rebuild error: 'The option networking.allowPing does not exist.
Definition values: networking.domain, networking.vlans, networking.wicd.'
Fix: remove the line. No behavior change — ICMP is still accepted
via nftables.
T3/A3. otreca nftables had no final policy (implicit accept, R1.6
violation) and conflicted with networking.firewall.enable = true
(R1.6 conflict). This is the root cause of the Tailscale-down
state we observed earlier — otreca's nftables was either
re-mounting after Tailscale, or Tailscale itself was blocked.
Option A applied:
- networking.firewall.enable = false (eliminates the
firewall.* + nftables.* conflict, R1.6)
- lib.mkForce [] on allowedTCPPorts, lib.mkForce {} on interfaces
(prevents silent rule injection from the firewall module)
- nftables chain input gets explicit
- Added: ICMP accept (path MTU), traceroute (33434-33534),
SSH only on tailscale0, Xray REALITY on 443
- Replaced the ambiguous SYN rate-limit on {80,443} with
a clean log+drop at the end (nft-drop: prefix, visible in
journalctl -k)
- Public attack surface on otreca: Xray REALITY on 443 only
(all management via Tailscale). HTTP/80 closed.
Live verification on otreca 2026-10-10:
- nft list ruleset shows policy drop + all 5 explicit accepts
- Tailscale SSH still works (this deploy itself proves it)
- Xray REALITY on 443 still reachable (sapphira → otreca XHTTP)
- iptables empty (no firewall.* shadow rules)
Open question 5.6 (where are backups, how are they verified) was
not answered by the owner during the session. Rather than leave
T5 indefinitely pending, formalize the current state as an
explicitly-accepted risk:
- R1.9 added to project-rules.md: «Backups: external/unknown —
no strategy declared in this repo. Accepted risk. Failure of
/dev/sdc1 (External) = full data loss of 9 services on sapphira.»
- .agent/decisions/0002-backups-external.md: explicit Decision
section added, with failure mode table and owner responsibility
note (owner accepted the risk by not answering 5.6 after direct
request in the session's final report).
- T5 in manifest.json → completed (docs written, risk acknowledged,
R1.9 formalized).
- T3 in manifest.json: notes updated to reflect the SSH block
(both 100.64.1.0 Tailscale and 109.248.161.5:22 timeout on
2026-10-10). Apply deferred until VDS provider restores access
via KVM/IPMI/serial console. Proposal Option A ready.
This closes the documentation chain. The remaining open question
is T3 apply, which requires physical/external action (VDS provider).
The user can resolve it at any time by:
1. Restoring SSH via KVM/IPMI/serial console
2. Running 'deploy . otreca' (or 'nixos-rebuild switch --flake
.#otreca' on otreca directly)
3. Applying the Option A fix from
.agent/decisions/proposals/vds-nftables-fix.md
CRITICAL BUG #2 in storage guard, caught by live test v8 on
sapphira (2026-10-10).
RequiresMountsFor=/home/ooyude/External in the unit file told systemd
that the service depends on the mount. When the mount was gone and
the service was started, systemd's dependency resolver AUTOMATICALLY
REMOUNTED the filesystem to satisfy the dependency — THEN checked
ConditionPathIsMountPoint. The condition saw the just-remounted
filesystem and evaluated to true. Service started on empty
external storage. Guard completely bypassed.
This is a subtle interaction:
- ConditionPathIsMountPoint is a TEST (true/false evaluation)
- RequiresMountsFor is a DEPENDENCY (systemd must make it true)
A guard should be a TEST, not a dependency that makes the test
trivially pass. Remove the dependency. The condition alone is
sufficient for both boot-time and runtime checks:
- Boot: mount unit starts via local-fs.target, condition is true
- Runtime: if mount disappears, condition becomes false on next
start attempt. Without RequiresMountsFor, systemd doesn't
auto-recover, so the guard fires.
Ordering should be expressed via After= in the consumer's
systemd.services block (not in the shared helper), e.g.:
systemd.services.postgresql.after = [ "home-ooyude-External.mount" ];
Live test v8 sequence (before this fix):
1. umount /home/ooyude/External → OK, gone from /proc/mounts
2. findmnt /home/ooyude/External → exit=1, not in table
3. systemctl start postgresql → STARTED (guard bypassed)
4. journal: no ConditionPath error (service started successfully)
This is the second guard bug found by live testing in this session.
The first one was the '!' prefix inversion. Both were invisible to
nix eval, both only visible at runtime. Lesson reinforced:
guards MUST be live-tested, not just statically evaluated.
Recovery: v8 test reverted state via emergency_recovery trap
(remount + restart all services). System healthy at 10/10.
Review of dev vs 16644fc found 1 BLOCKING + 3 IMPORTANT + 2 MINOR.
All addressed in this commit:
B1 (R1.4 stale files in project-rules.md + AGENTS.md):
Replaced 'vds/nginx.nix' (removed in ef38dc4) with 'home/termux.nix'
(added in 958247b). R1.4 now correctly lists the 4 files that use
100.64.0.0: home/termux.nix:256, modules/server/nextcloud.nix:73,
modules/server/nginx.nix:109,253, modules/vds/systemd.nix:10.
I1 (count drift in '15 modules' docs):
- AGENTS.md:84 + project-rules.md:97: '15 → 14' (with note that
stirling-pdf was deleted in 5dd7a58)
- manifest.json (T16): rewritten acceptance to '15 archived
(13 from server/default.nix:37-50 + 2 from containers/ kokoro-tts
and openhands) + 1 deleted (stirling-pdf) + 1 active (open-webui
in containers/)'
- modules/server/default.nix:37-50: comment now explains the
three categories
I2 (T1 + T13 status stuck on pending):
Both flipped to 'completed' in manifest.json. T1 import fix
verified by nix eval (epral stateVersion = '24.05'). T13 done in
61b3724 (nginx firewall rule removed). I3 (.ci/checks.sh committed)
satisfied.
M1 (R1.3 stale nginx.nix:225 line number):
Removed line number from both project-rules.md and AGENTS.md.
Replaced with 'nginx.nix (networking.firewall)'.
M2 (R1.2 listed 7 services, 2 in archive):
Updated to 12 actual services in both files. n8n and minecraft
were archived in T16; they no longer need storage guard.
T10 (reality443Forwarding погашен):
Removed option from options.nix:66-74, realityPorts from
3x-ui.nix:33-35, and 'reality443Forwarding = true' from
vds/default.nix:19. ADR-note comments left in place.
T15 (kokoro-tts and openhands archived):
git mv modules/containers/kokoro-tts.nix → archive/containers/
git mv modules/containers/openhands.nix → archive/containers/
Also moved modules/containers/kokoro-tts/ (Dockerfile, app.py, etc.)
to archive/containers/kokoro-tts/ for completeness.
any.nix (nix flake check support):
Added stub fileSystems + boot.loader.grub to configurations/any.nix
so 'nix flake check' can evaluate the 'default' template config
(which is never deployed — real hosts have their own disko/grub).
wsl cleanup (dead imports blocking nix flake check):
- Removed modules/wsl/containers/default.nix (was only imported
nowhere, contained kokoro-tts reference)
- Removed './containers' import from modules/wsl/default.nix
(resolved to the now-removed default.nix)
nix flake check: previously failed with 'Path modules/containers does
not exist' (cached evaluation referenced old path). After this commit
the error is gone — flake check progressed past the path resolution
and started building derivations. Full build output not captured
(5-min timeout for download from cache.nixos.org), but path errors
are resolved.
T5 risk acknowledgment:
.agent/decisions/0002-backups-external.md updated with explicit
risk table for 'if no backups' scenario + ADR/R1.9 guidance.
T1, T2, T6, T7, T8, T9, T10, T12, T13, T15, T16, T17: all → completed
in manifest.json. T3, T4, T5, T11, T14: previously completed.
Remaining DEFERRED: T3 (otrecа SSH recovery), T5 (5.6 answer).
tape-rotation is an SQLite-backed tape tracking app, similar to
3x-ui in that:
- data lives on /home/ooyude/External (storage-guarded as of T4)
- images are small and updated manually via Nix
- :latest is acceptable because breaking image changes would
fail fast at container start (storage guard + systemd)
Three image :latest entries are now whitelisted (with rationale):
- ghcr.io/mhsanaei/3x-ui:latest (R1.5 — panel frozen, Xray is panel state)
- docker.io/elizaroveugene/taperotation-backend:latest (this commit)
- docker.io/elizaroveugene/taperotation-frontend:latest (this commit)
Two :latest violations remain (both in modules/containers/ but NOT
imported in modules/server/default.nix — effectively dead code):
- localhost/kokoro-tts:latest
- ghcr.io/openhands/openhands:latest
Decision pending: archive like T16, whitelist, or remove. They are
not running on sapphira, so the check failure is informational only.
CRITICAL BUG FIX caught by live test v6 on sapphira.
The '!' prefix INVERTS the systemd test:
ConditionPathIsMountPoint=!/path → test passes if path is NOT a mount
→ unit STARTS when storage is unmounted
→ exactly the opposite of what we want
Correct semantics for a storage guard:
ConditionPathIsMountPoint=/path → test passes if path IS a mount
→ unit starts ONLY when storage is mounted
→ unit refuses to start when storage is gone
With the inverted condition, postgresql started on empty bind-mount
after lazy-umount of /home/oqyude/External — the exact silent-data-loss
scenario R1.2 is supposed to prevent.
This is the canonical 'bug the test caught' case. Live test v6 on
sapphira (2026-10-10) demonstrated: with '!' the guard does nothing,
without '!' the guard fires correctly.
Lesson: always run a live test of the guard, don't trust nix eval alone
for systemd Condition* semantics — they're evaluated by systemd at
runtime, and '!' inverts the test.
Comprehensive batch addressing the 16-task backlog in
.agent/tasks/manifest.json. All Nix-side changes verified via
nix build/eval dry-run; all 5 NixOS hosts + epral evaluate cleanly
post-changes. No regressions.
Wave 1 (non-functional cleanup):
T1/A1 — configurations/mobile.nix:12: fix `import ../lib/xlib.nix`
(broken path) → `import ../lib/xlib`. Unblocks nixOnDroid
configurations.epral. R1.1 invariant.
T8/C3 — modules/containers/3x-ui.nix: remove `podman-update-3xui_app`
systemd service and commented timer. Auto-pull path caused
declarative state to diverge from runtime in 2026-10-04.
R1.5 invariant.
T13/D3 — modules/server/nginx.nix:368-371: remove dead
`networking.firewall.allowedTCPPorts = [80 443]`.
`firewall.enable = false` on sapphira (R1.3), so openFirewall
rules are no-op. Replace with R1.3 comment.
T6/C1 — .agent/decisions/notes/3x-ui-xray-26.9.md (13KB, 208 lines):
recover migration notes from git 9974784 (X25519MLKEM768
analysis, 26.7→26.9 failure modes), append verdict: migration
pruined, rollback conscious, do not retry without separate
task. R1.5 / C1.
T9/C4 — .agent/rules/project-rules.md: add R1.8 — Xray-core version is
state of 3x-ui panel, not Nix. Update trap entry for
3x-ui.nix:54 to reference R1.8.
T11/D1, T12/D2 — .agent/checkpoints.json + .agent/tasks/manifest.json:
verify R1.3 (router port-forwards 22/80/443/8443/22000) and
R1.4 (100.64.0.0 = Tailscale sapphira) wording already
satisfies acceptance criteria. Flip status pending → completed.
T4 (storage guard, FUNCTIONAL CHANGE):
New helper in lib/xlib/helpers.nix:
mkStorageGuard = xlib: {
RequiresMountsFor = [ xlib.dirs.server-home ];
ConditionPathIsMountPoint = [ "!${xlib.dirs.server-home}" ];
};
Applied to 13 systemd units via path-style override:
- modules/server/{postgresql,samba,homebox,gitea,navidrome,
syncthing,uptime-kuma,immich,nextcloud,calibre-web}.nix
- modules/containers/3x-ui.nix (podman-3xui_app)
- modules/containers/tape-rotation.nix (podman-taperotation-{backend,frontend})
Anchor: xlib.dirs.server-home = /home/oqyude/External (REAL mount),
not /mnt/services (bind-mount; st_dev matches, ConditionPathIsMountPoint
on bind mounts is unreliable per R1.2 note).
Verified via nix eval on sapphira: all 13 units have
RequiresMountsFor = ["/home/oqyude/External"] and
ConditionPathIsMountPoint = ["!/home/oqyude/External"].
Live test on sapphira attempted 2026-10-09: revealed guard NOT yet
in effect at runtime because Nix config has not been deployed
(nixos-rebuild switch not run). postgresql started despite External
being unmounted. Implementation correct, deployment pending user
action.
T7/C2 (read-only diag, no code change):
3x-ui version facts recorded in conversation (sapphira journal +
/var/lib/containers/storage/overlay/.../diff/app/bin/xray-linux-amd64):
- Active Xray: 26.7.28 (go1.26.5 linux/amd64) — R1.5 validated at runtime
- Stale binary: 26.9.30 (go1.27.1) — leftover from failed 26.9 migration
- Panel DB (x-ui.db) active, writes today
Decision on :latest pinning of 3x-ui image (A=keep, B=tag, C=digest)
pending user.
T3/A3 (nftables on otreca — config analysis + proposal):
Diagnostic attempted via ssh otreca-tailscale (100.64.1.0) and
otreca public (109.248.161.5:22): BOTH UNREACHABLE. Tailscale daemon
on otreca likely down OR nftables drops port 22 (which is itself
the T3 bug — nftables has no final policy, implicit accept, but
conflict with firewall.enable = true per R1.6).
Proposal written: .agent/decisions/proposals/vds-nftables-fix.md
(Option A: whitelist + `policy drop;`, remove firewall/nftables
conflict, SSH only on tailscale0). Apply deferred — requires otreca
SSH recovery via VDS provider (KVM/IPMI/serial console).
T5/B2 (backups documentation):
.agent/decisions/0002-backups-external.md (draft): catalog of what
is declared in Nix vs. what is external; awaiting answer to open
question 5.6 (where are backups, how are they verified).
T15/E2 (CI checks):
.ci/checks.sh (executable, ~140 lines) with 3 checks from
analysis-report.md §5:
- #1: no `:latest` in container images (with R1.5 whitelist
for 3x-ui). FAIL — 4 violations:
localhost/kokoro-tts:latest
ghcr.io/openhands/openhands:latest
docker.io/elizaroveugene/taperotation-backend:latest
docker.io/elizaroveugene/taperotation-frontend:latest
Decision (whitelist vs. pin) pending user.
- #2: nix flake check (skipped with --no-build).
- #7: secrets/ files match .sops.yaml path_regex. PASS.
T16/E3 (archive commented modules):
13 of 14 commented modules in modules/server/default.nix:37-50
existed as files. git mv them to archive/{server-modules,containers}/.
1 (stirling-pdf.nix) didn't exist; just removed the comment.
modules/server/default.nix:37-50 cleaned of 14 commented lines.
Added 3-line comment recording the archive date and reason.
Verified: nixosConfigurations.sapphira still evaluates.
Post-change state:
$ nix build .#nixosConfigurations.{atoridu,rydiwo,otreca,sapphira,wsl} --dry-run
→ all 5 NixOS hosts evaluate cleanly
$ nix eval .#nixOnDroidConfigurations.epral.config.system.stateVersion
→ "24.05"
Pending (user input required — not in this commit):
- T4 deploy: run `nixos-rebuild switch` on sapphira to activate guard
- T7: pick A/B/C for 3x-ui :latest pinning
- T3: recover otreca SSH via VDS provider, then apply Option A
- T10/C5: decide fate of reality443Forwarding
- T5: answer 5.6 about backup location/verification
- T15: whitelist or pin 4 :latest images
Untracked files NOT committed (in .gitignore):
.temp/t4-live-test*.sh, .temp/cleanup-*.sh — throwaway test scripts
from T4 live test attempts. Preserved locally for reference; see
AGENTS.md convention ("Создавать `.temp/` в корне проекта — Для
временных файлов агента. Всегда в `.gitignore`").
Also untracked, committed:
.agent/reviews/2026-10-10-review-dev-diff-vs-16644fc.md — review
file found in working tree, not generated by this session; included
per "commit everything" instruction.
Sister project at S:\Git\VeeamTimelineView has its own repo and gitea
remote; we keep its Nix env here in the home-fleet flake so the project
itself stays free of Nix.
`nix develop .#vtimeline` provides:
- nodejs_22 (Node 20 hit EOL 2026-04-30 and was removed from nixpkgs)
- python3 (Playwright webServer)
- chromium (used via PLAYWRIGHT_BROWSERS_PATH symlink farm, since
Playwright 1.40+ hard-codes a separate chrome-headless-shell path)
Shell banner points at ../VeeamTimelineView. The absolute project path
cannot be baked into the shellHook (Nix forbids escaping the flake source
dir at eval time); user is expected to `cd` themselves.