Systemd in the heart of Redhat 7 service management:

If you’re a redhat linux user or you’re using a distribution based on Redhat Linux, you probably wonder what’s in Redhat Linux 7 for you.


Well RHEL 7 brought a lot of new features, beginning with kernel version…. for a sys admin, the big news is the init system, RHEL is now using systemd as the default init system.

What is Systemd?

Systemd is an init system developed by the engineer Lenart Poettering.

If you don’t know, init system is simply the process with PID 1 responsible for spawning all other processes and bringing up the user space within your system. It’s the program your boat loader point to so the kernel uses it to start everything user space.


You certainly had heard of init systems like SysVinit and upstart, systemd is much more elegant 😉


How it works?

Systemd uses the concept of “Unit” to manage services, their dependencies and the allocated resources.

Think of everything services, swap files, mount points, run levels, devices… can be categorized under units. So each device, service or mount point may have a configuration file .unit_name  containing details like binary file to run a service, dependency with others services, mount points….

Systemd Units are as follows:

service, socket, device, mount, automount, swap, target, path, timer, snapshot, slice and scope.

You remember /etc/init.d/ scripts? So think of unit file as init.d scripts..

Apache service for instance, will have a httpd.service unit file which could be configured as follows:


Look at the [service] part, it points to executable file to run/reload/stop the service

With this file, you can configure the run level using this service, look at [Install] part and WantedBy keyword, dependency with other services, observe the [Unit] part and the After keyword. So here, requires apache service.

Target units correspond to classic Runlevels, each target file contains details about required services to be launched. You can have,….

In apache case mentioned above, observe that requirs apache service. In this case and generally, you’ll find a directory /etc/systemd/system/multi-user.wants/ containing a symbolic link pointing to apache service unit and generally to all required services.


What I like the most about systemd :

  • Systemd exploits Cgroups

Systemd uses cgroups kernel to track everything about your processes.

Cgroups are a built-in kernel feature which creates an hierarchy for groups of processes. Think of cgroups as containers that child processes couldn’t escape even with a double fork making it very easy to track them. These containers could serve also for resource management (cpu, ram,…) of a particular process..

If you’re a sys admin, remember how many times you couldn’t determine which service/process spawned a strange process? Or you couldn’t kill all your CGI processes even after shutting down your apache? Well with systemd exploiting cgroups, there is no chance for this to happen J

You can find your cgroups in /sys/fs/cgroups


The command systemd-cgtop returns the top cgroups defined in your system, ordered by their CPU,RAM and load:


  •  Systemd’s journal:

Systemd has its own logging service: systemd-journald called the journal. Every piece of data written to stdout, stderr, logged by the kernel through printk() or by syslog(), all this is sent to the Journal. In addition the journal is very rich with logged information, it doesn’t only log errors returned by a particular service but also related details from your system helping you debug and analyze the reason behind these errors.

Plus, the journal provides you with structured information, making it easily portable. How many times you need to do some coding in order to parse your logs ?!!!! You can use journalctl command for example, with json option in order to have json formatted logs:


Cool isn’t it ?

Well this is briefly about systemd, you can find a lot of thing online, articles attacking systemd, others fans of it. I, personnally, like it, except from that  thing of rebooting the whole server after applying new configuration!!!

Try it, there is nothing more refreshing for the mind than exploring new worlds 🙂

Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: