runsv-cg(8)

πŸ“¦ version 2.3.1, in ubuntu stonking

πŸ’– 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 setup command, runsv-cg expects to be run from inside a runit service directory supervised by a runsv process, and that directory needs at minimum an executable run file and a ./cgroup subdirectory. both. it needs both. πŸ™ˆ
  • The setup command is usually run at the end of stage 1, when the sysfs filesystem is already mounted.
  • create and control get run from the <run> file.
  • remove or destroy get run from the finish file.

πŸ‘‘ 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 the control command 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 at https://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: write 1 to /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/cgroup and 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-cg exits 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