Skip to main content
axectl is the command-line client for AXE’s native API (axe.v1). axectl --help and axectl <command> --help print the same commands and flags. axectl talks to axed’s gRPC port only. It does not use the Agent Sandbox REST port.

Global options

These work before or after the command name.
string
default:"127.0.0.1:9090"
axed’s gRPC endpoint. Environment: AXE_ADDR.
  • host:port for TCP, for example axed:9090. An address with a scheme, such as http://axed:9090, is used as given.
  • unix:///path for a Unix socket.
  • vsock://cid:port for vsock. The cid must be a number.
Connecting times out after 5 seconds, on every transport.
string
Bearer token, sent as authorization: Bearer <token> metadata on every call. Environment: AXE_TOKEN. Must be printable ASCII. --help does not print its value.
flag
Print help.
flag
Print the version.

Process names and ids

Commands that take PROCESS accept an id or a name.
  • A string of exactly 32 hex digits is an id, as printed by run and ps.
  • Anything else is a name. A name refers to the running process with that name, or after it exits, the most recently finished process with that name that axed still remembers.
A name made of 32 hex digits is always read as an id. Names are unique among running processes, so a second run --name with a name in use fails until the first process exits.

Exit codes

axectl clamps exit codes outside 0 to 255 to that range. 125, 130 and 143 are ambiguous. A process can exit with any of them itself, 130 also means a process killed by SIGINT, and 143 a process killed by SIGTERM.

Process options

run and exec take these options before the command. Everything after the first argument that is not an option, or after --, is the command and its arguments.
flag
Run on a pseudo-terminal sized to the local terminal, or 80x24 when there is none. Output from a terminal is all stdout.
KEY=VALUE, repeatable
Add an environment variable on top of the daemon’s environment.
path
default:"the root"
Working directory inside the sandbox root.
string
Run as this user: a name from /etc/passwd, a uid, or uid:gid.
duration
Kill the process tree after this much running time. Time the sandbox spends suspended does not count. Uses Go duration syntax, as axed’s flags do: for example 30s, 5m, 1h30m, 1.5h.
SIZE
Memory ceiling: a number of bytes, or a whole number with a binary unit (KiB, MiB, GiB; K, M, G mean the same), for example 512MiB. With cgroups this limits the whole tree; without, it is RLIMIT_AS per process.
number
CPU limit as a number of CPUs, for example 0.5 or 2. The smallest value is 0.001. axectl sends it to axed in millicores (cpu_millis, 1000 for one CPU). Requires cgroups; without them the start fails.

Commands

run

Start a detached process that keeps running when axectl exits. Prints the process id.
flag
Attach right away instead of printing the id, with stdin forwarded. With -t, Ctrl-P Ctrl-Q detaches and leaves the process running. Implies -i.
flag
Keep the process’s stdin open, so a later attach -i can write to it. Without -i or -a, stdin is /dev/null unless -t is set; a terminal always has input.
string
Name, unique among running processes.
KEY=VALUE, repeatable
Label the process. ps -l filters on labels.
SIZE
default:"0"
Output to retain for replay, in bytes or with a binary unit, as for --memory. 0 uses the daemon’s --retain. More than the daemon’s --max-retain fails.
string
Idempotency key. Running the same command again with the same key prints the first process’s id instead of starting another, so a script can retry safely. The same key with a different command or options fails with already exists (REQUEST_ID_CONFLICT).
Uses Processes.Start, then Processes.Attach with -a.

exec

Run a process attached to this terminal and exit with its exit code. axed kills the process if axectl disconnects or exits. axectl forwards stdin, and local end-of-file ends the process’s input. For a pipe, that closes the process’s stdin. On a terminal, axed sends the terminal’s end-of-file character (Ctrl-D), so input piped to exec -t ends as well. A program that switches the terminal to raw mode, such as bash or python3 with readline, can miss that Ctrl-D when it arrives before the program reads, and then keeps waiting; end such input with an explicit command such as exit. Ctrl-P Ctrl-Q does not detach. With -t and a local terminal, axectl switches to raw mode. Keys, Ctrl-C included, go to the process, and axectl forwards window size changes. Without raw mode, Ctrl-C makes axectl exit with 130, which kills the process.
Uses Processes.Run without detach.

attach

Replay a process’s retained output, then follow it until it exits. Exits with the process’s exit code. Without -i, axectl does not read stdin, so Ctrl-P Ctrl-Q does not detach. Ctrl-C stops following, axectl exits with 130, and the process keeps running.
integer
Replay from this output byte offset instead of the oldest retained byte. An offset past the end starts at the end.
flag
Never slow the process down. axectl skips output evicted before it reads it and reports it on stderr as axectl: N bytes of output were dropped. By default a slow reader holds the process back.
flag
Forward stdin. On a terminal process, Ctrl-P Ctrl-Q detaches. On a terminal process with a local terminal, axectl switches to raw mode. Keys, Ctrl-C included, go to the remote process, and axectl forwards window size changes. Otherwise Ctrl-C stops following and axectl exits with 130; the process keeps running.

logs

Print a process’s retained output and exit with 0. Stdout and stderr go to the matching local streams.
flag
Keep following output until the process exits. Ctrl-C stops following, not the process.
integer
Start at this byte offset of the output instead of the oldest retained byte. The OUTPUT column of ps shows how many bytes a process has written.
logs reads lossily. It never slows the process and reports skipped bytes on stderr.

ps

List processes, running and finished, in start order.
KEY=VALUE, repeatable
Only processes carrying all of these labels.
Columns: CPU and MEM cover the whole tree when axed runs the process in a cgroup. Without one they cover only the leader and end in *, as in 0.3*. axed reads them when ps asks; nothing samples in the background.

kill

Send a signal to the process’s process group.
string
default:"TERM"
A signal number, or one of HUP, INT, QUIT, KILL, USR1, USR2, TERM, STOP, CONT, WINCH. Names are case-insensitive and may start with SIG. Other signals work by number.
Signaling a process whose leader has already exited succeeds and does nothing, even while axed is still collecting its output.

wait

Wait for a process to exit, print why it ended and its exit code, and exit with its exit code.
The line uses the STATE words of ps, for example timed-out 137 or exited 0.

rm

Forget a finished process, freeing its retained output.
flag
Kill a running process tree first, wait for it, then forget it. Without -f, a running process fails with failed precondition.

watch

Print file changes under a directory of the sandbox root, one per line, until interrupted.
path
default:"."
Directory to watch, relative to the root.
flag
Include subdirectories, including ones created during the watch.
Each line is the change kind (CREATE, WRITE, REMOVE, RENAME, CHMOD) and the path relative to the root. A rename prints RENAME with the old path, then CREATE with the new path when it lands inside the watched tree. Errors go to stderr, prefixed with axectl: watch:. An error that leaves the watch running, such as a kernel queue overflow, is reported and watching continues. An error that ends the watch makes axectl exit with 1.

freeze

Freeze every running process tree through its cgroup, as a quiesce point before a snapshot. Requires cgroups. Prints N of M process trees frozen. Waits up to 5 seconds for the trees to change state. Until the thaw, starting a process fails with failed precondition (FROZEN).
flag
Thaw instead of freezing.

resumed

After restoring a snapshot, send axed this machine’s wall time and 64 bytes of fresh entropy, and record a resume. Prints the new generation, how far the clock was stepped, and whether the entropy was added. Run it from the host side, where the clock is right.
flag
Skip the entropy step.
flag
Also thaw processes frozen with axectl freeze, after the clock is set and the resume recorded. Adds N process trees thawed to the output. Does nothing without cgroups.
axed steps its wall clock if it is more than 50 ms off (needs CAP_SYS_TIME), then adds the entropy (needs CAP_SYS_ADMIN), then records the resume. Without CAP_SYS_TIME the command fails when the clock is off, and no resume is recorded. The entropy is best effort: without CAP_SYS_ADMIN it is skipped and the output says entropy not added. Uses System.Configure with resumed: true. See Snapshots.

info

Print daemon state and capabilities.

Detaching

run -a and attach -i detach on Ctrl-P followed by Ctrl-Q, and exit with 0. The process keeps running. Ctrl-P followed by any other key sends both keys. Detaching applies only when the process has a terminal (-t). On a process without one, axectl forwards every input byte unchanged, so binary input passes through intact. Docker also claims Ctrl-P Ctrl-Q, so when you run axectl with docker run -it, pass --detach-keys to give Docker another sequence.

Examples

Run processes walks through a full session.