Systemd preset mechanism.

Share this link

When using the new RHEL 7.2 release and running the systemctl status command, some slight changes were recently visible:

# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2016-02-13 10:56:40 CET; 6s ago
Docs: man:sshd(8)
man:sshd_config(5)
Main PID: 1286 (sshd)
CGroup: /system.slice/sshd.service
└─1286 /usr/sbin/sshd -D

Feb 13 10:56:40 server.example.com systemd[1]: Started OpenSSH server daemon.
Feb 13 10:56:40 server.example.com systemd[1]: Starting OpenSSH server daem....
Feb 13 10:56:40 server.example.com sshd[1286]: Server listening on 0.0.0.0 ....
Feb 13 10:56:40 server.example.com sshd[1286]: Server listening on :: port 22.
Feb 13 10:56:44 server.example.com sshd[2457]: Accepted password for root f...2
Hint: Some lines were ellipsized, use -l to show in full.

As you can see above, a new string vendor preset: enabled is now displayed. Here it means that the preset mechanism has been applied on the sshd package.

The preset mechanism came with Systemd and the RHEL 7.0 release, the RHEL 7.2 release just makes it visible. It is a way for a Linux distribution (Debian, CentOS, etc) to centrally define whether a package should be automatically enabled or not at installation time.

So, through the well known directory hierarchy (/usr/lib/systemd/system-preset, /etc/systemd/system-preset, /run/systemd/system-preset), a Linux distribution can specify how packages initially behave.

A typical preset file would appear like this:

# more /usr/lib/systemd/system-preset/90-default.preset
# System stuff
enable sshd.service
enable atd.*
enable crond.*
enable chronyd.service
enable rpcbind.*
enable NetworkManager.service
enable NetworkManager-dispatcher.service
enable ModemManager.service
enable auditd.service
enable restorecond.service
enable bluetooth.*
enable avahi-daemon.*
enable cups.*

# The various syslog implementations
enable rsyslog.*
enable syslog-ng.*
enable sysklogd.*

# Network facing
enable firewalld.service
enable libvirtd.service
enable xinetd.service
enable ladvd.service
...

A directive enable or disable precedes each package in this file as appropriate.

You shouldn’t need to modify this file in most cases but it is still interesting to know that it exists.

Sources: systemd.preset man page and Freedesktop.org website.

Posted in RHEL7

Leave a Reply

Be the First to Comment!

Notify of
wpDiscuz

RHCSA7: Task of the day

Allowed time: 10 minutes.
Create an EXT4 file system mounted under /vol based on a logical volume of 100MB.
Reduce the size to 60MB.

RHCE7: Task of the day

Allowed time: 15 minutes.
Configure a Samba server called MYSERVER, belonging to the MYGROUP group, sharing the /shared directory with the name "shared".

Poll for favorite RHEL 7 book

What is your favorite RHEL 7 book to prepare RHCSA & RHCE exams?

View Results

Loading ... Loading ...

Poll for most difficult RHCSA 7 topic

What do you think is the most difficult RHCSA 7 topic?

View Results

Loading ... Loading ...

Poll for most difficult RHCE 7 topic

What do you think is the most difficult RHCE 7 topic?

View Results

Loading ... Loading ...

Recent Comments