123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- <?xml version="1.0" encoding="ISO-8859-1"?>
- <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
- "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
- <!ENTITY % general-entities SYSTEM "../general.ent">
- %general-entities;
- ]>
- <sect1 id="ch-scripts-sysd-custom">
- <?dbhtml filename="sysd-custom.html"?>
- <title>Systemd Customization</title>
- <indexterm zone="ch-scripts-sysd-custom">
- <primary sortas="e-Systemd">Systemd Customization</primary>
- </indexterm>
- <sect2>
- <title>Basic Configuration</title>
- <para>The <filename>/etc/systemd/system.conf</filename> file contains a set
- of items to control basic operations. The default file has all entries
- commented out with the default settings indicated. This file is where the
- log level may be changed as well as some basic journal settings.</para>
- </sect2>
- <sect2>
- <title>Disabling Screen Clearing at Boot Time</title>
- <para>The normal behavior for systemd is to clear the secreen at
- the end of the boot sequence. If desired, this behavior may be
- changed by the following:</para>
- <screen role="nodump"><userinput>mkdir -p /etc/systemd/system/getty@tty1.service.d
- cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF
- [Service]
- TTYVTDisallocate=no
- EOF</userinput></screen>
- <para>The boot messages can always be revied by using the
- <userinput>journalctl -b</userinput> command as the root user.</para>
- </sect2>
- <sect2>
- <title>Disabling tmpfs for /tmp </title>
- <para>By default, <filename class="directory">/tmp</filename> is created as
- a tmpfs. If this is not desired, it can be overridden by the following:</para>
- <screen role="nodump"><userinput>ln -s /dev/null /etc/systemd/system/tmp.mount</userinput></screen>
- <para>This is not necessary if there is a separate partition for /tmp
- specified in <filename>/etc/fstab</filename>.</para>
- </sect2>
- <sect2>
- <title>Configuring Automatic File Creation and Deletion</title>
- <para>There are several services that create or delete files or
- directories:</para>
- <itemizedlist>
- <listitem><para>systemd-tmpfiles-clean.service</para></listitem>
- <listitem><para>systemd-tmpfiles-setup-dev.service</para></listitem>
- <listitem><para>systemd-tmpfiles-setup.service</para></listitem>
- </itemizedlist>
-
- <para>The system location for the configuration files is
- <filename>/usr/lib/tmpfiles.d/*.conf</filename>. The local
- configuration files are in <filename>/etc/tmpfiles.d/*.conf</filename>.
- Files in /etc/tmpfiles.d override files with the same name in
- /usr/lib/tmpfiles.d. See <userinput>man tmpfiles.d</userinput>
- for file format details.</para>
- </sect2>
- <sect2>
- <title>Adding Custom Units and Services</title>
- <para>A custom service can be added by creating a directory and
- configuration file in <filename class="directory">/etc/systemd/system/</filename>.
- For example:</para>
- <screen role="nodump"><userinput>mkdir -p /etc/systemd/system/foobar.service.d
- cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF
- [Service]
- Restart=always
- RestartSec=30
- EOF</userinput></screen>
- <para>See the man page for systemd.unit for more information. After
- creating the configuration file, run <userinput>systemctl
- daemon-reload</userinput> and <userinput>systemctl restart
- foobar</userinput> to activate a service or changes to a service.</para>
- </sect2>
- <sect2>
- <title>Debugging the Boot Sequence</title>
- <para>There are several commands that can be used to help debug the systemd
- boot process. Here are some examples:</para>
- <itemizedlist>
- <listitem><para>systemctl list-units -t service [--all]</para></listitem>
- <listitem><para>systemctl list-units -t target [--all]</para></listitem>
- <listitem><para>systemctl show -p Wants multi-user.target</para></listitem>
- <listitem><para>systemctl status sshd.service</para></listitem>
- </itemizedlist>
- </sect2>
- </sect1>
|