@@ -13,6 +13,7 @@ Note that usually you don't need to modify Sysbox's default configuration.
13
13
- [ Sysbox Data Store Configuration \[ v0.3.0+ \] ] ( #sysbox-data-store-configuration--v030- )
14
14
- [ Container Capabilities Configuration \[ v0.5.0+ \] ] ( #container-capabilities-configuration--v050- )
15
15
- [ 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 )
16
17
- [ Disabling ID-mapped Mounts on Sysbox] ( #disabling-id-mapped-mounts-on-sysbox )
17
18
- [ Disabling Shiftfs on Sysbox] ( #disabling-shiftfs-on-sysbox )
18
19
- [ Sysbox Kernel Parameter Configurations] ( #sysbox-kernel-parameter-configurations )
@@ -304,6 +305,53 @@ option (see [above](#reconfiguration-procedure). If you set
304
305
with the default behavior by passing environment variable
305
306
` SYSBOX_ALLOW_TRUSTED_XATTR=TRUE ` .
306
307
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
+
307
355
## Disabling ID-mapped Mounts on Sysbox
308
356
309
357
As mentioned in the [ design chapter] ( design.md#id-mapped-mounts--v050- ) , Sysbox
0 commit comments