Sysbox Runtime
Overview
The default Docker container runtime is runc. Sysbox is a free, open-source, drop-in replacement runtime originally developed by Nestybox. This guide installs Sysbox, configures Kasm Workspaces to launch sessions on it, and enables sudo for workspace users. As a result, users can install software, use root or sudo, and run system-level software such as systemd, buildx, and Docker, while the Kasm Agent stays protected against container breakout. When a workspace runs on Sysbox, it behaves much closer to a virtual machine, so users in a shared environment operate at root level with a lower risk of escaping isolation. For background on the security benefits, see the Sysbox User Guide: Security.
The following Kasm Workspaces core images, and all variants built on top of them, support a systemd init methodology and therefore run on the Sysbox runtime:
When a Kasm Workspaces session uses the Sysbox runtime, it can take longer to become ready compared to a session launched with native Docker init. The delay comes from the general overhead of shiftfs and from running a full systemd init chain before the KasmVNC service starts.
Limitations of Kasm with Sysbox
The following features are incompatible with Sysbox:
- Persistent profiles.
- NVIDIA GPU support within Kasm Workspaces.
- Limited storage mapping or volume mapping support. No support exists between workspaces that use Sysbox and workspaces that do not. For details, see Map storage with Sysbox.
Prerequisites
Before you begin, confirm the following:
- A supported host operating system. Review the supported Linux distributions and the official installation guide.
- A Linux kernel of at least 5.15, which is the minimum compatible kernel for Sysbox. Kasm recommends an Ubuntu Jammy host running the 6.5 LTS kernel, because that kernel integrates
shiftfs. For a kernel between 5.15 and 6.3, follow Install shiftfs. - Administrator access to the Kasm Workspaces deployment, with permission to edit Workspaces and Group settings.
- Root or sudo access on the Kasm Agent host to install packages and runtimes.
This guide does not replace the official Sysbox documentation. It documents the recommended setup for using the sysbox-runc runtime with Kasm Workspaces.
Solution approach
This guide progresses through the following phases:
- Install the Sysbox runtime on the Kasm Agent host.
- Configure a workspace to use the Sysbox runtime.
- Enable sudo for workspace users.
- Map storage to Sysbox workspaces.
Detailed steps
Install the Sysbox runtime
Install Sysbox after Docker is installed but before Kasm Workspaces is installed. Sysbox can be installed on a host with an active Kasm Workspaces deployment, but Kasm cannot guarantee that containers will not be removed or deleted.
-
Download and extract the Kasm installer so that the required Kasm dependencies install correctly. Navigate to the
kasm_releasedirectory and run theinstall_dependencies.shscript. This script installs all Kasm prerequisites, including Docker.cd /tmpcurl -O https://kasm-static-content.s3.amazonaws.com/kasm_release_1.19.0.tar.gztar -xf kasm_release_1.19.0.tar.gzsudo bash kasm_release/install_dependencies.sh -
Install the Sysbox runtime package.
sudo apt-get install jq wgetwget -O sysbox.deb https://github.com/nestybox/sysbox/releases/download/v0.6.7/sysbox-ce_0.6.7.linux_amd64.debsudo apt-get install ./sysbox.debtipFor the most up-to-date Sysbox download link and for other architectures, refer to the official Sysbox GitHub releases page.
-
Confirm that the Docker daemon was configured correctly.
cat /etc/docker/daemon.jsonThe output includes the
sysbox-runcruntime:{"runtimes": {"sysbox-runc": {"path": "/usr/bin/sysbox-runc"}},"bip": "172.20.0.1/16","default-address-pools": [{"base": "172.25.0.0/16","size": 24}]}
Configure a workspace to use the Sysbox runtime
Any workspace that uses the Sysbox runtime must set its runtime and use systemd for init.
-
Apply the following
Docker Run Config Override (JSON)to the workspace.{"runtime": "sysbox-runc","entrypoint": ["/sbin/init"],"user": 0} -
Apply the setting at the scope you need. Set it per workspace under Admin > Workspaces > Edit > Docker Run Config Override (JSON). Set it at the group level under Access Management > Groups > Edit > Settings tab > Add Setting >
run_config.
When a workspace uses the Sysbox runtime, it loses the ability to use an NVIDIA GPU through the NVIDIA Container Runtime. DRI3 with open-source drivers still functions in a Sysbox workspace. For details, see the DRI3 documentation.
Enable sudo for workspace users
With Sysbox installed and set as the workspace runtime, enable sudo for the workspace.
-
On the workspace configuration page, scroll to the Docker Exec Config block.
-
Add the following JSON block. It runs as root when the workspace first launches, installs sudo, and adds
kasm-userto the sudoers group. For more detail, see Installing and Configuring sudo via Docker Exec.{"first_launch":{"user":"root","cmd":"bash -c '/usr/bin/desktop_ready && apt-get update && apt-get install -y sudo && echo \"kasm-user ALL=(ALL) NOPASSWD: ALL\" >> /etc/sudoers'"}}
Map storage with Sysbox
When you use a Storage Provider or volume mapping configuration with Sysbox, attaching the same Storage Provider or volume mapping to a non-Sysbox container will cause permission problems between workspaces. The owner of the files and folders in a Sysbox container differs from the owner in a non-Sysbox container. The steps below explain why this happens and why it matters.
Using Kasm's Storage Provider or volume mapping with Sysbox changes how the feature normally works. For background, see the Sysbox documentation and the documentation on User Namespace ID Mapping.
When Kasm starts a workspace container normally, it runs the container as a user called kasm-user inside all of its workspaces. For details, see Building Custom Images. This user has a UID (User ID) and GID (Group ID) of 1000. When Kasm maps storage or volume drives to a workspace, the UID and GID of 1000 grant permission to the files and folders in the shared drive. For this reason, most of Kasm's Storage Mapping documentation uses a config similar to the following JSON:
{
"driver" : "rclone",
"driver_opts" : {
"type" : "s3",
"s3-provider" : "AWS",
"s3-env-auth" : "false",
"s3-region" : "us-east-1",
"uid" : "1000",
"gid" : "1000",
"allow_other" : "true"
}
}
In the JSON above, the "uid" : "1000" and "gid" : "1000" values set permissions on all files and folders in the share to match the kasm-user UID and GID. The workspace user then has permission to view and modify files and folders in the mapped volume. To adjust these values for Sysbox, you need to understand how Sysbox remaps UID and GID values and what Kasm does with them for file and folder permissions.
Sysbox changes permissions because it remaps the host UID and GID values to random, high values with no or very limited permissions on the host. Under the hood, the sysbox-runc runtime uses Docker's User Namespaces to handle this remapping. This allows apparent root access inside the container, while associating all container processes with a random high UID and GID value on the host.
Follow these steps to calculate the correct UID and GID for the storage or volume mapping.
-
List the host users and their UID and GID values by reading
/etc/passwd.$ cat /etc/passwd...opc:x:1000:1000::/home/opc:/bin/shubuntu:x:1001:1001:Ubuntu:/home/ubuntu:/bin/bashkasm:x:1002:1002::/home/kasm:/bin/shsysbox:x:1003:1003::/home/sysbox:/bin/false...On this host, four users have login permissions, with UID values from 1000 to 1003 and GID values from 1000 to 1003.
-
View the Sysbox remapped UID and GID values by reading
/etc/subuidand/etc/subgid.$ cat /etc/subuidopc:100000:65536ubuntu:165536:65536kasm:231072:65536sysbox:296608:65536$ cat /etc/subgidopc:100000:65536ubuntu:165536:65536kasm:231072:65536sysbox:296608:65536noteWhen using Sysbox CE, the only user responsible for running containers is the
sysboxuser. The only UID and GID values of importance in/etc/subuidor/etc/subgidare those associated with thesysboxuser.In these files, Sysbox has remapped the
sysboxuser from a host UID of 1003 and host GID of 1003 to a random high UID of296608and a random high GID of296608. It has also given the user a total of65536additional UID and GID values for any other required users inside its containers. From the host perspective, when a container runs on thesysbox-runcruntime, all processes and file or folder permissions associate with the UID and GID of296608on this host (this will likely be different on yours). From the container perspective, the user isrootwith a UID and GID of0. -
Confirm the remapping by running a container on the Sysbox runtime and inspecting it from both the container and the host.
Check Sysbox Runtime ## Run a container using the `sysbox-runc` runtimeubuntu@kasm-agent:~$ docker run --runtime=sysbox-runc --name=sysbox-test --rm -d alpine tail -f /dev/null2a70c22a9c3af66e3f4f76df3de9cf46dafed97ac7831953b0ebc3561eeeda91## Container view using uid_mapubuntu@kasm-agent:~$ docker exec sysbox-test cat /proc/self/uid_map0 296608 65536## User info from within the containerubuntu@kasm-agent:~$ docker exec sysbox-test iduid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel),11(floppy),20(dialout),26(tape),27(video)## Host process info of `tail` command running inside the containerubuntu@kasm-agent:~$ ps -fC "tail -f /dev/null"UID PID PPID C STIME TTY TIME CMD296608 171532 171503 0 21:35 ? 00:00:00 tail -f /dev/null -
Calculate the host UID of
kasm-user. The containerrootuser has a UID and GID of296608. Thekasm-userinside every Kasm Workspace has a UID and GID of1000. Add1000to the SysboxrootUID of296608to get the host UID ofkasm-user.296608 + 1000 = 297608AttentionAside from the kasm-user UID (1000), the values above are the ones the Sysbox service used for this deployment. Yours will likely be different.
-
Update the storage or volume mapping values with the calculated UID and GID so file shares work correctly with these users.
{"driver" : "rclone","driver_opts" : {"type" : "s3","s3-provider" : "AWS","s3-env-auth" : "false","s3-region" : "us-east-1","uid" : "297608","gid" : "297608","allow_other" : "true"}}
Install shiftfs
shiftfs is a kernel filesystem for the Linux kernel. It provides easier UID and GID shifting for containers and is a dependency of Sysbox. Linux kernels 5.15.x and later ship with shiftfs preinstalled. While kernels 5.15 to 6.3 in Ubuntu Jammy support shiftfs, install an up-to-date version for better performance.
-
Build and install the shiftfs kernel module.
sudo apt-get updatesudo apt-get install -y make dkms git wgetgit clone -b k5.16 https://github.com/toby63/shiftfs-dkms.git shiftfs-k516cd shiftfs-k516/./update1sudo make -f Makefile.dkmsmodinfo shiftfs -
Confirm the module loaded. The output looks similar to the following:
filename: /lib/modules/5.15.0-1031-aws/updates/dkms/shiftfs.kolicense: GPL v2description: id shifting filesystemauthor: Christian Brauner <christian.brauner@ubuntu.com>author: Seth Forshee <seth.forshee@canonical.com>author: James Bottomleyalias: fs-shiftfs -
Reboot the machine before continuing.
sudo reboot
Common troubleshooting steps
- Workspaces take a long time to become ready. A session on the Sysbox runtime runs a full systemd init chain and uses shiftfs, which adds overhead compared to native Docker init. Allow extra startup time.
- The workspace cannot use an NVIDIA GPU. NVIDIA GPU support through the NVIDIA Container Runtime is incompatible with Sysbox. Use DRI3 with open-source drivers, or run the workspace on the default
runcruntime when GPU support is required. - File permission errors on mapped storage. Sysbox remaps the host UID and GID, so the
kasm-userhost UID equals the SysboxrootUID plus1000. Read/etc/subuidand/etc/subgid, recalculate the value, and update theuidandgidfields in the mapping. Do not attach the same Storage Provider or volume mapping to both Sysbox and non-Sysbox workspaces. - The Docker daemon does not list the
sysbox-runcruntime. Confirm that/etc/docker/daemon.jsonincludes thesysbox-runcruntime path, then restart Docker. - shiftfs fails to load on a kernel between 5.15 and 6.3. Build and install the up-to-date shiftfs module, then reboot the host before launching workspaces.