SYSTEMD.DEVICE(5)

๐Ÿ’– SYSTEMD.DEVICE โ€” device unit configuration ๐Ÿ’–

okay bestie, welcome to the systemd.device page from the systemd manual ๐Ÿ’… this is the one about device units and honestly it's a chill one โ€” there are basically no options to memorise, which is giving "easy A" energy fr fr. let's get into it โœจ


๐ŸŒธ NAME ๐ŸŒธ

systemd.device โ€” device unit configuration ๐ŸŽ€


๐Ÿฆ‹ SYNOPSIS ๐Ÿฆ‹

device.device

โœจ DESCRIPTION โœจ

So. A unit configuration file whose name ends in .device is out here encoding information about a device unit, as exposed in the sysfs/udev(7) device tree. What's the point of that? So you can define dependencies between devices and other units. iconic behaviour honestly.

This unit type has no specific options. None. Zero. Nada. ๐Ÿซถ For the common options that every unit configuration file shares, go read systemd.unit(5). Those common config items live in the generic [Unit] and [Install] sections. And lowkey important: a separate [Device] section does not exist, because there are no device-specific options that could be configured in it. it's giving "there's nothing to put there" ๐Ÿ’€

systemd will dynamically create device units for all kernel devices that are marked with the "systemd" udev tag โ€” and by default that's all block and network devices, plus a few others. But heads up: if systemd-udevd.service is not running, no device units will be available at all (think: a typical container). ๐Ÿ˜ญ

Device units are named after the /sys/ and /dev/ paths they control. Example, bestie: the device /dev/sda5 is exposed in systemd as dev-sda5.device. Slay. For the details about the escaping logic used to convert a filesystem path into a unit name, see systemd.unit(5) โ€” it's a whole thing.

To tag a udev device, you use "TAG+="systemd"" in the udev rules file. See udev(7) for details. ๐Ÿท๏ธ

Device units will be reloaded by systemd whenever the corresponding device generates a "changed" event. And other units can use ReloadPropagatedFrom= to react to that event. reactive queen ๐Ÿ‘‘


๐Ÿ‘‘ AUTOMATIC DEPENDENCIES ๐Ÿ‘‘

๐Ÿ’œ Implicit Dependencies ๐Ÿ’œ

Many unit types automatically acquire dependencies on device units of the devices they require. For example, .socket units acquire dependencies on the device units of the network interface specified in BindToDevice=. Similarly, swap and mount units acquire dependencies on the units encapsulating their backing block devices. no cap, they just find each other ๐Ÿซถ

๐Ÿ’œ Default Dependencies ๐Ÿ’œ

There are no default dependencies for device units. that's it, that's the whole section ๐Ÿ’…


๐ŸŒˆ THE UDEV DATABASE ๐ŸŒˆ

Unit settings of device units may either be configured via unit files, or directly from the udev database. The following udev device properties are understood by the service manager:

  • SYSTEMD_WANTS=, SYSTEMD_USER_WANTS= โ€” Adds dependencies of type Wants= from the device unit to the specified units. SYSTEMD_WANTS= is read by the system service manager, SYSTEMD_USER_WANTS= by user service manager instances. These properties may be used to activate arbitrary units when a specific device becomes available.

Note that this and the other udev device properties are not taken into account unless the device is tagged with the "systemd" tag in the udev database โ€” because otherwise the device isn't exposed as a systemd unit at all (see above, bestie, it's all connected โœจ).

Note that systemd will only act on Wants= dependencies when a device first becomes active. It will not act on them if they are added to devices that are already active. Use SYSTEMD_READY= (see below) to configure when a udev device shall be considered active, and thus when to trigger the dependencies. timing is everything fr fr โฐ

The specified property value should be a space-separated list of valid unit names. If a unit template name is specified (that is, a unit name containing an "@" character indicating a unit name to use for multiple instantiation, but with an empty instance name following the "@"), it will be automatically instantiated by the device's "sysfs" path (that is: the path is escaped and inserted as instance name into the template unit name). This is useful in order to instantiate a specific template unit once for each device that appears and matches specific properties. one template, infinite devices, main character energy ๐Ÿ‘‘

  • SYSTEMD_ALIAS= โ€” Adds an additional alias name to the device unit. This must be an absolute path that is automatically transformed into a unit name. (See above.) ๐ŸŽ€
  • SYSTEMD_READY= โ€” If set to 0, systemd will consider this device unplugged even if it shows up in the udev tree. If this property is unset or set to 1, the device will be considered plugged if it is visible in the udev tree.

This option is useful for devices that initially show up in an uninitialized state in the tree, and for which a "changed" event is generated the moment they are fully set up. Note that SYSTEMD_WANTS= (see above) is not acted on as long as SYSTEMD_READY=0 is set for a device. โš ๏ธ so don't set it to 0 and then wonder why nothing's happening, iykyk

  • ID_MODEL_FROM_DATABASE=, ID_MODEL= โ€” If set, this property is used as the description string for the device unit. cute little name tag ๐ŸŒธ

๐ŸŽ€ OPTIONS ๐ŸŽ€

Device 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 options section and honestly? we love a low-maintenance unit type ๐Ÿ’…


๐Ÿ”ฅ SEE ALSO ๐Ÿ”ฅ

systemd(1), systemctl(1), systemd.unit(5), udev(7), systemd.directives(7)

go read those if you want the full lore ๐Ÿฆ‹


and that's the page, bestie!! you ate this ๐Ÿ’– this was systemd version 262.1, and the page is SYSTEMD.DEVICE(5) โ€” device units, no options, all vibes. now go tag something with "systemd" and make it appear ๐ŸŒŸ 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