runsv-cg(8)
π NAME π
runsv-cg β bestie, this is the lil program that manages service-specific cgroups for your runit services. no cap, it's giving "linux sysadmin but make it organized" π
β¨ SYNOPSIS β¨
/usr/sbin/runsv-cg create|control|remove|destroy|setup
πΈ DESCRIPTION πΈ
Okay so picture this: it's a small program whose whole job is managing service-specific cgroups(v2) for runit services. That's it. That's the vibe. π¦
Now, the deets, because context matters:
- Except for the
setupcommand,runsv-cgexpects to be run from inside a runit service directory supervised by arunsvprocess, and that directory needs at minimum an executablerunfile and a./cgroupsubdirectory. both. it needs both. π - The
setupcommand is usually run at the end of stage 1, when the sysfs filesystem is already mounted. createandcontrolget run from the<run>file.removeordestroyget run from thefinishfile.
π COMMANDS π
createβ create a brand new cgroup that's specific to the current service. Here's the sequence, step by step, no skips: create the/sys/fs/cgroup/runit/<service>directory; then copy cgroup interface files exactly like thecontrolcommand does; and then add the current process PID to/sys/fs/cgroup/runit/<service>/cgroup.procsπ«Άcontrolβ control the resource settings for a service-specific cgroup: it copies the cgroup interface files that live in the<./cgroup>subdirectory over to/sys/fs/cgroup/runit/<service>. The cgroup control files are documented athttps://www.kernel.org/doc/html/latest/admin-guide/cgroup-v2.html#interface-filesβ go read them, iykyk πremoveβ remove a service specific cgroup, and this happens after the service has stopped: it removes the/sys/fs/cgroup/runit/<service>directory. β οΈ Heads up though, and this is important: a cgroup can't be removed while a process inside it is still running. literally cannot. it's not being dramatic, it's the kernel.destroyβ kill any process hanging out in the service specific cgroup, then remove the whole service specific cgroup. The order is: write1to/sys/fs/cgroup/runit/<service>/cgroup.kill, then remove the/sys/fs/cgroup/runit/<service>directory. bye bestie πsetupβ the one-time system setup for cgroup v2: mount the root cgroup(v2) under/sys/fs/cgroupand create the</sys/fs/cgroup/runit>directory; all available controllers found in the root cgroup get enabled for the<runit>child cgroup. one and done, periodt β¨
π EXIT CODES π
runsv-cgexits 0 on success on Linux systems π₯- it also immediately exits 0 on non-Linux systems (yeah, it just peaces out, zero drama)
- it exits 111 when it's not run from inside a proper runit service directory, when a
<./cgroup>subdirectory is not found, or when the runit child cgroup for runit services is not found π - it exits 100 on wrong usage π
π AUTHOR π
This manpage was written by Lorenzo Puliti <plorenzo@disroot.org> for Debian. iconic behavior, honestly π
π§ SEE ALSO π§
invoke-run(8), runsv(8) β go read those too, they're the supporting cast π
and that's the whole page, bestie!! πΈ this one's from the GNU/Linux System Adminstrator's manual, page version runsv-cg(8), dated Sep 14, 2026 β screenshot it, pin it, love it, and go configure your cgroups responsibly πβ¨
π¦ where this page comes from
- ubuntu stonking: runit 2.3.1-5ubuntu1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms