source: chapter07/sysd-custom.xml@ c729bc9

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 7.6 7.7 7.8 7.9 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/mips64el xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since c729bc9 was c729bc9, checked in by Bruce Dubbs <bdubbs@…>, 10 years ago

Add section on systemd customization

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10527 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 4.0 KB
Line 
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
36cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf &lt;&lt; EOF
37[Service]
38TTYVTDisallocate=no
39EOF</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
88cat > /etc/systemd/system/foobar.service.d/foobar.conf &lt;&lt; EOF
89[Service]
90Restart=always
91RestartSec=30
92EOF</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>
Note: See TracBrowser for help on using the repository browser.