cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor
Commander Commander
Commander
  • 255 Views

systemd dependencies

systemd activate all units that are dependencies of default.target.

What specifically makes a systemd unit dependent on default.target?

 

Trevor "Red Hat Evangelist" Chandler
Labels (3)
3 Replies
Blue_bird
Starfighter Starfighter
Starfighter
  • 225 Views

A systemd unit becomes dependent on default.target through one of these dependency relationships:

1. The unit is WantedBy= the default target
WantedBy=default.target

2. The unit is RequiredBy= the default target
RequiredBy=graphical.target

3.PartOf=default.target in unit file
PartOf=default.target

These above mentioned dependencies comes under Direct dependencies

 

Thanks

Chetan_Tiwary_
Community Manager
Community Manager
  • 128 Views

Unless specified differently during the boot process via the GRUB menu, systemd always defaults to starting the default.target. This default.target file acts as a symbolic link, pointing to the actual desired system state. For example, a desktop workstation usually links to the graphical.target, which is the systemd equivalent of the traditional SystemV runlevel 5. Conversely, a server typically links to the multi-user.target, which mirrors SystemV runlevel 3. It's also worth noting that the emergency.target serves a similar purpose to the old single-user mode. Ultimately, both targets and services are fundamental components, referred to in systemd terminology as systemd units.

When a unit is declared as "wanted by" or "required by" a target that sits beneath the default.target through dependencies like WantedBy=, Requires=, or another target-level dependency that unit becomes implicitly dependent on the default.target itself.

One key feature of Systemd is its use of default dependencies. This means that even if you don't explicitly define every single dependency in your unit files, Systemd automatically inserts crucial dependencies behind the scenes. These default settings ensure essential boot order and proper system operation, such as managing mount points and confirming filesystem readiness. You only need to intervene if you need to bypass this behavior entirely by setting the DefaultDependencies=no option.

https://www.freedesktop.org/software/systemd/man/latest/systemd.target.html# 

https://opensource.com/article/20/5/systemd-startup 

https://docs.redhat.com/en/documentation/red_hat_enterprise_linux/9/html/using_systemd_unit_files_to... 

Trevor
Commander Commander
Commander
  • 56 Views

Chetan, your responses do align very well with the 
name - Red Hat Learning Community!!!!

 

Trevor "Red Hat Evangelist" Chandler
Join the discussion
You must log in to join this conversation.