nos_
ENRU
All documentation

Tools

Shell commands

docs/shell-commands.mdView on GitHub

The interactive shell runs on the serial console and the screen, and every command also works over the UDP remote shell. Trace output is suppressed while the shell is active (it still lands in dmesg).

Command Description
cls Clear screen
cpu Dump CPU state
lscpu Identify the CPU and report the features the kernel depends on (1 GiB pages, NX, PAT, invariant TSC, ARAT), the performance counters it has (Intel architectural perfmon, or AMD core counters and PerfMonV2), and which of them profile will actually sample with
dmesg [lines] [filter] / dmesg save <path> [lines] [filter] Dump the kernel log: newest lines messages (all of it if omitted), optional substring filter; save writes the same output atomically to path (<path>.new first), creating /logs when it is the destination's parent
loglevel [N] Show or set the log level (0-5) on a running kernel
mark <text> A line of your own into the kernel log, mark: <text> -- onto the consoles, the netconsole and the disk log with every other line: a mark to find later, set before something is tried on a box whose only console is the network
uptime Show uptime
date Show wall clock date and time (RTC + boot time); "wall clock not available" on a machine whose RTC could not be read, rather than a date in 1970
e1000edump [n] The nth 82574L's own state (0 by default): its control, status and manageability registers -- MANC as the firmware has it now and as bring-up found it -- the PHY's view of the link (BMCR, BMSR, what it advertised and what the partner offered, both 1000BASE-T registers, read holding the MDIO bus the firmware shares), the interrupt layout (INTx, one MSI-X vector, or a queue vector and Other) with IVAR, IAM and EIAC and each vector's count, the throttle and the receive rate it follows, both rings' head and tail, and the MAC's own receive and transmit counts
igbdump [n] The igb chip's own state -- the first card's, or the n-th's (a two-port I350 is two): MAC command/status registers, ring head and tail, receive statistics; the interrupt layout (INTx, one MSI-X vector, or a queue vector and another) with each vector's count, the throttle and the receive rate it follows, and how often under load the poll looked at an empty ring again rather than arm the interrupt, with the time that cost; and the PHY's view of the link — what it advertised, what the partner offered, both 1000BASE-T registers. What made the I210's 10 Mb/s latch diagnosable
nicdump The r8125's own state: command register (is the receiver still enabled?), interrupt status and mask, and whose the head receive descriptor is. For a machine that has stopped receiving and can still be typed at
mlxdump [n] The nth ConnectX-3's queue pairs, queried from firmware (QUERY_QP): the context flags from mailbox offset 0x08 and the full 256-byte mailbox in dmesg, plus the catastrophic-error buffer. Read-only, for diagnosing a TX error or a stalled queue. Asynchronous CQ, QP and link events are polled separately after boot and logged
stacks Stack high-water marks: every stack is filled with a pattern when it is created, and what is still intact is what it never reached. Catches a spike that lasted microseconds during boot, and costs nothing while the machine runs
ps Show tasks
top [ms] Per-task CPU use over a sampling window, percent per CPU (a busy thread reads 100%, a 20-CPU box tops out at 2000%), plus the number of tasks moved between CPU queues since boot, and of reschedules deferred because the task they landed on had preemption off, in the window and since boot -- how many of those on an idle task
cpufreq [ms] What each CPU's clock did over a window (a second unless given, up to 10 s): the clock it ran at while it was busy, in MHz, and the share of the window it was busy -- its APERF and MPERF counters against the TSC, read on each CPU by an IPI at both ends -- and the share of the window its idles spent asking for C1, for the C-state between and for its deepest, and how many of each (what nos's idle asked for by MWAIT, which the CPU may have taken shallower). Whether a busy core runs at its turbo clock, and whether CPUs meant to idle do, and how deep. x86 outside a hypervisor's guest, where CPUID says the CPU counts them; nothing on arm64
sched [ms] What each CPU's scheduler did over a window (a second unless given), a line a CPU and one for all: how many tasks are on its queue; how many were woken and how long they waited for the CPU -- the median, the 99th and the 99.9th percentile as the bounds of the log2 buckets they fell in, and the longest since boot exactly; how many were displaced while they could still run, and how long until they ran again; how many decisions it made, what one cost on average in the window and at most since boot, and how many tasks each touched; how many tasks could run each time the CPU's timer had the queue looked at -- on average, the most since boot, and how often two or more. See Scheduler
sched probe [spinners=2] [ms=2000] [cpu=N] How long a woken task waits for a CPU that others keep busy: spinners tasks that never yield, pinned to cpu (the highest one other than the shell's, unless given), a waiter pinned beside them asleep on an event, and the shell's task signalling it from its own CPU a sample at a time; the waits from each signal to the waiter running, as percentiles and the longest, the signals not answered within a second, the lag the waiter woke with -- least, average and most, in virtual microseconds -- and the share of the window each task ran. See Scheduler
sched queue [cpu] What EEVDF has of each task a CPU (this one unless given) can run, the one on the CPU first and starred: pid, nice, slice in microseconds, lag and deadline in virtual microseconds from V, whether it is eligible, and its name. See Scheduler
sched nice <pid> <-20..19> A task's nice: its weight, and so its share of its CPU beside others that want it -- each step about ten per cent between two tasks
sched slice <pid> <100..100000> A task's slice in microseconds: how long it runs at a time, and so how soon after it is eligible it runs -- a short one is lower latency, not a larger share
sched affinity <pid> [<cpus>] The CPUs a task may run on, and the one it is on -- or, with CPUs, those from now on: a list of CPUs and ranges, 8,9,24-25, or a hex mask, 0x3000300. A task on a CPU no longer in it is taken off at that CPU's next decision, which the command asks for, and moved to the lightest of the new ones -- one asleep there, when it next wakes; the command says where it is after up to 200 ms. Any task -- a guest's vCPU (hv/vm1/cpu0), a disk's task (hv/vm1/vda), the shell -- but the CPUs' idle and softirq tasks and a measurement's (trace bench, sched probe), which are bound to their CPUs and refuse it, as does a mask with no CPU that runs. See Scheduler
profile [ms] [pid|all] [chains] Sampling profiler: where the kernel spends its time, as whole call chains -- samples are folded by their entire stack, not by the leaf symbol, and the hottest chains are printed in full. chains caps how many, for a console with no scrollback -- profile 2000 all 3 fits a screen where the default does not. Every frame carries its offset: the leaf as the instruction the sample landed on (a span when they spread across the body, so a hot spinlock says whether it sat on the exchange or in the pause loop), each caller as the return address that names which call site led there. Samples on a performance counter overflowing into an NMI (~1 kHz, and catches code running with interrupts off) where the CPU has one -- Intel's architectural fixed counter 1, or AMD's PMCx076 on family 15h and later, both counting unhalted core cycles; falls back to the 100 Hz per-CPU tick where it does not, which includes any machine whose hypervisor answers CPUID for a PMU it declines to virtualise (the counter is asked to prove it counts before the profiler trusts it). The report names which
trace [list] | on <event|group|all>... | off <...> | show [n] [cpu=N] [event|group|all...] | dump [n] [cpu=N] [event|group|all...] | latency [n] [cpu=N] [event|group|all...] | stat | clear | size <KiB> | free | freeze [wakeup>N<ns|us|ms|s>] | thaw | test [n] | bench [cpu=N] Tracepoints: events recorded as they happen, each turned on and off while the kernel runs, into a ring of the recording CPU's own (1 MiB a CPU, made by the first on), and read back from every CPU's ring merged by time, oldest first -- each record its time, CPU, event and fields. size makes the rings again at another size, free gives them back once no CPU can be writing into one, dump prints the same window as JSON for scripts/trace-decode.py on the host, latency pairs each wakeup with the switch that answered it and says how long it waited, freeze stops recording so that what is there stays -- at once, or (freeze wakeup>N) when a wakeup waits longer than N, bench says what a tracepoint costs off and on, on this CPU or cpu=N, and a record's parts. See Tracepoints
bt <pid> Where a task is -- blocked, asleep, runnable, running on cpu N at a function, or on a CPU that took no interrupt in a second -- and its stack trace (Scheduler)
watchdog Watchdog stats: locks watched, table walks, and the slice of the bucket table each CPU walks (the table is divided among the CPUs, so a bucket is visited once per tick rather than once per tick per CPU)
memusage Show memory usage: free and total pages, how many of the free are zeroed already, and the huge pool's free and total 2 MiB blocks (hugepages=) and how many of the free are zeroed (zerofree=); the fewest pages free since boot (free_pages_lowest); and Rust's heap -- what its Boxes, Vecs and the rest take now and took at most, what they asked for, the blocks, and the allocations, frees and refusals since boot (Paging); on a machine of several NUMA nodes, each node's free and zeroed pages and huge pool, a node N: line each (NUMA)
meminfo Show the firmware memory map, and how much of it the kernel actually uses; on a machine of several NUMA nodes, each node's usable RAM by the map, its free and zeroed pages and its huge pool
memcheck Verify no reserved, kernel-image or absent page reached the free list; each NUMA node's free and zeroed pages, and that they add up
numa The NUMA nodes (NUMA): each one's CPUs and memory ranges, what of it is free and zeroed, its share of the huge pool, and the distances
memsites [on|off|dump|tags|N] Who holds Rust's heap: on gives every block Rust allocates from then on its site -- the stack that asked, past the allocator's own frames -- and memsites reads the heap by them: the N sites (20 by default) holding the most, merged by the frame that is the code's own, with what each takes and asked for, its blocks and the two frames that called it, and what of the heap has no site; tags, the heap's pool blocks by their owners' tags, C++'s and Rust's; dump, every site's frames as addresses, which scripts/memsites.py names to files and lines; off stops giving sites, and those given stay. memsites=on at boot starts it with the first allocation. See memsites
pci Show PCI devices
disks List block devices, each with the id a VM's vm.toml finds it by from boot to boot where it has one: part: and a partition's GPT unique GUID, or its MBR's signature and number; disk:nvme- and a whole NVMe disk's model and serial
diskread <disk> <sector> Read and hex-dump a sector
diskwrite <disk> <sector> <hex> Write hex data to a sector. Refused on a device a mounted filesystem, the disk log or a blkload write test holds, or on a disk or partition overlapping one (see Filesystems)
partitions <disk> Show the partition table (MBR or GPT)
disklog Kernel-log-to-disk state: off unless the kernel was booted with disklog=on; otherwise the prepared area it found (if any), boot number, sectors written, lines queued and dropped. The area is laid down under the host OS with scripts/disklog.py format and read back with scripts/disklog.py read
irqstat Show per-device interrupt counters
help List commands
net List network devices: the frames and bytes each has sent and received -- drop: what the device dropped, rxfull: frames its receive queue had no room for, txfull: frames its transmit queue had no room for, each lost inside nos itself -- and per-protocol stats; every interface's settings, with where the boot took them from (/etc/net.toml, or the command line's -- and why, where the file was refused), the default route and additional routes (The network)
arp Show ARP table
nat / nat allow <a.b.c.d[/n]> / nat deny <a.b.c.d[/n]> Whether NAT is on, between which devices and from which address; the first mappings, each with its protocol, the guest's side, where it goes, the external port it has and how long it has left; where the guests are kept from -- link-local (a cloud's metadata server), the private networks, the shared space, the uplink's own subnet -- and what nat allow let through of it; and what NAT has done -- packets out and back, mappings made and those made by taking the least lately used flow of the guest holding the most (a full table), and the packets it had no room, next hop or frame for, does not take, or denied; the public addresses mapped one to one to guests (public=) and the networks behind the inner device, and what went one to one each way, came from what is not the world, was too big, or was made up past NAT's rate. allow lets the guests reach a network the deny list keeps them from, up to 16, and deny takes that back. The hypervisor's switch turns it on for its guests. See The way out and A public address
netpool [bench] Show the recycled net frame pool: frames in the ring, in per-CPU caches, in flight; bench: what taking and giving back a frame costs this CPU, as the image takes one and as a module does (its room zeroed), one at a time and a ring's worth at a time
netconsole Show netconsole target, buffered bytes, drop/send counters
icmpstat Show ICMP statistics
tcpstat Show TCP connections and statistics: each connection's state, snd= what waits to go and what is in flight, rcv= what waits to be read of how big a buffer -- 8 KiB, or a bulk connection's up to 512 KiB (the HTTP client's, and those hv forward accepts) -- wnd= the window last offered, cwnd= the congestion window, what the sender lets be in flight, rto= the retransmission timeout of the moment in ms -- and floor= the least the round trip may make it, on a connection given a floor of its own (a link between two nos hosts: 20 ms where every other has 200) -- and scale= this end's shift and the peer's when the window is scaled (RFC 7323), sack when both ends take selective acknowledgements, and in a recovery recovery=fast (RACK found the loss) or recovery=timeout, with sacked= the bytes in flight the peer holds past a hole and lost= those lost and not yet sent again; and on the first line, among the counters, refused= the SYNs a listener's allowlist dropped, halfopen= the connections given up half open after 3 s, rstheld= the resets for no connection the stack's limit of 200 a second held back, and what the senders of SACK connections made of their losses: recoveries= RACK started, timeouts= and of them spurious= the ones an original's arrival showed were for nothing, probes= loss probes sent, undos= recoveries every copy of which the peer said came twice, dsacks= D-SACKs taken, reneged= peers found to have let go of what they had SACKed -- and what the receivers turned away, which a peer has to send again: outside= data segments from outside the window (copies of what was taken in apart), badack= segments whose acknowledgement RFC 5961 drops, unkept= bytes in the window not kept -- no room in the buffer, or no stretch left to keep them past a hole in -- and of those overrun= the bytes inside a window offered that found no room, a promise broken, which must stay 0; and reclaimed= the slots taken back for a new connection, every one of the 64 taken, from connections their programs had let go of and that only waited out their close -- TIME-WAIT the longest first
wget [-o <path>] <url> [path] Fetch a URL via HTTP or HTTPS GET (follows redirects, including http→https). With a path — -o and the trailing argument are the same thing — the body is streamed to that file as it arrives, with no cap but the filesystem's — a VM's disk image of gigabytes is fine, and a disk that fills ends the download as a failed write — with a progress line now and then (how much, of how much when the server said, and how fast: every 2 s at first, every 30 s at most) and the time it took at the end. Without one it is printed, and kept in memory, so it is capped at 32 KiB. HTTPS verifies the certificate chain against the built-in roots and the wall clock; see HTTPS
udpsend <ip> <port> <msg> Send a UDP packet
ping <ip|hostname> Send 5 ICMP echo requests with RTT printed to microsecond precision (resolves hostnames via DNS)
nslookup <hostname> Resolve hostname to IP via DNS
dnsflush Flush DNS cache
dhcp [dev] Obtain IP address via DHCP
random [len] Get random bytes as hex string, 1..1024, default 16 — from the kernel's ChaCha20 pool, not from a device
entropy [reseed] Show the random pool (seeded, whether hardware entropy reached it, reseeds, bytes generated) and the registered entropy sources; reseed draws from every source again first. See Randomness
format <ext2|ext4> <disk> [label=<name>] [bs=1024|2048|4096] [force] Make a filesystem on a disk or a partition: ext4 as its driver writes it (a journal, extents, metadata_csum) or ext2; blocks of 1 KiB below 512 MiB and 4 KiB from there unless bs= says, a label of up to 16 printable characters. Refuses a device in use (mounted, the disk log's, a disk under a mounted partition), a whole disk the kernel knows partitions of, and without force a device that holds anything -- a filesystem, a partition table or a volume, named with its label, or any byte at its start that is not zero; writes nothing when it refuses. format alone lists the filesystems and their options. See Filesystems
mount ramfs <path> Mount a ramfs at path
mount ext2 <disk> <path> [ro] Mount ext2 from disk at path, read-write unless ro (or unless the image carries features the driver does not write; see Filesystems)
mount ext4 <disk> <path> [ro] Mount ext4 (or ext3) from disk at path, read-write unless ro (or unless the image carries features the driver does not write): a mount for writing replays a journal nobody replayed and releases the orphan list, a read-only one reads the journal through and writes nothing (see Filesystems)
umount <path> Unmount filesystem
mounts List mount points: the filesystem, where it is mounted, what it says of itself, rw or ro, each in a column
df [path...] How big each mounted filesystem is, what of it is used and what is free -- or, given paths, the filesystem each is on, whether the path is there yet or not: its mount point, type and device, its size, used and free to a tenth of K, M, G, T or P (1024 each, rounded down), and the share used, rounded up as df(1) rounds it. From what the filesystem counts in memory: ext2 and ext4 count, and a ramfs and procfs, which do not, show -. The bytes themselves: mgmt call fs mounts
ls [path] List directory contents (default /): f and a file's size, right-aligned, or d; the names in one column
find [path...] [expression] The files and directories under each path (/ when none is given), the path itself included, that the expression holds for -- one a line, a directory before what is in it, as find(1) prints them. Tests: -name, -iname, -path, -ipath <pattern> -- the last component, or the whole path as printed, against a shell pattern (*, ?, [a-z], [!...], \ for the next character as itself; * matches / in a path; the i forms take ASCII letters in either case); -type f|d; -size [+|-]N[c|K|M|G|T] -- a file of more than, fewer than or exactly N bytes, not find(1)'s blocks of 512, and never a directory; -empty -- a file of no bytes or a directory of no entries. Options, anywhere in the expression: -maxdepth N and -mindepth N (the path given is depth 0), -xdev -- not into a directory another filesystem is mounted on. Joined by ! or -not, -a or -and (or nothing) and -o or -or, and grouped by ( and ) -- each its own word. The shell has no quotes, so a pattern is a word as typed: find /lib -name *.ko. There are no actions: what it holds for is printed. A directory the filesystem cannot read is said, never taken for an empty one; find -help lists the tests
cp [-r] <src> <dst> Copy a file, or a whole directory tree with -r; a dst that is an existing directory takes the copy under its own name
cat <path> Show file contents
tail <path> [lines] The last lines of a file, 10 unless told (1-10000), from the last 64 KiB of it: a log's newest without the whole of it
logs [sync] The file logs under /logs (File logs): each one's file and its size, its old files and all of them together, its limits, the lines it has written, lost and sent to the kernel log since the boot, and whether it is being written -- or why not. sync: what is queued written now, waited for
write <path> <text> Write text to file (creates if needed)
mkdir <path> Create directory
touch <path> Create empty file
rm <path> Remove file or directory (recursively); del is the same command
append <path> <text> Append text to a file (created if missing)
mv <old> <new> Rename or move a file or directory within one filesystem
stat <path> Type, size and inode number
truncate <path> <size> Cut a file to size bytes (a K, M, G or T suffix), or grow it there with a hole, made first if it is not there -- a blank disk image for a guest, of any size the filesystem holds; refused past what a file can be there
sync Flush every mounted filesystem to disk
fstest [dir] [size] Filesystem self-test in dir (default /) with a big file of size bytes (K/M suffix; default 300 KiB, at least 8 KiB); fstest / 5M reaches the doubly-indirect blocks at 4 KiB blocks
crc32 <path> CRC-32 of a file, to check a copy against the host
sha256 <path> SHA-256 of a file, printed the way sha256sum prints it, to check a downloaded kernel against the SHA256SUMS of its release
grubenv <path> [name=value ...] Show, or set, the variables of a GRUB environment block — the grubenv file grub-editenv makes and GRUB's load_env/save_env read and write; name= with nothing after it removes one. Edited in place at the same size, the way GRUB's own writer edits it, so GRUB can still read and clear what was set; a block with a line it cannot be sure of reading as GRUB does -- no = before the line's end, a name longer than 64 characters or holding a backslash or a NUL -- is listed as far as that line and never written. What arms a one-shot boot of a downloaded kernel from inside nos: see Real hardware
insmod <path> [params] Load a kernel module — a Rust crate built into a .ko by make modules — from a file, and run its init, in a task of its own, the rest of the line its parameters (insmod /hv.ko vms=/data/vms): the module's to take, or to refuse saying why -- one that takes none refuses any. Says why when it refuses one: not a module, another machine's, built against another kernel interface, an import the kernel does not export, a name already loaded or still loading or unloading. A load not done in five seconds carries on in the background, the kernel log saying how it ended. See Loadable modules
rmmod <name> Unload a module in a task of its own: run its exit, which releases everything it holds, then free its code. The exit waits for a call of one of the module's commands still running; past five seconds the shell leaves it to finish in the background
blkload <dev> [randread|randwrite|read|write] [bs=4k] [qd=1] [secs=5] [aio] [force] From the blkload module, once it is loaded: a short load test on a disk or a partition — IOPS, bandwidth, latency min/avg/p50/p90/p99/p99.9/max — by qd tasks, or with aio from one task through the device's queue, the asynchronous path (which claims the device for reads too). A write test claims the device first: refused while a mounted filesystem, the disk log or another write test holds it — or the disk it is on, or one of its partitions — and without force on a disk with partitions or a device holding a filesystem, a partition table or a disk log area. See Loadable modules
netload start [port] [sink] [nic=ethN] / netload send <ip> <port> [size=64] [pps=0] [secs=0] [count=0] [tasks=1] [sport=9998] [nic=ethN] From the netload module, once it is loaded: a UDP load test from either end, so profile has something to look at other than an idle machine. start is the target: it echoes every datagram from the receive softirq (or drops it, in sink mode; port 9999 and eth0 unless told, with nic=ethN selecting another interface), and can be driven from a host too, with scripts/netload.py (--pps to hold a rate, --threads to raise the ceiling). send is the source: tasks senders build datagrams of size bytes of payload straight into frames off the pool and hand them to the NIC a batch at a time -- as fast as it takes them, or pps a second -- until count are sent, secs have passed or netload stop; what comes back to sport is counted as echoes and never answered. It leaves room in the transmit queue for everybody else, so the shell goes on answering under it. See Loadable modules
netload / netload stop / netload reset What the target and the source have counted -- packets, bytes, failures, rates, and which CPUs did the work; stop both; clear the counters
netblk start <disk> <port> [ro] [nic=eth0] [mtu=1500] [cpu=N] [poll=us] From the netblk module, once it is loaded: serve an NVMe disk, or a partition of one, over UDP on port (1024 and up, one instance to a port), zero-copy. Read-write claims the device the way a blkload write test does; ro takes no claim. A port someone else has is refused. poll keeps the worker spinning that long for the next request before it sleeps. See netblk
edit <file> From the edit module, which the image's /etc/rc loads: a text editor, for an SSH session with a terminal (ssh -t <host> edit <file>, or the shell ssh <host> gives) -- a Mac's keys on Control: ^S save, ^Q quit, ^F find, ^G go to a line, ^Z/^Y undo and redo, ^X/^C/^V the selection or the line, Shift with a move to select, ^A/^E, ⌥←/⌥→. A file comes back out as it went in, byte for byte; a save writes the new content whole before it takes the old one's place, a file changed on disk since it was read is asked about first, and changes left when the connection goes are kept in <file>.save. Refused on the console and the UDP shell, which have no terminal to draw on. See Loadable modules
mgmt / mgmt describe <provider> / mgmt call <provider> <method> [json] / mgmt start <provider> <method> [json] / mgmt jobs / mgmt job <id> / mgmt cancel <id> The management bus: the providers registered on it -- the kernel's layers, and modules' -- with their methods and kinds and the size of each one's descriptor; a provider's descriptor; a call of one of its methods, its answer (JSON) and, when it fails, its status; a job started, and its number; every job's record -- queued, running or done, its status, its progress -- and one's with its log and result; one told to stop. See The management bus
api / api start / api stop / api clients / api client add <name> <admin|read> <fingerprint | cert=<file.pem>> / api client del <name> / api reload / api cert The host API (a module: insmod api.ko): what it serves -- its port, its listeners, every connection and whose, what it has refused and what its handshakes cost; serve as /etc/api/api.toml says, its host key made on the first start; stop; the keys let in, and their roles; a key let in or taken off; the clients file read again; the host's certificate and the fingerprint clients pin. See The host API
ipc / ipc names [prefix] / ipc boxes / ipc peers / ipc echo [start|stop] / ipc ping <to> [count=N] [bytes=B] [window=W] [bulk] [timeout=MS] The message channel (docs/ipc.md): the host's counters -- what was sent, received and refused, the Downs, what went to peers and came from them, the bounces -- every name and its mailbox, every mailbox, the router and the peers it has told of; kernel.echo, a Cluster name, which answers what it is sent with what it was sent; and ping, N messages of B bytes to a name here or name@host, W of them in flight, by the bulk connection with bulk, every answer held to the bytes sent and to their order -- what came back, bounced, timed out or out of order, and the round trips (timed from before each send) and MB/s, a line of key=values; the first wrong answer said in full on a line before it, its bytes read back as whose and from where. See The message channel
ipcnet / ipcnet init <name> [cluster=<hex>] / ipcnet id / ipcnet add <name> <ip>[:<port>] <key> [<key>] / ipcnet remove <name> / ipcnet start / ipcnet stop The channel between hosts (a module: insmod ipcnet.ko): this host, its cluster and every peer -- up as which number, or down and why, whether this host dials it, and what went between them; hosts.toml made, with a new cluster's id or the one given; the key every peer pins; a peer pinned -- at its port where it listens on one of its own, two hosts behind one address told apart so -- or taken off -- a running server's too; serve as hosts.toml says, the host's key made at the first start; stop, every peer lost. See Between hosts: ipcnet
nbs / nbs init <name> / nbs hosts / nbs host add|remove|replace <host> / nbs recover [<name>] / nbs devices add <id|name> [wipe] / nbs devices drain <id> / nbs cs / nbs volume create <name> <size> [host=<host>] / nbs volume resize <name> <size> / nbs volume delete <name> / nbs volume snapshot <volume> <name> / nbs volume freeze <name> / nbs volume clone <image|snapshot> <name> [host=<host>] / nbs volumes / nbs volume <name> NBS's metadata service (a module: insmod nbs-mds.ko): this host's member, and the state's newest digest; an NBS cluster of this host alone; every member; a host of the cluster registry made a member, taken out for good, or taken back as a new member once it lost its state; on the last member standing, what a recover does, then -- the cluster's name given -- this host's member made the one voter and the others removed for good; a device of this host's for its chunk server, by its id or its name -- refused with something on it that is not this cluster's, unless wipe -- and one given no new chunks; every host's chunk server, its devices and its room; a volume made -- each chunk placed on three hosts, one of them its own -- grown and deleted; a snapshot of one, asked on its writer's host where it is attached, its writer paused for it; one made an image, read-only for good; a volume cloned from an image or a snapshot, thin -- each chunk shared until it is written; every volume, and what each is, and one with the hosts its replicas are on. See NBS
vnet / vnet init <name> / vnet hosts / vnet host add|remove|replace <host> / vnet recover [<name>] / vnet create <name> <net>/<prefix> [mtu=<n>] [out=no] / vnet delete <name> / vnet list / vnet ports [<network>] / vnet port <id> / vnet port create <network> <uuid> [nic=] [address=] [firewall=] [host=] / vnet port move <id> <host> / vnet port delete <id> / vnet port firewall <id> <firewall> / vnet ip [add <address> <host> | set <address> <port>|none | move <address> <host> | remove <address>] / vnet fw [create <name> [in=..] [out=..] | delete <name> | <name> [add <rule> [at=N] | del <N> | move <N> <M> | policy in=.. out=..]] / vnet alerts The cluster's networks for VMs (a module: insmod vnet.ko, plans/vnet.md): this host's member and the state's digest; a vnet of this host alone; its members, added, removed and taken back as NBS's are; on the last member standing, the one voter; a network -- a private range's subnet of /16 to /28, apart from the others' and holding no host's own address, its first address the gateway on every host -- made, deleted and listed with its ports and free addresses; a VM's NIC's port, as hv makes one (V2) -- asked again, the one there is -- moved to another host, deleted, given a firewall, and what an attach of it on this host is answered; a public address routed to a host, put on a port or none, routed elsewhere, removed; the cluster's firewalls, as hv fw has the host's; what is wrong, the worst first
nbs io attach <volume> [force] / nbs io write <volume> <offset> <bytes> <byte> / nbs io read <volume> <offset> <bytes> / nbs io flush|close|held|detach <volume> A volume's bytes through the chunk servers, from nbs-mds: attached for writing on this host, at a new generation -- force takes it from another host, whose writes the fences then refuse; bytes of one value written to every replica of the chunks they fall in, each cs fenced first; read from one replica, this host's where it has one, and shown as runs of a value; flushed and closed on every replica of the chunks written here; each cs's chunks of the volume held open; detached. Whole 4 KiB. See nbs io
nbscs / nbscs chunks / nbscs fences NBS's chunk server on this host (a module: insmod nbs-cs.ko): what it is doing -- serving, or why not -- its devices, each with its room, what is free and lost, active or draining or why it was not taken in, and what it served and refused; every chunk it holds, open or closed, of which volume and generation; every volume it fences, at which generation. See The chunk server
hv [info] / hv on [cpu|all] / hv off [cpu|all] / hv run <guest|all> [cpu] From the hv module, once it is loaded: the CPU's virtualization extension, and guests under it. hv says which extension the machine has and which CPUs it is on for -- asked of the CPUs themselves, by an IPI that reads the register, so a disagreement with what the module turned on is reported rather than hidden -- and how many times guests switched on a CPU, with whether an IBPB went between each two; under AMD-V whether automatic IBRS is on, and under VT-x what the CPU the command runs on does for its speculation around every entry -- enhanced or legacy IBRS, BHI_DIS_S, VERW, the L1D flush -- with a warning for any CPU whose IA32_SPEC_CTRL no longer has what hv on set there, read from each CPU's register. hv info adds everything the CPU said about it, a feature a line: nested paging, next-RIP save, ASIDs, x2APIC, 2 MiB nested pages, 1 GiB pages, and on arm64 the exception level the kernel is at and what stage-2 would translate into -- and the huge pool every guest's memory comes from when the boot reserved one (hugepages=), its 2 MiB pages free of how many. hv on and hv off turn it on and off for one CPU or every running one; rmmod turns it off for all of them. hv run runs a built-in guest (hv run with no name lists them all), or all of them, each in a VM of its own on a task bound to cpu when one is named, and says what it did and whether that was what it was told (x86-64, AMD-V and VT-x). See The hypervisor
hv boot <kernel> [mem=MiB] [cpus=N] [secs=N] [cpu=N] [xapic] [ioapic] [apicv|noapicv] [rxmod=US] [nooffload] [initrd=path] [disk=<path|device>[:ro]]... [pci=bus:dev.fn]... [unsafe_interrupts] [input=...] [uuid=U] [force] [cmdline=...] A Linux guest for secs (60 by default): the kernel -- a bzImage, or a PVH ELF such as /lib/hvboot, which boots the kernel the guest's own disk's grub.cfg names (see A guest's own kernel) -- and initrd read from files into its memory -- mem= MiB of it, 64 to 524288, below the devices' pages and the rest from 4 GiB, and the huge pool's when the boot reserved one (hugepages=; see How much of it, and where) -- run on a vCPU -- or with cpus=N on N of them, up to 16, each on a host CPU of its own, the first on cpu (see More than one CPU); xapic has their local APICs come out of reset in xAPIC mode, reached through the page, for a kernel that reads it before it looks at the mode firmware left (see MMIO); ioapic gives a guest of more than one CPU an IO-APIC, its devices' interrupts routed through it to any CPU and its local APICs in xAPIC mode (see The IO-APIC) -- then its console and how it ended printed, the console also going to the kernel log a line at a time (`hvguest
hv start <name|folder> [force] / hv start <kernel> [mem=MiB] [cpus=N] [cpu=N] [node=N] [xapic] [ioapic] [apicv|noapicv] [rxmod=US] [nooffload] [initrd=path] [disk=<path|device>[:ro]]... [pci=bus:dev.fn]... [unsafe_interrupts] [input=...] [log] [restart] [force] [uuid=U] [net] [network=name] [firewall=name] [public=a.b.c.d] [port=N] [forward=nos:guest]... [cmdline=...] / hv list / hv console <id> [bytes=N] / hv attach <id> / hv send <id> <text> / hv exec <id> [secs=N] <line> / hv wait <id> [secs=N] [boot=N] <text> / hv restart <id> / hv stop <id|all> [secs=N] A Linux guest that runs until it is stopped, on a vCPU task of its own bound where hv::place puts it -- whole cores of its own by default, the first CPU cpu when one is named -- with cpus=N, a task for each of its N CPUs, each on a host CPU of its own -- and what reaches it while it runs: list says which run, on which host CPUs and on which its disks are served, how the others ended, how often each was restarted and how often a frame kicked it out of its guest, and what of its network it lost -- frames for it its inbox had no room for, frames it sent as another, frames for hv0 past its share of the backlog, broadcasts past their rate, frames for another network's guests -- and which network of the switch it is on, or that it is alone there (network=: a guest reaches only the guests of its network, and none without); console prints the end of one's console, escape sequences taken out; attach, from an SSH session with a terminal (ssh -t), is the console live and typed at, until ^] detaches; send types at it now, as at a terminal -- at a login prompt too, which a script's line waits for in vain -- and from then on for that boot exec's lines go in as they are typed; exec types a line and prints the answer, up to the prompt printed after the line went in (10 s by default), and waits to type it for a shell's prompt until send has typed; wait returns once the current boot's console shows text -- with boot=N, not before the VM's Nth restart, what a script waits for after typing reboot -- or it stops; a disk= with :ro is read-only to the guest, and an image one guest's disk writes is no other's -- any number of disks read one nobody writes, and a start that would break that is refused; restart boots it again from its files, running or stopped, and restart on start does that each time the guest resets itself (a reboot) or its kernel panics (its panic device says so), at most five times a minute; uuid= is the UUID its SMBIOS gives it, a random one without; stop presses its power button, gives it secs (30 by default, 0 not to ask) to turn itself off -- a guest with ACPI shuts down when it is pressed -- pressing it again every 15 s while the guest that heard it runs, as an OS may decline a press (logind while a shutdown is inhibited) and act on a later one, then stops it and prints how it ended; one that does not listen to the button is stopped at once. log also sends its console to the kernel log (`hvvm<id>
hv convert <image> <disk|device> [force] A cloud's disk image -- QEMU's qcow2, Ubuntu's .img as it is downloaded -- made the raw disk a guest is given (disk=): a new file, grown to the image's size with a hole and written only where the disk is not zeros, so that its holes cost nothing; never over a file that is there, and removed again if the conversion fails, saying why -- with where, and "is the image whole?" for one cut short. Versions 2 and 3, every cluster size and kind, extended L2 entries; a backing file, encryption, zstd, an external data file and a corrupt mark are refused, and so is a file that is no qcow2, by what it is -- a raw disk or an ISO is given to a guest as it is (both architectures). Onto a device of nos's -- dev:<name>, part:<id>, disk:<id> -- the image's disk is written over it, zeros where the image has none, and the rest of the device given back where it takes a discard; refused for a device that is in use, and without force for one with anything on it (x86-64). See A disk from a cloud's image and A device as a guest's disk
hv image <name> <file|http(s)://image> An image of NBS's made of a cloud's image, qcow2 or raw: downloaded into the vms' folder first where it is a URL, a volume of its disk's size made on this host, the image poured onto it -- its zeros left out -- and frozen, read-only for good, for hv create <vm> image=nbs:<name> to clone a VM's disk from. Refused for a name NBS has, and for one being made on this host; one that fails leaves nothing behind -- the download removed, the volume deleted while it is a volume still and this host's. Needs nbs-mds.ko, asked through the management bus (x86-64). See NBS
hv devices / hv disk attach <vm> <device>[:ro] [force] / hv disk detach <vm> <device> A partition or a whole disk of nos's as a guest's disk, the filesystem out of the way: hv devices lists every device with its id, what it is -- a whole disk, a partition's type, an EFI System partition -- who holds it, which VMs' vm.toml name it, and of one nobody holds what is on it (an ext2/3/4 and its label, XFS, btrfs, swap, LVM, md RAID, LUKS, a partition table, ...). disk=dev:<name>, part:<id> or disk:<id> gives one on hv start, hv boot and hv create -- a vm.toml keeps the id, never the name -- and hv disk attach adds one to a stopped VM's vm.toml, detach takes it off and leaves the device as it is. Never an EFI System or BIOS boot partition or a device in use, or one overlapping either; with force only, one with something on it or one another VM's vm.toml names. A running VM holds its devices: no mount, write or other guest has them until it stops (x86-64). See A device as a guest's disk
hv pci / hv pci attach <vm> <bus:dev.fn> / hv pci detach <vm> <bus:dev.fn> The host's PCI functions as guests are given them, read and nothing changed: each one's address, ids and class, whether a driver of the host's has it or it is kept for guests (guestpci=), its reset (FLR, a bus reset, none), its interrupts (MSI-X's table size, MSI), its IOMMU group as it will be with ACS on, the VMs whose vm.toml names it, a guest holding it, and why not where it cannot be given -- DMA not translated, a bridge, no MSI-X nor MSI, a DMAR RMRR, a conventional bridge above it, a driver's, a group with a function of the host's. attach puts one on a stopped VM's vm.toml -- never one that cannot be given -- given at its next start; detach takes it off (x86-64). The vm provider's pci, pci_attach and pci_detach are the same, and the panel's VMs page lists them. See A host's PCI device
hv start <name|folder> / hv create <name> <kernel> [the words hv start takes] / hv vms A VM kept in a folder: /vms/<name>/vm.toml -- or under the folder insmod /hv.ko vms=<folder> names, which hv says -- says what to boot it with -- the words hv start takes, as TOML keys -- and its kernel, initrd and disks sit beside it, the file's paths the folder's unless they begin with /. hv start <name> boots it as the file says, a folder's path boots one anywhere; every command that takes a VM's number takes its name too, and one VM of a name is on the list at a time. Its console goes to console.log in the folder, a line from hv at every start, boot and stop. hv create writes the file from the words, never over one that is there; hv vms lists the folders and which run. hv create <name> <http(s)://image> [size=N[K|M|G|T] | onto=<device>] [password=...] [hvboot=path] [force] [words] makes a VM of a cloud's image: downloaded into the folder by the kernel's HTTP client (TLS, redirects; only a 2xx answer, never over a file), made its disk -- qcow2 converted, raw taken as it is -- and grown to size=; cloud-init's NoCloud seed beside it (seed.iso, labelled cidata: the machine named after the VM, the image's user given the keys of /etc/ssh/authorized_keys and the password); and a vm.toml booting it by hvboot, on the switch, restarted, 1024 MiB unless mem= -- nothing left behind if it fails (see A VM of a cloud's image); with onto= its disk is a device of nos's instead, the image poured onto it as hv convert pours one (force as there), and a disk= of a device is given as hv disk attach gives one. hv create <name> image=nbs:<image> [size=N[K|M|G|T]] [onto=nbs:<volume>] [words] makes one of an image of NBS's (hv image): its first disk a thin clone of it -- a volume of the VM's name, or onto='s, which NBS must not have yet -- grown to size=, the seed and vm.toml as above, the clone deleted if a later step fails. port=N gives a net guest its own port of the switch -- its address and MAC the same at every start -- network=name the network there it is on -- or network=vnet:name, a network of the cluster's (vnet.ko), its port, address and firewall vnet's, made at hv create (address= and firewall= carried out once) or its first start and deleted with its folder -- and forward=nos:guest relays nos's port to its own once it runs, from the words or the file alike; hv create writes the VM a UUID, and a vm.toml with none is given one at the VM's first start, added to its end (x86-64). See A VM in a folder
hv clone <from> <to> [port=N] / hv delete <name> [keep-disks] [force] A stopped VM's folder copied into a new one: its disks with their holes left out -- only what the filesystem keeps of them read, only what is not zeros written, the room asked for first -- a read-only disk outside the folder shared, a written one refused, and a device of nos's refused; cloud-init's seed made anew from the user-data hv create kept, so the clone is a machine of its own; its vm.toml the source's, the operator's lines kept, with a new UUID, a free port of the switch where the source had one (port= says which), no forwards and no ip=. hv delete takes a stopped VM's folder away, all of it or with keep-disks all but the disks its vm.toml names in it, its vm.toml last -- a device it names left as it is, and said; force for one whose vm.toml says protected = true. Both hold the names while they run, and leave nothing behind when they fail (x86-64). See Cloned, deleted, changed
hv bench [cpu=N] [exits=N] [pages=N] [flush] [profile] [mmio] What a VM exit costs: a guest of nothing but CPUIDs, each after a read of pages pages, on a task bound to cpu (the extension's last CPU by default), timed -- flush flushes the whole TLB on every entry, as before ASIDs, profile splits an entry into its parts, and mmio times MMIO loads instead, each a nested fault whose instruction is fetched, decoded and performed (x86-64), with profile the access's own share of the time as well. See What an exit costs
hv cores [own|shared] Whether a guest's cores are its own -- whole cores no other guest has a CPU on, its vCPUs or the task serving its disks, its vCPUs filling their threads, and a guest that would need another's core refused -- or may be shared, as before (own, the default, at every load); and which guest holds which CPUs. Guests running keep where they are (x86-64). See The hypervisor
hv forward [add <port> <vm> <guest-port> | del <port>] A port of nos's relayed to a port of a net guest's -- how a guest's server is reached from outside -- and kept in, or taken out of, the forward of its vm.toml when it has a folder, for its next start. hv forward alone lists them, with the connections each has carried (x86-64, AMD-V). The other way, a net guest reaches what nos reaches through NAT, and the switch answers its DHCP: hv list says which address the guests go out from and counts the DHCP answers. IPv6 goes between the guests only, in the prefix the switch's router advertisement gives them: hv list counts the advertisements and the addresses bound to the guests' ports. See A network
hv fw / hv fw create <name> [in=allow|deny] [out=allow|deny] / hv fw <name> [add <rule> [at=N] | del <N> | move <N> <M> | policy in=...|out=...] / hv fw set <vm> <name> / hv fw delete <name> The guests' firewalls: each VM's NIC is judged by one, both ways, at its port of the switch -- a policy each way and up to 64 rules, allow|deny in|out [tcp|udp|icmp] [ports] [from|to any|net|<a.b.c.d/n,...>], the first that matches deciding, flows remembered so that answers go by. A VM that names none is judged by default: what comes in denied, what goes out allowed. hv fw lists them and the VMs on each, hv fw <name> shows one with each rule's flows; a change is written to /etc/hv/firewalls/<name>.toml and judged by from the next frame on, the open flows it denies cut. A VM names its firewall with firewall= (vm.toml, hv start, hv create) or hv fw set; default is never deleted, nor one a VM names (x86-64). See The firewall
hv tunnel vnet's tunnel to the cluster's other hosts (plans/vnet.md V3): this hv's instance, its node and address, each host -- its next hop known, a key to it had, the keys it was given, when an echo and a full-size one last came back -- the public addresses this host serves and for which port on which host (V4), and what was sent and taken, and not, and why (x86-64). Its keys are given anew every rekey= seconds, the one before kept keylife= (insmod /hv.ko rekey=S keylife=S). See Across hosts: the tunnel
hv probe / hv probe add <name> [port=N] [network=<name>|vnet:<name>] [firewall=<name>] [public=<a.b.c.d>] [address=<a.b.c.d>] / hv probe ping <name> <a.b.c.d> [count=N] [secs=S] / hv probe udp <name> <a.b.c.d> <port> [count=N] [secs=S] [sport=N] / hv probe del <name> A probe: a port of the guests' switch with no VM behind it -- its address and MAC the port's, on a network or alone, judged by a firewall as a VM's NIC is -- which answers ARP, echo and UDP to port 7, and pings and sends UDP from the port the way a guest's NIC does: each run says how many of its sends were answered, refused (ICMP communication administratively prohibited -- a firewall's) or otherwise unreachable. What a network and its firewall are checked with before any guest boots, and on a host that runs; on a network of the cluster's (network=vnet:<name>) a port of vnet's under a UUID of its own, at address=, deleted with the probe, hv probe saying where one is shut or unconfirmed (x86-64). See The firewall and The cluster's networks
hv help Every hv subcommand, a line each
netblk list / netblk stop <port>|all The instances served and their counters; stop one, or all -- waiting for what the disk still has in flight
lsmod List the modules: name, size, load address, how many kernel functions each binds to, and which are permanent, still loading or still unloading, each in a column. Never waits on a load or unload in progress
rc [add <line>|del <n>|clear|run] Show or edit /etc/rc: shell commands, a line each (blank lines and # comments skipped), that the shell's task runs once at boot after DHCP -- how a module such as sshd gets loaded and started on a machine nobody can reach until it is. rc numbers the lines, add appends one, del takes one out, clear removes the file, run runs it now. What it prints at boot goes to the kernel log and the screen; rc=off skips it
usb Show xHCI controllers, connected root ports and keyboard report counters
panic [type] Trigger kernel panic: direct, or pf (page fault), div0 (divide by zero), ud (invalid opcode), df (a real double fault, x86-64: a stack pointer no access can use, the report from the IST stack), offstack (a panic on a stack that is no task's, with preemption on), overflow (this task's stack run out, into the unmapped page under it) -- the last three what panic-test.sh drives; splitlock (a locked add across two cache lines: a panic that says so where split lock detection is on, x86-64 parts that have it; a line that says it ran through elsewhere)
deadman [off|<secs>] The boot's deadline (deadman=N): where it stands, off to call it off -- a trial boot that turned out well -- or <secs> (10 to 86400) to set it that far from now; past it the kernel panics, saying why, and panic=M resets the machine
version Show kernel version
poweroff / shutdown Power off (ACPI S5: the sleep type the firmware's DSDT names in \_S5, written to the PM1 control registers the FADT names; with no \_S5 read the kernel says so and halts instead of guessing one)
reboot Reset system (keyboard controller)

Line editing

At the console -- the screen with its PS/2 or USB keyboard, or a terminal on the serial port -- and in an SSH session with a terminal, a line is edited with the same keys:

Key What it does
Enter Runs the line
Backspace Takes back the last character
Up, Down (^P, ^N) Back through the last 32 lines run, and forward again to the one being typed
^R Searches back through them for a line that holds what is typed after it, as bash's (reverse-i-search)'query': line. ^R again finds the next older one, Backspace takes a character off the query, Enter runs what was found, ^G puts back the line from before the search, and any other key -- an arrow, ^U -- keeps what was found, to be edited
^C Drops the line
^U Clears it

A line of nothing but spaces is not kept, nor the same line twice running. The console's history is its own and each SSH session's is its own; none outlives the boot. Over SSH, ^L also clears the screen and ^D on an empty line logs out. A console or SSH line is at most 1,023 characters.

The keyboards send what a terminal would -- an arrow as ESC [ A..D, Ctrl and a letter as its control byte -- so the console's editor (src/base/kernel/line_editor.cpp) reads a keyboard as it reads the serial port; the screen knows only text and Backspace, and a line is redrawn by erasing back to where it changed. scripts/udpsh.py, the UDP shell's client, edits on the host with readline -- the same keys -- and keeps its history in ~/.nos_udpsh_history.