2

I am new to systemd fundamentals. I read sth about systemd units and unit files and services. Would someone please define these three terms for me clearly ? I'm mixed up .Also what is a daemon ? is daemon a service or unit or is it sth else? Does units are objects or handles to manage services by systemd or units are equivalent to services? Also for example when you type the command "systemctl list-units " or "systemctl list-units-files" ,do these commands print units and unit files or services? Thank you in advance.

2
  • Have you read man systemd.service and man systemd.unit? Or any other related documentation?
    – Panki
    Aug 24, 2022 at 9:17
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
    – Community Bot
    Aug 28, 2022 at 20:43

1 Answer 1

1

man systemd.unit, man systemd, and man systemd.service should answer most of your questions.

I read sth about systemd units and unit files and services. Would someone please define these three terms for me clearly ?

systemd provides a dependency system between various entities called "units" of 11 different types. Units encapsulate various objects that are relevant for system boot-up and maintenance.

A unit file is a plain text ini-style file that encodes information about a service, a socket, a device, a mount point, an automount point, a swap file or partition, a start-up target, a watched file system path, a timer controlled and supervised by systemd(1), a resource management slice or a group of externally created processes.

A unit configuration file whose name ends in ".service" encodes information about a process controlled and supervised by systemd.

So in short, a systemd service is one of several types of systemd units. Specifically, it usually runs a process. A service configuration file contains rules on how to run/restart/exit that process in the [Service] section of the file. Service-specific options are detailed in man systemd.service, man systemd.exec and man systemd.kill.

Other types of units are things like mount points, sockets, or paths which have their own types of configurations.

But all units have a common set of behaviours, including relationships between them and how they are triggered. You can see what options are available in their [Unit] or [Install] sections.

Also what is a daemon ?

Just think of a daemon as a background process. It's what is managed by a systemd service. There's probably a better definition, but it's not quite as relevent in systemd.

do these commands print units and unit files or services?

When you type systemctl list-units, units are listed (including services, but not only services). You can see things like *.device, .mount in addition to the .service items listed.

1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .