NEXItaliano

NEX › Manual pages › nexctl(8)

NEXCTL(8) NEX Administration NEXCTL(8)

nexctl - NEX node life cycle: compute and storage roles, PKI, cluster users

nexctl [--config FILE] validate | plan | status | join
nexctl leave [--terminate [--kill]] [--force]
nexctl compute sessions|evict [NAME]
nexctl smb enable|disable|status|share-add|share-remove|share-list [NAME] [--path DIR] [--group GROUP] [--readonly]
nexctl upgrade (--deb FILE ... | --apt | --script FILE) [--nodes A,B] [--expect-version X] [--timeout S] [--dry-run]
nexctl apt status|update|install|upgrade [PACKAGE...] [--nodes A,B] [--timeout S] [--reboot] [--dry-run]
nexctl storage status|maintenance-enter|maintenance-exit|drain-check|drain [--host HOST]
nexctl pki init|request|sign|install|status [--csr ...] [--out ...] [--cert ...] [--ca ...]
nexctl agent peers|peer-add|peer-remove [NODE] [--addr IP] [--no-reload]
nexctl disk|usb attach|detach|list [NODE/NAME]
nexctl encryption status|transit [on|off]
nexctl secrets init|status
nexctl aptcache enable|disable|status [--ip IP/PREFIX]
nexctl print enable|disable|add|remove|allow|announce|list|status [NAME]
nexctl scan add|remove|share|unshare|list|status [NAME]
nexctl software init|add|remove|list|status [NAME/VERSION] [--prefix DIR] [--group GROUP] [--description TEXT]
nexctl users init|add|passwd|keys|lock|unlock|remove|groups|group-add|group-remove|list|apply|status|quota|forget-old [NAME] [options]

All answers are JSON on stdout; errors go to stderr with exit code 1 (2 for an error in the command line). The node configuration is /etc/nex/node.json (owned by root, not writable by group and others); with the compute role it contains "storage": {"type": "nexfs"}.

mounts NEXFS on the cluster mount point with the nexfs-client@ unit of the nexfs package (for /nex: nexfs-client@nex.service), using the client configuration /etc/nexfs/nexfs.json and the node certificate; the options are those in compute.options plus nodev and nosuid. Then it mounts the bind mounts (full rollback if anything fails) and removes the service drain set by an earlier leave command.
detaches the node while it is running. First it puts the node in drain for the services (nex service) and waits, up to drain_timeout + 60 s, for their instances to move to other nodes without interruption. Then it refuses if there are still processes on the shared filesystem, unless --terminate (SIGTERM, then wait up to drain_timeout seconds) and --kill (SIGKILL to those that remain) are given; --force when the storage does not answer (umount -f). The mount point is left empty and immutable.
status, planned steps, configuration check.
SMB share of /nex for Windows PCs on this compute node: Samba with the smb.conf generated by NEX (the original is kept in smb.conf.nex-orig), cluster users with the NT hash in /var/lib/nex/smbpasswd, home and project directories; NetBIOS off.
[--readonly], smb share-remove NAME, smb share-list project directories shared with a cluster group; they take effect on all nodes with SMB enabled within one minute (users apply).
not needed with NEXFS: the session of a node that is gone expires by itself after 15 s, and the locks and grants it held are released without any action. The two commands say so and exit with 1.

A storage node is a NEXFS data node and, while the cluster has fewer than three meta nodes, also a meta node. The commands run on the admin node and use nexfsctl(8); --host selects the node (default: this one).

the node among the NEXFS data nodes and meta nodes, and the cluster health.
a short stop (upgrade, reboot): NEXFS does not rebuild the node's copies elsewhere, and a meta node stops voting, so that the others do not wait for it. On exit the node is back in service; a meta node votes again once it has caught up.
tells whether the node can be removed: at least as many other live data nodes remain as there are copies, and their free space is enough for its blocks.
permanent removal, after the same check: the node leaves the meta nodes and its blocks move to the other data nodes until the state drained (30 minutes at most). The next field of the answer lists the final steps: stop nexfsd on the node, nexfsctl node forget and nex-setup remove.
does not add nodes: a storage node joins from the new node, with nex-setup add --roles storage --disk DIR (see nex-setup(8)).

the disks of the machine: the folders NEXFS uses (nexfs_folders, with the disk they are on and the free space) and the state of every disk: nexfs (a data disk of the cluster), free (empty, it can be added), system (the system is on it), in use (mounted elsewhere), not empty (partitions or a filesystem), too small (under 10 GB).
one more empty disk for this data node (16 at most). It asks to type the name of the disk to confirm (without a terminal: --confirm), formats it ext4, mounts it on /srv/nexfs/discoN from /etc/fstab with its UUID and nofail, then nexfsctl disk add adds it to the NEXFS configuration and restarts nexfsd in an orderly way. The blocks written from then on are created on the disk with the most free space; those already there stay where they are. A disk with something on it is never formatted: empty it by hand (wipefs). The answer gives health (the cluster state after the restart) and joined (nexfsd took the disk). The same from NEX Setup, on a node already set up: Add a disk.

cluster CA (init), node certificate request (the key never leaves the node), signing, installation and verification.

list of the nodes the agent talks to; a change reloads the agent without stopping the jobs.

A single source, /nex/.nex/users.json (root 0600), applied on every compute node by users apply (at join time and every minute by nex-users.timer).

new user (uid 20000-29999) with home in /nex/home.
password (asked twice, or as a hash on stdin).
adds the public keys of the files to .ssh/authorized_keys in the user's home on the shared filesystem, skipping duplicates; with --clear the keys already there are replaced (with no --ssh-key they are all removed). users.json does not change: the keys live only in the home. The answer gives the number of keys now in the file.
locks, unlocks or removes the user (the home is never touched, not even by remove).
new cluster group; list of users and groups without secrets.
what this node has applied compared with the cluster: the users.json version applied here (applied_version, from /var/lib/nex/users.json), the users this node manages (managed_users), the current version in /nex/.nex/users.json (cluster_version) and in_sync (true when the two versions are equal). Without /nex mounted cluster_version is null and in_sync false.
the user's cluster groups become exactly these (empty: none).
the group leaves the cluster and the next apply removes it from the nodes; refused while a user is a member. Files with that gid are kept, with the number.
NEXFS quota of the home and per-node limits on CPU (percent of one CPU) and memory; none removes a limit.
brings this node to the cluster state: all or nothing if there is a conflict with a local user. It also keeps the homes at 0700 and the ranges in /etc/subuid and /etc/subgid of the cluster users (rootless containers).
the accounts and groups left on this node by a previous cluster (uid and gid in the cluster range, not known to the cluster of now), and the files they own on the local disks. Without --yes it only lists them. With --yes: an account with the same name and uid as a user of this cluster is adopted and left as it is; the others are removed (the home is not touched), their local files are given to root and listed in /var/lib/nex/old-accounts-DATE.txt; an account with running processes is skipped and reported. When such an account takes the name or the uid of a user of this cluster, users apply stops and points here. nex-setup lists them after configuring a node, and never removes them by itself.

attaches the disk NAME exported by NODE (line of /etc/nex/devnodes.conf with a block device and WHO root) as /dev/nbdN, with the link /devnodes/NODE/disk/NAME; it runs in the unit nex-disk-NODE-NAME. One node at a time: the disk's node opens it exclusively.
detaches (refuses if the disk is mounted), lists the disks attached here.
the same for a USB device exported by NODE (PATH /sys/bus/usb/devices/BUSID, WHO root): USB/IP with usbip-host on its node and vhci_hcd here, in the channel between the agents; on detach it goes back to its driver.

one node at a time, the service leader last: drain (services, virtual addresses, queue), upgrade on the node in a unit of its own (nex-upgrade, log in /var/log/nex-upgrade.log), wait for the agent to restart with the expected version and for /nex to be mounted, undrain, wait for the services to be as healthy as before the drain and for NEXFS to be whole again (every metadata and data node up, no block missing a copy) before the next node. At the end of the round it raises the NEXFS metadata level (nexfsctl meta level --raise), if all meta nodes can apply it (storage_level in the answer). Files and scripts in /nex/.nex/pkg (owned by root, not writable by others). Before starting: all nodes answer and there is no critical alarm. It stops at the first error and the node stays in drain. Storage-only nodes, which do not mount /nex, receive the files through the agent (checked with SHA-256) and are upgraded like the others. --dry-run shows the order. Progress on stderr, JSON summary on stdout; exit code 1 if the round stops.

The same commands as nex apt; root only, from any node of the cluster.

for every node: updates pending according to the package lists already downloaded (upgradable), how many come from the security archive (security), whether the node asks for a reboot (reboot_required, from /run/reboot-required, with the packages that asked for it) and the age of the lists (lists_age_s). It changes nothing.
apt-get update on every node at the same time, each in the nex-upgrade unit.
apt-get install of the same packages on every compute node (where programs run), or on the nodes of --nodes, at the same time; no drain is needed. Names are checked before touching any node: a Debian package name, optionally followed by :ARCH, =VERSION or /RELEASE.
the whole system (apt-get update and apt-get upgrade --with-new-pkgs, which installs new dependencies such as a new kernel and never removes packages), one node at a time with the same round as upgrade, storage-only nodes included. With --reboot a node that asks for a reboot is rebooted while still drained, and the round waits for it to come back with its agent and /nex before the undrain; the node running the command is never rebooted (the answer says so: run it again from another node with --reboot --nodes NODE). Without --reboot the answer lists the nodes that need one (reboot_required).

apt update, apt install and apt upgrade take the same cluster lock as upgrade: one at a time in the whole cluster. Exit code 1 if a node does not succeed (its error and the end of its log are in the JSON summary).

the /nex traffic is always encrypted: NEXFS uses mutual TLS 1.3 between all nodes and clients, with certificates from the cluster CA. status confirms it (transit), tells whether the blocks on the disks of this node are encrypted (at_rest: AES-256-XTS on a data node created with the block key, which nex-setup creates for every new storage node) and how /nex is mounted here (this_node). transit on confirms that there is nothing to change; transit off is refused.
the cluster key of nex secret (/etc/nex/secrets.key, 32 bytes in hexadecimal, root 0600, the same on every compute node; with other permissions it is not used). init (root) creates it on this node, once only: it refuses if it already exists, because regenerating it would make the stored secrets unreadable. nex-setup copies it to new nodes; to nodes already in the cluster it is copied by hand (command in the field next). status shows the fingerprint (never the key) on this node and on every compute node; to_fix counts those without the same key.
shared software in MOUNT/opt (usually /nex/opt), installed once and used by every node with module load (Lmod, package lmod, on every compute node; the profile /etc/profile.d/00-nex-modules.sh adds /nex/opt/modulefiles to the modules). init (root) creates opt and opt/modulefiles; with --group GROUP the directories belong to the group (2775) and its members install without root. add NAME/VERSION --prefix DIR writes the Lua modulefile: PATH, LD_LIBRARY_PATH, MANPATH, PKG_CONFIG_PATH and CPATH for the subdirectories of DIR that exist, and NAME_ROOT; DIR must be on the shared filesystem. remove removes the modulefile (not the software), list the modules with their prefix, status directories, group, Lmod and profile on this node.
cluster APT package cache: apt-cacher-ng (package to be installed on every compute node) as the NEX service aptcache of the cluster user nex-apt, with the cache in /nex/.nex-aptcache and the virtual address aptcache.nex that follows the service. nexctl users apply (every minute) writes on every node /etc/apt/apt.conf.d/01nex-aptcache (Proxy-Auto-Detect with nex-apt-proxy: the cache if it answers within 500 ms, otherwise direct) and turns off the Debian apt-cacher-ng service. disable removes service, address and proxy, not the cache. status tells whether the cache is on and reachable and how much space it uses.
the printers of the cluster (CUPS, driverless printers: IPP Everywhere, AirPrint). enable turns on cupsd on this compute node (the cups package must be installed) as a print server, with the same queues as the other servers; the first time --ip gives the virtual address print.nex (port 631: it stays on a server where cupsd answers). From then on nexctl users apply (every minute) writes on every node /etc/cups/client.conf with ServerName print.nex: lp, lpr and the print dialogs see the queues of the cluster. On the servers it turns off cups-browsed (it would recreate the queues announced by the other servers). disable turns off the server on this node; --cluster also the printing of the cluster (address and client.conf).
a printer for the whole cluster (ipp://, ipps://, http://, https://): every server makes the queue NAME within a minute. The printer must answer when the queue is created (if it does not, the next round tries again). A printer that needs a driver gets --driver MODEL (a driver installed on every print server, as lpinfo -m names it) or --ppd FILE (the PPD of the maker, copied to /nex/.nex/print); then the address can also be socket:// or lpd://. A server without the driver does not make that queue and says so in the warnings of users apply. With --usb (instead of --uri, on the node where the USB printer is plugged in) the printer goes through ipp-usb (IPP over USB): nexctl opens it to the network (interface = all, dns-sd = disable in /etc/ipp-usb/ipp-usb.conf), reads its port in /var/ipp-usb/dev and registers ipp://NODE.nex:PORT/ipp/print; with several USB printers on the node, --port chooses one. When the last USB printer of the node is removed, users apply closes ipp-usb again. print remove NAME removes it from all servers. print allow NAME --users all|USER,@GROUP,... who may print (cluster users and groups). print announce on|off announcement of the printers on the office network (mDNS with Avahi), on by default: only the server that holds print.nex announces. print list the printers; print status the printing of the cluster, this node and the queues.
the scanners of the cluster. No server: on every compute node nexctl users apply writes the SANE configuration, and the scanning programs use the scanner from their own node. A network eSCL scanner (or WSD with --wsd) goes into /etc/sane.d/airscan.d/nex.conf (sane-airscan); --usb (on the node of the IPP-over-USB multifunction) uses the eSCL of ipp-usb, like print add --usb. scan remove NAME removes it. scan share (on the node of a USB scanner with a SANE driver) turns on saned (saned.socket), open to the nodes of the cluster only (NEX block in /etc/sane.d/saned.conf), and the other nodes find it with the net backend (NEX block in /etc/sane.d/net.conf); scan unshare turns it off. scan list the scanners and the nodes that share; scan status also those SANE finds from this node (scanimage -L).

/etc/nex/node.json
node configuration.
/etc/nexfs/nexfs.json
NEXFS configuration of the node, written by nex-setup: join uses it to mount /nex.
/etc/nex/pki/, /etc/nex/ca/
node certificates and cluster CA.
/var/lib/nex/
user state applied on the node, local copy of the ssh keys.

nex-setup(8), nexagentd(8), nex(1), nexfsctl(8), nexfs-client(8), /usr/share/doc/nex-cluster/installazione.md

November 2026 nexctl 2.20.0