SYSTEMD.TARGET(5)

๐Ÿ’– systemd.target โ€” the manual page, bestie edition ๐Ÿ’–

okay so you're here for systemd.target(5), the systemd.target manual, and honestly? you picked a good one. no cap.


โœจ NAME โœจ

systemd.target โ€” target unit configuration ๐ŸŽฏ


โœจ SYNOPSIS โœจ

target.target

like. that's it. that's the synopsis. iconic.


๐ŸŒธ DESCRIPTION ๐ŸŒธ

so a unit configuration file whose name ends in .target is carrying around info about a target unit of systemd. and what do target units do? they group units together and they set up synchronization points for ordering dependencies with other unit files. it's giving project manager energy tbh. ๐Ÿ‘‘

this unit type has no specific options. none. zero. zip. if you want the common options that every unit configuration file has, go read systemd.unit(5). the common config items live in the generic [Unit] and [Install] sections. and there is no separate [Target] section because there are literally no target-specific options that could go in it. the section simply does not exist. periodt. ๐Ÿ’…

target units don't offer any extra functionality on top of the generic functionality that units already provide. they merely group units, which lets you use one single target name in Wants= and Requires= settings to establish a dependency on a whole set of units defined by that target โ€” and in Before= and After= settings to establish ordering. ๐Ÿฆ‹

targets establish standardized names for synchronization points during boot and shutdown. and this part is important, so listen up: see systemd.special(7) for examples and descriptions of the standard systemd targets. iykyk. ๐Ÿ”ฅ

also target units are a more flexible replacement for SysV runlevels in the classic SysV init system. glow-up fr fr. โœจ

โš ๏ธ not me warning you but โ€” a target unit file must not be empty, or it gets considered a masked unit. so don't do that. it's recommended that you provide a [Unit] section that includes informative Description= and Documentation= options. give your target a personality, bestie. ๐ŸŽ€

๐ŸŒˆ AUTOMATIC DEPENDENCIES ๐ŸŒˆ

๐Ÿ’ซ Implicit Dependencies ๐Ÿ’ซ

there are no implicit dependencies for target units. none. free spirit. ๐Ÿงš

๐Ÿ’ซ Default Dependencies ๐Ÿ’ซ

these dependencies get added unless DefaultDependencies=no is set:

  • target units will automatically complement all configured dependencies of type Wants= or Requires= with dependencies of type After=, unless DefaultDependencies=no is set in the specified units.
๐Ÿšจ and here's the tea: the reverse is not true. for example, defining Wants=that.target in some.service will not automatically add the After=that.target ordering dependency for some.service. instead, some.service should use the primary synchronization function of target type units by setting a specific After=that.target or Before=that.target ordering dependency in its .service unit file. so like. do that. ๐Ÿ˜ญ
  • target units automatically gain Conflicts= and Before= dependencies against shutdown.target. (yes it's beefing with shutdown.target, respectfully ๐Ÿ’€)

๐Ÿ’… OPTIONS ๐Ÿ’…

target unit files may include [Unit] and [Install] sections, which are described in systemd.unit(5). no options specific to this file type are supported. that's the whole section. obsessed with the brevity honestly. ๐Ÿ“


โญ EXAMPLE โญ

๐ŸŒธ Example 1. Simple standalone target ๐ŸŒธ

# emergency-net.target

[Unit]
Description=Emergency Mode with Networking
Requires=emergency.target systemd-networkd.service
After=emergency.target systemd-networkd.service
AllowIsolate=yes

okay so when you're adding dependencies to other units, it is important to check if they set DefaultDependencies=. service units, unless they set DefaultDependencies=no, automatically get a dependency on sysinit.target. in this case, both emergency.target and systemd-networkd.service have DefaultDependencies=no, so they are suitable for use in this target, and they do not pull in sysinit.target. slay. ๐Ÿ”ฅ

you can now switch into this emergency mode by running systemctl isolate emergency-net.target or by passing the option systemd.unit=emergency-net.target on the kernel command line. main character mode activated. ๐Ÿ‘‘

other units can have WantedBy=emergency-net.target in the [Install] section. after they are enabled using systemctl enable, they will be started before emergency-net.target is started. it is also possible to add arbitrary units as dependencies of emergency.target without modifying them by using systemctl add-wants. the way that works is genuinely so useful bestie ๐Ÿซถ


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹


that's the whole page, bestie, you ate it. ๐Ÿ’– this was systemd 262.1 era of SYSTEMD.TARGET(5) โ€” go forth and group your units, you gorgeous synchronization point. โœจ๐ŸŽ€๐Ÿฆ‹๐Ÿ’œ

๐Ÿ“ฆ 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