SYSTEMD-RUN-GENERATOR(8)
๐ SYSTEMD-RUN-GENERATOR ๐
okay bestie, gather round, because this one is a generator โ and no, not the AI kind, the systemd kind. The manual name is systemd-run-generator, and it's the little guy that takes stuff you typed on the kernel command line and turns it into an actual system service. iconic behaviour, honestly.
โจ NAME โจ
systemd-run-generator โ a generator that runs commands you specified on the kernel command line as a system service. like, you whisper it at boot and it becomes a unit. slay.
๐ธ SYNOPSIS ๐ธ
/usr/lib/systemd/system-generators/systemd-run-generator
that's it. that's the whole vibe. no flags, no args, it just exists at that path and does its thing.
๐ฆ DESCRIPTION ๐ฆ
so systemd-run-generator is a generator (yes, it implements systemd.generator(7), we'll get there) that reads the kernel command line, and it understands three options. three. a tiny little menu. let's go.
systemd.run=โ if you set this and follow it with a command line, a unit namedkernel-command-line.servicegets generated for it and the system boots into it. the service hasType=oneshotset, and by default it comes withSuccessAction=exitandFailureAction=exitconfigured, which means the system is shut down as soon as the command finishes. bye bestie, job done, door closes behind you. ๐
The exit status of the command line is propagated to the invoking container manager, if that applies โ and that manager might propagate it even further, all the way to the calling shell. systemd-nspawn(1) is the example that does this, so like, chain of custody for your exit code, fr fr.
If you use this option multiple times, the unit file will contain multiple ExecStart= lines, so all the commands execute in order. one after another, no cutting in line.
The command is started as a regular service, i.e. with DefaultDependencies= on. no special treatment, just a normal service doing normal service things.
systemd.run_success_action=andsystemd.run_failure_action=โ use these to tweak how the system reacts to the process completing. in particular, assigning"none"will leave the system running after the command completes (so like, it doesn't immediately dip). for further details on supported arguments, go readsystemd.unit(5). ๐
๐ EXAMPLE ๐
want to add a user to the user database inside a container run with systemd-nspawn(1)? use a command like this:
# systemd-nspawn -D mycontainer -b systemd.run='"adduser test"'
(and yes, the double quoting in that command line is required, bestie. let me break it down because this is the part everyone gets wrong:
- the first level of quoting (
'') is processed and removed by the command shell used to invokesystemd-nspawn. - the second level of quoting (
"") is propagated to the kernel command line of the container, and then processed and removed bysystemd-run-generator. - both levels together make sure both words of the specified command line
adduser testend up in the generated unit file together, and are neither split apart by the command shell nor by the generator. ๐ซถ
so it's not extra, it's load-bearing. respect the quotes.)
๐ SEE ALSO ๐
โ ๏ธ quick vibe check: this page is systemd 262.1 energy, and that's the version tag living at the bottom of the original, so I'm putting it here instead. ๐
and that's the whole page, no cap. go forth and systemd.run= responsibly. mwah. ๐โจ๐๐ฆ๐ธ๐
๐ฆ 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