Skip to content

Commit 4e588d0

Browse files
ctalledorodnymolina
authored andcommitted
[docs] Add description of the ignore-sysfs-chown config.
Signed-off-by: Cesar Talledo <[email protected]>
1 parent 8142737 commit 4e588d0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/user-guide/configuration.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Note that usually you don't need to modify Sysbox's default configuration.
1313
- [Sysbox Data Store Configuration \[ v0.3.0+ \]](#sysbox-data-store-configuration--v030-)
1414
- [Container Capabilities Configuration \[ v0.5.0+ \]](#container-capabilities-configuration--v050-)
1515
- [Speeding up Sysbox by Disallowing Trusted Overlay Xattributes](#speeding-up-sysbox-by-disallowing-trusted-overlay-xattributes)
16+
- [Ignoring Chowns of Sysfs](#ignoring-chowns-of-sysfs)
1617
- [Disabling ID-mapped Mounts on Sysbox](#disabling-id-mapped-mounts-on-sysbox)
1718
- [Disabling Shiftfs on Sysbox](#disabling-shiftfs-on-sysbox)
1819
- [Sysbox Kernel Parameter Configurations](#sysbox-kernel-parameter-configurations)
@@ -304,6 +305,53 @@ option (see [above](#reconfiguration-procedure). If you set
304305
with the default behavior by passing environment variable
305306
`SYSBOX_ALLOW_TRUSTED_XATTR=TRUE`.
306307

308+
## Ignoring Chowns of Sysfs
309+
310+
Inside a Sysbox container, the `/sys` directory (i.e., the sysfs mountpoint)
311+
shows up as owned by `nobody:nogroup` (rather than `root:root`). Moreover,
312+
changing the ownership of `/sys/` to `root:root` fails with `Operation not
313+
permitted`. This is due to a technical limitation in Sysbox and the Linux
314+
kernel.
315+
316+
```
317+
$ docker run --runtime=sysbox-runc -it --rm alpine
318+
319+
/ # ls -l / | grep sys
320+
dr-xr-xr-x 13 nobody nobody 0 Mar 11 23:14 sys
321+
322+
/ # chown root:root /sys
323+
chown: /sys: Operation not permitted
324+
```
325+
326+
Though not common, some application that users run inside Sysbox containers
327+
(notably the `rpm` package manager) may try to change the ownership of `/sys`
328+
inside the container. Since this operation fails, the application reports an
329+
error and exits.
330+
331+
To overcome this, Sysbox can be configured to ignore chowns to `/sys` inside
332+
the container by passing the `SYSBOX_IGNORE_SYSFS_CHOWN=TRUE` environment variable
333+
to the container, as shown below:
334+
335+
```
336+
$ docker run --runtime=sysbox-runc -e SYSBOX_IGNORE_SYSFS_CHOWN=TRUE --rm -it alpine
337+
338+
/ # chown root:root /sys
339+
/ # echo $?
340+
0
341+
342+
/ # ls -l / | grep sys
343+
dr-xr-xr-x 13 nobody nobody 0 Mar 11 23:17 sys
344+
```
345+
346+
You can also configure this globally (i.e., for all Sysbox containers), by
347+
starting the sysbox-mgr with the `--ignore-sysfs-chown` command line
348+
option (see [above](#reconfiguration-procedure).
349+
350+
Note that configuring Sysbox to ignore chown on sysfs requires that Sysbox
351+
trap the `chown` syscall. This can slow down the container, in some
352+
cases significantly (i.e., if the processes inside the container perform
353+
lots of chown syscalls).
354+
307355
## Disabling ID-mapped Mounts on Sysbox
308356

309357
As mentioned in the [design chapter](design.md#id-mapped-mounts--v050-), Sysbox

0 commit comments

Comments
 (0)