liminix

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 9cb02eca9ab870a532c207a014152c61580257cb
parent f8bc6baa06c64048642bb838ae4283174c02d8c5
Author: Daniel Barlow <dan@telent.net>
Date:   Sun, 29 Nov 2026 20:33:32 +0000

think

Diffstat:
MTHOUGHTS.txt | 230+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 230 insertions(+), 0 deletions(-)

diff --git a/THOUGHTS.txt b/THOUGHTS.txt @@ -9317,3 +9317,233 @@ target/linux/ramips/dts/mt7620a.dtsi: compatible = "ralink,rt7620-wifi tl;dr the newer openwrt changed the compatible name [ wrote a blog post about this ] + +Tue Nov 17 19:35:06 GMT 2026 + +the omnia doesn't boot, because something in the generated bin/install triggers +cp: can't stat '../nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/*': No such file or directory + +probably we should have a test for this if we can get qemu to behave +sufficently similarly. it will depend on u-boot config, but let's +assume they're both pretty close to u-boot mainline + +$ nix-store -q --tree /nix/store/wld78c2vkxnhpsa21fxsbn3lri7kgc50-system-configuration-armv7l-unknown-linux-musleabihf| grep extlinux +├───/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux +│ ├───/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux [...] + +so it's in the closure and min-copy-closure should have dealt with it + +what does install do + +prefix=/ +src=${prefix}$out # /nix/store/wld78c2....-system-configuration-armv7l-...ihf +dest=/${prefix} # / +dest=/persist # because it exists +cd $dest +cd boot +cp ../${lib.strings.removePrefix "/" attrset.boot.target}/* . # /persist/nix/store/yj.../* + +so it seems like it ought to work, except for the detail that extlinux.conf +is in a subdirectory, but that shou;d produce a different error message + +/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/ +/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/kernel +/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/initramfs +/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/dtb +/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/extlinux +/nix/store/yj452vhyzzvrcg71prlblj4b0g5lalrh-extlinux/extlinux/extlinux.conf + +----- +in omnia recovery, mmc mounted on /dest + +# cd /dest/@ +# ls -l +lrwxrwxrwx 1 64 init -> /nix/store/9bki00nq8zfapzb1h67r78q533kasgpi-s6-init-bin/bin/init +-r-xr-xr-x 1 3239 restart-services +lrwxrwxrwx 1 51 boot -> nix/store/2pqnx4bcp76ng5fidw604hs9ysczhf9f-extlinux + +eh what? + +am slightly at a loss for how that ended up like that + + + +- need a qemu that boots u-boot so we can check the environment +- need to hook the omnia serial back up and make sure it's the same +- need a qemu-with-u-boot ci test that uses extlinux + + + + +there is a manual (non-CI) test +NIX_PATH=nixpkgs=/home/dan/src/unstable-nixpkgs ./tests/min-copy-closure/test-liminix-rebuild.sh + +but it's broken, I think because rebooting qemu just causes it to exit + +Tue Nov 17 23:53:33 GMT 2026 + +outputs.updater update.sh script should accept a rootdir name (e.g. /dest/@) + + + +PATH=$(echo /nix/store/*-up-tree*/bin):$PATH +s6-rc-up-tree certifix-C=GB-ST=London-O=Telent-OU=devices-CN=rotuer + + +Wed Nov 18 18:39:32 GMT 2026 + +it's really fucking flakey and I have the sads + +some subset of services don't come up on boot because certifix-client +is started too early, before the lan interfaces have been added to the +bridge. Some/all/none of the ports may have things plugged in, but we +need at least one. + +Ideally we would model "certifix.lan is reachable" as an event which would trigger +the csr and the service tree hanging off it. note this is oneshotty - if +certifix.lan later becomes unreachable again after the cert is gained, we +don't need to stop the tree + +(similar mechanism could be used for "loghost.telent.net is reachable" +except then we _do_ want to down the tree if it later stops being reachable) + +aside: ifwait service is essentially a controller in that it +starts/stops another service. do we treat it consistently with the +other controllers? + +answer: no we do not have consistency +* for bridge members, we have a svc.ifwait(running) for each port +* for links, vlans, and bridge controllers we call liminix.networking.ifup + directly + +if we're going to town on controlled services/hotplug like this we +need a way for the operator to see the state of all the controller +services, otherwise it'll be too hard to figure out why something +isn't running. That might be an output for each; we also need a way +to enumerate them + + +more generally, we have different kinds of "A depends on B": + +1. A's lifecycle is tied to B's lifecycle (or readiness) +2. A subscribes to B's outputs +3. A depends on B's health + +[note this is conflating different things: + +- what property of B is depended on by A - is it its presence, or an output, or ... +- what happens when that property appears/disappears/changes - + - start a service, stop a service + - run a command + - signal a process (which presumably is managed by a service) + +A has conditions for whether it can be running and it has inputs for +what it does _while_ it's running. e.g. the dhcp watchers which +change interface addresses and routes when the new lease is renewed + + +We use s6-rc for case 1, we use anoia service watcher for 2 (A must be +a fennel script, or wrapped in one - e.g. using secrets subscriber, or +the watch-outputs script it wraps). For 3, we can use svc.health-check +which periodically executes an arbitrary command and uses s6-svc to +restart the daemon that provides a service if the command fails too +much. Note it does not control the tree, only the process itself - +but this works OK in practice I think because if the daemon did +actually rely on the thing then it will fail to restart and then the +service will go down and it's up to s6-rc to restart it + +There's also svc.uevent-rule, which talks to devout and can start/stop +services depending on the presence of state in sysfs that matches a +query. It doesn't use outputs (some sysfs queries proved to be more +complicated than "does a file exist at this path", we'd have to add a +query interface for the output watcher if we wanted to unify these) + +Note that every dependency mechanism _other_ than the native +dependencies in s6-rc is leveraging s6{-rc} services for the actual +supervision and process management, whenever the nature of B's +reliance on A involves actually stopping it. (sometimes it doesn't - +sometimes we just need to communicate with the running process - e.g +by sending signals) + + + + +With uevent-rule we were quite insistent that the model is _state_ not +_events_: the service is up when the state is present/the query is +true. This doesn't quite sit with our one-shot certifix csr as +described above: once we have an in-date certificate we don't need the +network any more + +... but it's not really a oneshot because the certificate will expire +eventually, it's more like a cron job/periodic service. It's a +service whose output is an in-date certificate, but its implementation +is a scheduled task that is active when (too long since the last one) AND +(certifix.lan is reachable) + +=> run certifix-client when the state is + (certificate missing or soon to expire) && (server is reachable) + +how often should we check the run condition? + +what if we had a scheduler service that we could instruct "start +date-after-t1 service if the time is after T1" and a reachability service +"start certifix-online if I can ping certifix.lan" and the csr service +depended on both of them? + +* watch-csr-needed service periodically checks absence or age, starts csr-needed as + appropriate. note this means it's watching the output of a service that + it's part of the control system for, is that unpleasantly circular? + or is this just the nature of a feedback loop? + +* watch-certifix-online checks reachability. starts certifix-online when true + +* certifix-client service depends on both + +There is no short-circuit +evaluation of s6-rc dependencies (I think), so we would be pinging +certifix.lan even when we have no need to use it + +Fri Nov 27 17:12:03 GMT 2026 + +What did all that mean? Can we extract anything useful? + +* should we make links and vlans use the ifwait service controller? probably yes + +* we could have a controller service that starts/stops certifix-client-ensurer + when certifix.lan is reachable. certifix-client should itself run a loop + so that certs get refreshed before they expire + + - if we lose connection to certifix.lan does that mean we erase the certificate? + it wouldn't be horrendous if we did, as everything we use the cert for is + also on the same network + +* _or_ we could have a timer service that starts the certifix-client + oneshot every three months; the certifix-client service itself could + depend on a service that checks certifix.lan is reachable. + + this would mean the system isn't fully up if certifix (and by extension, + everything that needs it) is down, is that bad? + + we have nothing yet in liminix that looks like a timer service, this would + be the first + +* we could put the cert in /persist so that we don't have to do this + every boot. that would make booting faster but it would also mask the problem + +* we added timeouts on longruns because it was otherwise impossible to + shutdown because the services for unplugged lan switch ports never + came up so s6-rc sat there going "not reached stable state yet". + Probably the timeout could be a lot longer, which wouldn't fix this + issue but it would paper over it + +the certfix service depends _either_ on the cert existing and +unexpired _or_ on connectivity, and this kind of dependency is not +expressible using s6-rc. + +Sun Nov 29 14:19:01 GMT 2026 + +the pragmatic approach + +- certifix-client up script to wait for the reachabilty of certifix.lan +- check it signals readiness +- increase the timeout to ~ 5 minutes