Cells for NetBSD
A NetBSD-native operating model for isolated services: policy in the kernel, declarative desired state, operated through command line and terminal UI. The project is experimental. That is exactly why it shows well how I decide and what I accept in return.
Starting point
NetBSD lacked a pragmatic middle path between a plain chroot and full virtualisation. The goal was not to copy existing Linux container platforms, but an approach that fits NetBSD and has clear operational limits:
- Isolation and rule enforcement in the kernel
- Reproducible operation on the host, without additional runtime layers
- Understandable, declarative control for everyday use
This is the same question as in many companies, just one layer deeper: a protection feature is of little use if nobody can operate it. An operating model is of little use if it does not enforce the protection. Both belong in one design.
The system in layers
secmodel_cellin the kernel enforces identity, isolation and rules.cellctlis the runtime-near layer: create and remove cells, run commands, supervise running services, provide metrics.libcellmanis the shared core of the control plane, with a typed data model and reconcile logic.cellmanandcelluiare command line and terminal UI on the same library.- State exists in two forms: the desired state lives as Lua files under
/etc/cellman, the runtime state under/var/cellman.cellman applyreconciles both and shows beforehand where they differ.
Four decisions
Isolation in the kernel, not in a runtime layer
Cells are clearly separated execution domains in a shared kernel. There is no second virtual network stack and no hidden services between operator and process.Rejected: An additional container runtime on top of the system. It adds another layer with its own service processes between operator and process.
Price: Kernel-near work without a formal upstream review. The project is therefore experimental and not security-audited.
Describe the desired state, run the reconcile
The description contains the complete desired state.cellman apply brings a host there reproducibly, with health checks and drift detection. Backup and restore for volumes and overlay state are part of the tool.
Rejected: Running individual commands by hand. That is faster at first, but leads to hosts nobody can reproduce any more.
Price: Changes go through the desired state. Anyone who intervenes by hand on the running system creates drift, which becomes visible.
Control plane in C instead of Go or Rust
Cells should work the same from the smallest SoC to a powerful server. C is part of the NetBSD base system and available on every supported architecture. In addition, command line and terminal UI now share one library instead of exchanging text.Rejected: Go or Rust. In practice both work on only part of the platforms NetBSD supports.
Price: A complete rewrite of the control plane, from the shell script cellmgr to cellman. That was a deep cut, not a refactoring.
Lua instead of YAML for the description
The deciding argument was infrastructure: the Lua library is already part of the NetBSD base system. So no new build or runtime dependencies are added. The description stays readable and declarative, with building blocks for volumes, cells and actions on the target system.Rejected: YAML. It is more widespread, but brings special cases with it.
Price: Lua is less common as a configuration language. Whoever operates Cells learns an additional, small language.
What I take from this for businesses
| In Cells | In a company |
|---|---|
| Describe the desired state, run the reconcile | Configuration management: systems are not maintained by hand but reconciled against a description |
| Isolation in the kernel instead of an extra layer | Enforce security rules where they cannot be bypassed |
| One library for command line and UI | Automation and operation use the same path, not two |
| Stable, machine-readable output | Interfaces that automation can rely on |