chroot(1) on Solnix vs Linux and the BSDs
The published Solnix chroot(1) page is the GNU coreutils page, but a default Solnix system runs the illumos chroot at /usr/sbin/chroot, which the bundle does not describe. The published page is identical to Linux chroot(1) and uses long options (--userspec, --groups), while the BSDs use -u, -g and -G.
The manual pages
What Solnix runs
The page is published by pkgs.solnix.coreutils and describes GNU coreutils chroot. The command on PATH by default is the illumos /usr/sbin/chroot, and no illumos chroot text is in the bundle. The options, defaults and exit statuses below are therefore those of the GNU page, and the manual does not say whether the illumos binary behaves the same. No other illumos variants are shipped. To be sure of GNU behaviour, install pkgs.solnix.coreutils and call that binary.
Differences
| Compared with | Topic | What differs |
|---|---|---|
| Linux | same program as Linux | The published Solnix page and the Linux page document the same GNU coreutils chroot: the same options (--groups, --userspec, --skip-chdir, --help, --version), the same default shell and the same exit statuses. The Linux page lists the synopsis with [OPTION]....Source: Solnix chroot(1) SYNOPSIS, DESCRIPTION; Linux chroot(1) SYNOPSIS, DESCRIPTION |
| FreeBSD, OpenBSD, NetBSD | user and group options | The Solnix page uses --userspec=USER:GROUP (ID or name) and --groups=G_LIST. FreeBSD, OpenBSD and NetBSD use -u user and -g group instead, with no long options. FreeBSD and NetBSD also have -G for supplementary groups. OpenBSD has no -G.Source: Solnix chroot(1) --userspec, --groups; FreeBSD chroot(8) -u, -g, -G; OpenBSD chroot(8) -u, -g; NetBSD chroot(8) -u, -g, -G |
| FreeBSD, OpenBSD, NetBSD | user and group in one option | Solnix --userspec takes USER:GROUP in one argument. The BSD pages set the user with -u and the group with -g as separate options. The BSD pages do not document a USER:GROUP form.Source: Solnix chroot(1) --userspec; FreeBSD chroot(8) -u, -g; OpenBSD chroot(8) -u, -g; NetBSD chroot(8) -u, -g |
| FreeBSD, OpenBSD, NetBSD | -g takes different values | On OpenBSD, -g takes a comma-separated list: the first group becomes the primary group and the rest become supplementary groups. On FreeBSD and NetBSD, -g takes a single group, and -G supplies the list. Solnix --groups is a list of supplementary groups.Source: OpenBSD chroot(8) -g; FreeBSD chroot(8) -g, -G; NetBSD chroot(8) SYNOPSIS; Solnix chroot(1) --groups |
| all four | working directory after chroot | Solnix has --skip-chdir to keep the current working directory instead of changing to '/'. The FreeBSD page says it changes its current and root directories to newroot. No BSD page documents an option to skip this.Source: Solnix chroot(1) --skip-chdir; FreeBSD chroot(8) DESCRIPTION; OpenBSD chroot(8) OPTIONS; NetBSD chroot(8) OPTIONS |
| FreeBSD, OpenBSD, NetBSD | default shell | With no command, Solnix runs '"$SHELL" -i', defaulting to '/bin/sh -i'. The BSD pages run an interactive copy of the user's shell: SHELL is used if set, otherwise /bin/sh. They do not mention the -i flag.Source: Solnix chroot(1) DESCRIPTION; FreeBSD chroot(8) ENVIRONMENT; OpenBSD chroot(8) ENVIRONMENT; NetBSD chroot(8) ENVIRONMENT |
| FreeBSD, OpenBSD, NetBSD | documented exit status | Solnix documents 125 (chroot itself failed), 126 (command found but cannot be invoked) and 127 (command not found); otherwise the command's own status is returned. The FreeBSD, OpenBSD and NetBSD pages have no exit status section. Source: Solnix chroot(1) Exit status; FreeBSD chroot(8); OpenBSD chroot(8); NetBSD chroot(8) |
| FreeBSD | -n and no-new-privileges | FreeBSD -n uses PROC_NO_NEW_PRIVS_CTL, which disables SUID/SGID bits. If sysctl security.bsd.unprivileged_chroot is 1, it also allows chroot without superuser privileges. Solnix has no equivalent option.Source: FreeBSD chroot(8) -n; Solnix chroot(1) SYNOPSIS |
| OpenBSD | superuser restriction and login.conf | OpenBSD states chroot is restricted to the superuser. OpenBSD -u also sets groups from passwd(5)/group(5) and may apply login.conf(5) settings. The Solnix page documents neither.Source: OpenBSD chroot(8) DESCRIPTION, -u; Solnix chroot(1) DESCRIPTION |
| NetBSD | identity change timing | NetBSD sets user and group after the chroot has taken place, and runs the command as your real user ID. The Solnix page does not say when identity changes happen. Source: NetBSD chroot(8) DESCRIPTION; Solnix chroot(1) --userspec |
Standards
- POSIX: chroot is not a POSIX.1-2024 utility.
- FreeBSD: HISTORY: chroot first appeared in AT&T System III UNIX and 4.3BSD-Reno.
- OpenBSD: HISTORY: chroot first appeared in 4.3BSD-Reno.
- NetBSD: HISTORY: chroot first appeared in 4.4BSD.
Writing portable scripts
- Do not use
--userspec,--groupsor--skip-chdirin portable scripts: they are GNU-style long options and the BSD pages do not document them.-uand-gwork on all three BSDs, but the GNU page does not list them. - To run as another user portably, chroot as root into newroot and start a command that drops privileges inside it, rather than relying on
-u,-g,-Gor--userspec.
Every difference here is taken from the manual pages linked above: Solnix's published page, Linux (man-pages and the GNU and util-linux manuals), FreeBSD, OpenBSD and NetBSD. Each row names its source. Where a manual is silent, this page is too. Compiled 2026-10-26. Found a mistake? Mail hackers@lists.solnix.io.