In association with heise online

Wants and needs

Systemctl's show command delivers some internal information on running units and the tasks they execute, as well as information about which units systemd calls on to enable the multi-user target:

systemctl show -p Wants

Other targets can also be in the output, such as in In turn, the former depends on, which requires These three targets take care of the system's basic configuration, including mounting filesystems and starting udev. To specify dependency on the basic target, the unit configuration file contains the following statements:

With After in addition to Requires, systemd knows that it must not only enable the target but also wait for that target to completely start.

Wants is a weaker alternative to Requires. Systemd enables these units as well, but continues starting the system even if one of them doesn't start. This kind of dependency can also be specified with links to unit files in directories consisting of the unit file's path and name and a .wants in order to determine which units are retrieved when a target is accessed. You can use ls or systemctl's show command:

ls /*/systemd/system/
systemctl show -p Wants

Shutting down

If you want to deactivate the NTPD service unit so the system time is not synchronised via NTP upon boot-up, you can use the following style of command:

systemctl disable ntpd.service

Here, systemctl is simply removing the link to the service unit file in the Wants directories; it creates a link when a service is activated with enable. Both steps can also be done manually in order to (de)activate units without using systemctl.

If a service is started by a traditional init script rather than a unit, systemctl forwards the activation request to the chkconfig program. With Fedora 15, for example, this can occur when you install Apache and activate it using systemctl. In turn, chkconfig can also delegate tasks to systemctl in Fedora 15 – but only some, so you're better off not using it at all or only with caution.

The (de)activation of a service takes effect the next time it is started or when the system is shut down; the following command starts a service immediately:

systemctl start ntpd.service

For sysvinit distributions, the equivalent to this command is service ntpd start. A systemctl command with the stop parameter instead of start ends the service. With the status command, systemctl delivers information about the unit, including its current status and the name of the file that specifies it. The program also says whether the service is currently running and, if so, for how long it has been running as well as which processes belong to it, with the main process explicitly displayed.

Zoom Group affiliation can be used to determine which service a process belongs to
It is quite easy to find out which service started which processes by looking at the control groups created by systemd. The command systemd-cgls displays the cgroup hierarchy created by systemd; alternatively, ps shows group affiliation:

ps xaw -eo pid,args,cgroup

Next: Fixing problems

Print Version | Permalink:
  • Twitter
  • Facebook
  • submit to slashdot
  • StumbleUpon
  • submit to reddit

  • July's Community Calendar

The H Open

The H Security

The H Developer

The H Internet Toolkit