1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../general.ent">
|
---|
5 | %general-entities;
|
---|
6 | ]>
|
---|
7 |
|
---|
8 | <sect1 id="ch-scripts-sysd-custom">
|
---|
9 | <?dbhtml filename="sysd-custom.html"?>
|
---|
10 |
|
---|
11 | <title>Systemd Customization</title>
|
---|
12 |
|
---|
13 | <indexterm zone="ch-scripts-sysd-custom">
|
---|
14 | <primary sortas="e-Systemd">Systemd Customization</primary>
|
---|
15 | </indexterm>
|
---|
16 |
|
---|
17 | <sect2>
|
---|
18 | <title>Basic Configuration</title>
|
---|
19 |
|
---|
20 | <para>The <filename>/etc/systemd/system.conf</filename> file contains a set
|
---|
21 | of items to control basic operations. The default file has all entries
|
---|
22 | commented out with the default settings indicated. This file is where the
|
---|
23 | log level may be changed as well as some basic journal settings.</para>
|
---|
24 |
|
---|
25 | </sect2>
|
---|
26 |
|
---|
27 | <sect2>
|
---|
28 | <title>Disabling Screen Clearing at Boot Time</title>
|
---|
29 |
|
---|
30 | <para>The normal behavior for systemd is to clear the secreen at
|
---|
31 | the end of the boot sequence. If desired, this behavior may be
|
---|
32 | changed by the following:</para>
|
---|
33 |
|
---|
34 | <screen role="nodump"><userinput>mkdir -p /etc/systemd/system/getty@tty1.service.d
|
---|
35 |
|
---|
36 | cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF
|
---|
37 | [Service]
|
---|
38 | TTYVTDisallocate=no
|
---|
39 | EOF</userinput></screen>
|
---|
40 |
|
---|
41 | <para>The boot messages can always be revied by using the
|
---|
42 | <userinput>journalctl -b</userinput> command as the root user.</para>
|
---|
43 |
|
---|
44 | </sect2>
|
---|
45 |
|
---|
46 | <sect2>
|
---|
47 | <title>Disabling tmpfs for /tmp </title>
|
---|
48 |
|
---|
49 | <para>By default, <filename class="directory">/tmp</filename> is created as
|
---|
50 | a tmpfs. If this is not desired, it can be overridden by the following:</para>
|
---|
51 |
|
---|
52 | <screen role="nodump"><userinput>ln -s /dev/null /etc/systemd/system/tmp.mount</userinput></screen>
|
---|
53 |
|
---|
54 | <para>This is not necessary if there is a separate partition for /tmp
|
---|
55 | specified in <filename>/etc/fstab</filename>.</para>
|
---|
56 | </sect2>
|
---|
57 |
|
---|
58 | <sect2>
|
---|
59 | <title>Configuring Automatic File Creation and Deletion</title>
|
---|
60 |
|
---|
61 | <para>There are several services that create or delete files or
|
---|
62 | directories:</para>
|
---|
63 |
|
---|
64 | <itemizedlist>
|
---|
65 | <listitem><para>systemd-tmpfiles-clean.service</para></listitem>
|
---|
66 | <listitem><para>systemd-tmpfiles-setup-dev.service</para></listitem>
|
---|
67 | <listitem><para>systemd-tmpfiles-setup.service</para></listitem>
|
---|
68 | </itemizedlist>
|
---|
69 |
|
---|
70 | <para>The system location for the configuration files is
|
---|
71 | <filename>/usr/lib/tmpfiles.d/*.conf</filename>. The local
|
---|
72 | configuration files are in <filename>/etc/tmpfiles.d/*.conf</filename>.
|
---|
73 | Files in /etc/tmpfiles.d override files with the same name in
|
---|
74 | /usr/lib/tmpfiles.d. See <userinput>man tmpfiles.d</userinput>
|
---|
75 | for file format details.</para>
|
---|
76 |
|
---|
77 | </sect2>
|
---|
78 |
|
---|
79 | <sect2>
|
---|
80 | <title>Adding Custom Units and Services</title>
|
---|
81 |
|
---|
82 | <para>A custom service can be added by creating a directory and
|
---|
83 | configuration file in <filename class="directory">/etc/systemd/system/</filename>.
|
---|
84 | For example:</para>
|
---|
85 |
|
---|
86 | <screen role="nodump"><userinput>mkdir -p /etc/systemd/system/foobar.service.d
|
---|
87 |
|
---|
88 | cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF
|
---|
89 | [Service]
|
---|
90 | Restart=always
|
---|
91 | RestartSec=30
|
---|
92 | EOF</userinput></screen>
|
---|
93 |
|
---|
94 | <para>See the man page for systemd.unit for more information. After
|
---|
95 | creating the configuration file, run <userinput>systemctl
|
---|
96 | daemon-reload</userinput> and <userinput>systemctl restart
|
---|
97 | foobar</userinput> to activate a service or changes to a service.</para>
|
---|
98 |
|
---|
99 | </sect2>
|
---|
100 |
|
---|
101 | <sect2>
|
---|
102 | <title>Debugging the Boot Sequence</title>
|
---|
103 |
|
---|
104 | <para>There are several commands that can be used to help debug the systemd
|
---|
105 | boot process. Here are some examples:</para>
|
---|
106 |
|
---|
107 | <itemizedlist>
|
---|
108 | <listitem><para>systemctl list-units -t service [--all]</para></listitem>
|
---|
109 | <listitem><para>systemctl list-units -t target [--all]</para></listitem>
|
---|
110 | <listitem><para>systemctl show -p Wants multi-user.target</para></listitem>
|
---|
111 | <listitem><para>systemctl status sshd.service</para></listitem>
|
---|
112 | </itemizedlist>
|
---|
113 |
|
---|
114 | </sect2>
|
---|
115 |
|
---|
116 | </sect1>
|
---|