about summary refs log tree commit diff
AgeCommit message (Collapse)Author
5 daysdaemon: make the log directory configurable (--log-dir / GUIX_CONTAINER_LOG_DIR) HEAD masterPjotr
/var/log/guix-containers was a #define, and the daemon read no environment variables at all, so a host whose /var/log is read-only -- or anyone running the daemon outside a system-wide install -- had no way to keep container boot output except to edit and rebuild the C. It is now a runtime value: the flag wins, then $GUIX_CONTAINER_LOG_DIR, then the old default, and all three uses (the mkdir, the .writable probe, the per-container <name>.log path) go through it. The chosen directory is named at startup ("container logs: DIR") before the privilege check, for two reasons: it is the first thing an operator needs when a container does not come up, and it makes the switch observable without root, which is how test/run.sh now checks it -- --log-dir and the env var each have to appear in that line, and an unknown option still has to print the usage. README: documents the flag and the variable, says which wins, and points ProtectSystem=strict users at --log-dir as the alternative to LogsDirectory=. Also generalises one line that said "uid=1000(wrk)" -- true of the author's box, misleading on anyone else's -- to "your own uid, e.g. uid=1000".
5 daysREADME: a worked example for service containers, and a licencePjotr
The README explained the protocol, the fingerprint, the privileges and the privilege boundary well; what it did not have was the sequence for the case people actually hit -- a container whose services the host then talks to. New section "Worked example: a service container other programs talk to": --network shares the host's network namespace so container services are at 127.0.0.1:PORT on the host (and why that is not the daemon's --port); build the launcher with `guix system container -d` + `guix build` before letting the daemon start it, because `guix system container` builds *and* runs in the foreground; and the trap that bit during a real test -- a `--share` whose host path does not exist is dropped silently, so create it first. Plus the two timings worth having: a container is at its services ~2 s after START when the store paths are built, ~45 s on first boot while activation generates keys and lays out spool directories, so a client that gives up after a few seconds is measuring the wrong case. Boot output is where to look: LOG/--log, or /var/log/guix-containers/<pid>.log subject to the unit's LogsDirectory. LICENSE is now BSD 3-Clause (Copyright (c) 2026 Pjotr Prins), the same text as ai-memory's, and the README ends with a pointer to it.
2026-10-19daemon: refuse to start without CAP_SETUID/CAP_SYS_ADMIN; check log dirPjotr
Started as a normal user the daemon happily answered "OK <pid>" to every START and then forked a launcher that died within milliseconds (EPERM writing /proc/PID/uid_map), leaving the client with an empty LIST and, because /var/log was not writable either, no log to explain it. Check privileges at startup instead of warning: euid must be 0 and CapEff must carry CAP_SETUID (the 65536-entry uid map of the container's user namespace) and CAP_SYS_ADMIN (mounting its file systems, /proc and /dev); exit 1 with an error naming the missing piece -- this also catches root under a narrowed CapabilityBoundingSet=. Container boot output goes to /var/log/guix-containers: warn when that directory cannot be created or written (read-only /var, hardened unit) so the missing log is noticed at start-up rather than while debugging a failed boot. The hardened systemd example in the README was the cause of exactly that -- ProtectSystem=strict makes /var read-only -- so it now sets LogsDirectory=guix-containers, and a new "Privileges required" section documents the requirement. test/test.c gains test_privileges() (CapEff parse, root/non-root verdict); ./test/run.sh still passes.
2026-10-02docs: drop hardcoded factory path in key commentsPjotr
2026-09-28doc: why the privileged daemon exists, plus the rootless alternativePjotr
Document the privilege boundary that motivates the daemon (guix system container needs real root: namespaces, CAP_NET_ADMIN, root shepherd; AppArmor fixes do not change that) and the verified rootless fallback: guix shell -C works from an unprivileged account when user namespaces are allowed and an explicit writable profile path is used (-p); no shepherd/sshd/guix-system services inside, but foreground daemons (nginx/php-fpm/octave) run fine for smoke tests. Also note the unprivileged guix-daemon (builds only), rootless Podman and PRoot alternatives.
2026-09-27doc: list the BNW container and VM deploymentsPjotr
2026-09-27vms: move hello-vm.scm from services/ to vms/Pjotr
VM definitions are not services; give them their own directory. The ../etc key reference still resolves from vms/.
2026-09-27services: slim down the hello-vm package setPjotr
Replace (cons hello %base-packages) with an explicit minimal list: bash, coreutils, findutils, grep, sed, gawk, tar, gzip, shadow, procps, guile and hello. %base-packages would add ~400 binaries to /run/current-system/profile/bin (nano, man-db, sudo, the inetutils ftp/telnet, wget, pciutils, ...). The ssh tools still come in via the openssh service and 'herd' via the essential shepherd service; the (useless) guix service is deleted from %base-services like in the containers. Also fix a list-building bug: (cons* ... hello) makes hello the TAIL of the list, so use 'list'. Result: profile/bin has 185 binaries (was 394) and the image store holds 263 items (was 362). Verified: ssh login, hello, and 'herd status ssh-daemon' all work.
2026-09-27services: add hello-vm.scm, a self-contained VM imagePjotr
Unlike 'guix system container', which bind-mounts the WHOLE host /gnu/store read-only into the guest (hardcoded %store-mapping in gnu/system/linux-container.scm -- there is no supported way to mount a subset), a qcow2 disk image built with 'guix system image -t qcow2' contains only the closure of the system: the guest sees ~360 store items instead of the host's 51815 and no host file systems at all. The definition is the minimal hello+ssh OS with %qemu-static-networking (QEMU user-mode network stack) and a serial console on ttyS0. Host SSH keys are generated at first boot and persist in the writable image, so they need no pinning. Verified: booted under qemu-system-x86_64 (TCG), ssh on forwarded port 2223 works with etc/hello-container-key, 'hello' runs, and the guest /gnu/store lists 362 items.
2026-09-27List containersPjotr Prins
2026-09-27services: pin the SSH host key of the containersPjotr
Each container build generated fresh host keys (ssh-keygen -A at activation), so clients saw a REMOTE HOST IDENTIFICATION HAS CHANGED warning after every rebuild. Install the pre-generated ECDSA host key from etc/ssh-container-key into /etc/ssh at activation and set (generate-host-keys? #f) so every container presents the same host key. All keys now live in etc/ -- move the hello-container client key there as well and reference ../etc/ from the OS definitions. Verified: a rebuilt container serves SHA256:udYFFCT57uEdY1wDQgs8mvrB Vl2BLrq227eMSons2Mo and ssh login works with hello printing 'Hello, world!'.
2026-09-27services: split hello-container into minimal and debug variantsPjotr
hello-container.scm is now bare bones: hello + %base-packages, root user and the openssh service (key-only root login, password fallback "hello"), the /var/empty activation sshd needs, and the no-op sysctl/udev shepherd services that keep a container boot from hanging. The fingerprint activation and the DBG2 monitor loop moved to the new debug-container.scm (host-name "debug-container"). The explicit root account needs (uid 0): without it operating-system-accounts cannot recognize it and prepends its own default root, producing 'accounts appear more than once: root'. Both definitions pass 'guix system container --network --dry-run' (--network is required for ssh-daemon's 'networking' dependency). The minimal container boots and serves ssh on port 2222: hello runs over ssh with EXIT=0 and herd reports ssh-daemon started.
2026-09-26run-guix-system-container: detect stray container shepherdsPjotr Prins
Killing a container launcher with kill -9 (or an old daemon doing so) leaves the container's shepherd (PID 1) alive, still holding e.g. the sshd port, and invisible to LIST. pid_is_container now also matches 'bin/shepherd --config ...-shepherd.conf', so KILL can remove strays and LIST reports them.
2026-09-26run-guix-system-container: KILL the whole container process groupPjotr Prins
The launcher setsid()s, so the container's shepherd (PID 1) and all its services live in the launcher's process group. Killing only the tracked launcher pid left the shepherd running -- holding e.g. the sshd port and making the next START fail to bind. KILL now SIGKILLs the process group (-pid); daemon shutdown likewise SIGTERMs groups and SIGKILLs survivors.
2026-09-26run-guix-system-container: KILL sends SIGKILLPjotr Prins
Containers that hang at boot (e.g. blocked on entropy) ignore SIGTERM; kill -9 them instead.
2026-09-26run-guix-system-container: run one container at a time, LIST commandPjotr Prins
* START is refused while a previously started container is still alive (ERR already running container <pid>) * new LIST command reports running containers, including those started by previous daemon instances (via a /proc scan), so they can be found and KILLed after a daemon restart * client: new --list option; README updated
2026-09-26Adding an hello servicePjotr Prins
2026-09-26run-guix-container: new toolPjotr Prins
A C daemon (run as root) that starts Guix system containers on request over a line-based network protocol, plus an unprivileged Ruby client. * START/KILL/LOG/FINGERPRINT protocol; one request per connection * strict validation of store items before exec (HASH-run-container name, guile shebang, container markers, immutable store file) * --fingerprint WORD identifies the daemon instance (random hash when unset); verified by clients and passed to containers in GUIX_CONTAINER_FINGERPRINT * on SIGINT/SIGTERM: SIGTERM all started containers, 10s timeout, then SIGKILL * container boot output appended to /var/log/guix-containers/ * unit tests for launcher and fingerprint logic