CAPSULE@.SERVICE(5)

๐Ÿ’… capsule@.service โ€” the manual, but make it make sense

okay bestie, so this is capsule@.service(5) โ€” the manual page for the system unit that runs the capsule service manager. it's giving systemd but make it โœจextraโœจ. sit down, grab a strawberry ๐Ÿ“, and let's get into it.


๐ŸŒธ NAME ๐ŸŒธ

capsule@.service โ€” the System unit for the capsule service manager. yes bestie, that's literally the whole name. iconic.


โœจ SYNOPSIS โœจ

capsule@NAME.service

that's it. that's the whole vibe. NAME is a placeholder, don't @ me. ๐Ÿ™ˆ


๐Ÿ’– DESCRIPTION ๐Ÿ’–

so, the service managers for capsules run inside capsule@NAME.service system units โ€” and the capsule name is the instance identifier. capsules are a way to run additional instances of the service manager, under dynamic user IDs. and what's a dynamic user ID, you ask? it's a UID that gets allocated when the capsule service manager starts up, and released the moment it stops. no cap, it really does clean up after itself like that. ๐Ÿงš

and listen, capsule@.service is similar in many ways to the per-user user@.service service manager โ€” but there are a few important distinctions, and we're gonna go through every single one, because details are the moment:

  • the capsule service manager utilizes DynamicUser= (see systemd.exec(5)) to allocate a new UID dynamically on invocation. the user name is automatically generated from the capsule name, by prefixing "c-". and the UID is released when the service is terminated. the user service manager, on the other hand, operates under a statically allocated user ID that has to be pre-existing before the user service manager is even invoked. it's giving "we don't do dynamic here". ๐Ÿ’€
  • user service managers register themselves with pam(8). capsule service managers do not. they simply said "not my business". ๐Ÿ™ˆ
  • user service managers typically read their configuration from a $HOME directory below /home/. capsule service managers read theirs from a $HOME directory below /var/lib/capsules/. different neighborhood, same energy. ๐Ÿก
  • user service managers are collectively contained in the user.slice unit. capsule service managers live in capsule.slice. also peep systemd.special(7) for the lore.
  • user service managers start the user unit default.target initially. capsule service managers invoke the user unit capsule@.target instead. okay different starting point, love that for them. ๐Ÿ‘‘

so the capsule service manager and the capsule's bus broker can both be reached via the --capsule= switch โ€” and you can pass that to systemctl(1), systemd-run(1), and busctl(1). slay.

new capsules can be started with a simple systemctl start capsule@NAME.service command, and stopped with systemctl stop capsule@NAME.service. and here's the tea: starting a capsule will implicitly create a home directory /var/lib/capsules/NAME/, if it's missing. a runtime directory gets created as /run/capsules/NAME/. to remove these resources, use systemctl clean capsule@NAME.service โ€” for example with the --what=all switch. periodt. ๐Ÿ’…

the capsule@.service unit invokes a systemd --user service manager process. which means unit files are looked for according to the exact same rules as for regular user service managers โ€” for example in /var/lib/capsules/NAME/.config/systemd/user/. yes bestie, same rules, different folder. iykyk. ๐Ÿฆ‹

capsule names may be chosen freely by the user (main character energy, choose whatever), however, they must be suitable as UNIX filenames (i.e. 255 characters max, and contain no "/"), and when prefixed with "c-" they must be suitable as a user name matching strict POSIX rules. see User/Group Name Syntax[1] for details. so like, go off, but stay within the rules. ๐ŸŒˆ

added in version 256. ๐Ÿ’ซ

๐ŸŽ€ EXAMPLES ๐ŸŽ€

Example 1. Create a new capsule, invoke two programs in it (one interactively), terminate it, and clean everything up

okay so this is the full lil journey โ€” create, vibe, yeet, clean. watch and learn bestie:

# systemctl start capsule@tatze.service
# systemd-run --capsule=tatze --unit=sleeptest.service sleep 999
# systemctl --capsule=tatze status sleeptest.service
# systemd-run -t --capsule=tatze bash
# systemctl --capsule=tatze stop sleeptest.service
# systemctl stop capsule@tatze.service
# systemctl clean --all capsule@tatze.service

see how it goes start โ†’ run โ†’ check โ†’ interact โ†’ stop โ†’ stop โ†’ clean? that's the whole lifecycle, no notes. ๐Ÿ”ฅ


๐ŸŒŸ SEE ALSO ๐ŸŒŸ

go read these next, bestie, they're all in the group chat:


๐Ÿ“ NOTES ๐Ÿ“

  1. User/Group Name Syntax https://systemd.io/USER_NAMES

and that's the whole page, bestie ๐Ÿซถ this was systemd 262.1, manual CAPSULE@.SERVICE(5), and honestly? she ate. go start a capsule, you got this. โœจ๐Ÿ’–๐ŸŽ€

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms