Skip to main content
This page covers running axed in an ordinary Linux container (runc, crun) or directly on a host: whether to make it PID 1, how it uses cgroups, running as non-root, and resource limits.

PID 1 or under an init

axed is designed to be the container’s first process, and needs no init such as tini.
  • As PID 1, axed reaps every orphan in the PID namespace, and can take over the container’s cgroup.
  • Under another init or on a host, axed registers itself as a child subreaper, so orphaned grandchildren of the processes it starts still come back to it. Whoever is PID 1 reaps orphans from elsewhere.
axectl info shows which applies:
On shutdown, axed sends SIGTERM to every running process, kills the whole tree of any still running after 2 seconds, and bounds the whole shutdown by --shutdown-timeout (default 10s). As PID 1, its exit also makes the kernel kill whatever is left in the PID namespace. SIGTERM and SIGINT shut axed down. To keep running on SIGTERM, for platforms that suspend instead of stopping, use --on-sigterm=stay. See Agent Substrate.

Cgroups

With a writable, delegated cgroup v2 subtree, axed gives every process its own cgroup. That gives:
  • a kill that reaches every descendant (cgroup.kill),
  • memory, CPU and task limits for the whole process tree,
  • OOM detection, reported as the oom-killed state,
  • freezing every process before a snapshot (axectl freeze).
Without cgroups, axed kills the process group plus every descendant it can find through /proc, maps memory limits to RLIMIT_AS (per process) and task limits to RLIMIT_NPROC (which counts every process of the user), and refuses CPU limits and freezing.
auto | off | required
default:"auto"
auto uses cgroups when axed owns a writable cgroup v2 subtree and logs cgroups unavailable; using process groups and rlimits otherwise. off never uses them. required refuses to start without them.

What delegation means

axed takes over the cgroup it runs in. It moves itself into an axed child cgroup, enables the cpu, memory and pids controllers that are available, and creates one child cgroup per process. For that it needs:
  • cgroup v2 mounted in unified mode at /sys/fs/cgroup,
  • write access to its own cgroup directory, which usually means running as root or as the user the cgroup was delegated to,
  • its cgroup to itself. axed refuses to take over a cgroup shared with other processes unless it is PID 1, because moving them would surprise their owner.
A default Docker container mounts /sys/fs/cgroup read-only, so cgroups are unavailable. In Kubernetes, the container needs a writable, delegated cgroup v2 mount. Under an init such as docker run --init, the init shares axed’s cgroup, so axed does not take it.

Try cgroups locally

For local testing, give the container a private cgroup namespace and a writable cgroup mount. The default image runs as user 1000, which cannot write the cgroup tree, so run as root:
Then try a memory limit:
--privileged gives the container broad access to the host. Use it for local testing only, never for sandboxes that run untrusted code.

Running as non-root

The default image runs as user 1000. Agent Sandbox pods run it with runAsNonRoot, all capabilities dropped and no privilege escalation. axed runs as non-root without capabilities, with these limits:
  • Processes run as axed’s user. Starting a process as another user (axectl run --user) needs the privilege to switch users.
  • cgroups are usually unavailable unless the cgroup was delegated to that user.
  • axectl resumed (System.Configure) steps the wall clock if it is more than 50 ms off, which needs CAP_SYS_TIME, then adds entropy if axed has CAP_SYS_ADMIN (skipped otherwise, and reported as entropy not added), then records the resume. Without CAP_SYS_TIME it fails whenever the clock is off by more than 50 ms, and then records no resume.

Resource limits

Each process can carry its own limits, set by the client when it starts the process. With axectl:
Set daemon-wide limits on axed’s command line: axed caps client connections at half the hard descriptor limit (ulimit -Hn), clamped between 16 and 65,536, and splits the cap evenly among the listeners and the REST port. See the axed reference for every flag. Set the container’s own CPU and memory limits too. They bound axed and everything it runs together.