diff options
author | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2016-05-24 21:24:59 +0000 |
---|---|---|
committer | Bruce Dubbs <bdubbs@linuxfromscratch.org> | 2016-05-24 21:24:59 +0000 |
commit | 1118b1757d67c5e7deb4c9e4b864b00f9d8a8b0c (patch) | |
tree | cf1411feb617804f8468b98348eff7f377b2ee07 /chapter07/systemd-custom.xml | |
parent | 11ebea60aa77e5a8b24f08971e153d05c12a4406 (diff) |
Create branches/merge in svn repo fo rtesting of merged LFS books
git-svn-id: http://svn.linuxfromscratch.org/LFS/branches/merge@11073 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
Diffstat (limited to 'chapter07/systemd-custom.xml')
-rw-r--r-- | chapter07/systemd-custom.xml | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/chapter07/systemd-custom.xml b/chapter07/systemd-custom.xml new file mode 100644 index 000000000..0c8ca75b9 --- /dev/null +++ b/chapter07/systemd-custom.xml @@ -0,0 +1,175 @@ +<?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-systemd-custom"> + <?dbhtml filename="systemd-custom.html"?> + + <title>Systemd Usage and Configuration</title> + + <indexterm zone="ch-scripts-systemd-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 options to control basic systemd 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 logging settings. + See <filename>systemd-system.conf(5)</filename> manual page for details on + each configuration option.</para> + + </sect2> + + <sect2> + <title>Disabling Screen Clearing at Boot Time</title> + + <para>The normal behavior for systemd is to clear the screen at + the end of the boot sequence. If desired, this behavior may be + changed by running the following command:</para> + +<screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/getty@tty1.service.d + +cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf << EOF +<literal>[Service] +TTYVTDisallocate=no</literal> +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 -sfv /dev/null /etc/systemd/system/tmp.mount</userinput></screen> + + <para>This is not necessary if there is a separate partition for + <filename class="directory">/tmp</filename> 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 class="directory">/etc/tmpfiles.d</filename>. Files in + <filename class="directory">/etc/tmpfiles.d</filename> override + files with the same name in + <filename class="directory">/usr/lib/tmpfiles.d</filename>. See + <filename>tmpfiles.d(5)</filename> manual page for file format + details.</para> + + </sect2> + + <sect2> + <title>Overriding Default Services Behavior</title> + + <para>A systemd service contents can be overriden by creating a directory + and a configuration file in <filename + class="directory">/etc/systemd/system</filename>. For example:</para> + +<screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/foobar.service.d + +cat > /etc/systemd/system/foobar.service.d/foobar.conf << EOF +<literal>[Service] +Restart=always +RestartSec=30</literal> +EOF</userinput></screen> + + <para>See <filename>systemd.unit(5)</filename> manual page for more + information. After creating the configuration file, run + <userinput>systemctl daemon-reload</userinput> and <userinput>systemctl + restart foobar</userinput> to activate the changes to a service.</para> + + </sect2> + + <sect2> + <title>Debugging the Boot Sequence</title> + + <para>Rather than plain shell scripts used in SysVinit or BSD style init + systems, systemd uses a unified format for different type of startup + files (or units). The command <command>systemctl</command> is used to + enable, disable, controll state, and obtain status of unit files. Here + are some examples of frequently used commands:</para> + + <itemizedlist> + <listitem> + <para><command>systemctl list-units -t <replaceable><service></replaceable> [--all]</command>: + lists loaded unit files of type service.</para> + </listitem> + <listitem> + <para><command>systemctl list-units -t <replaceable><target></replaceable> [--all]</command>: + lists loaded unit files of type target.</para> + </listitem> + <listitem> + <para><command>systemctl show -p Wants <replaceable><multi-user.target></replaceable></command>: + shows all units that depend on the multi-user target. Targets are + special unit files that are anogalous to runlevels under + SysVinit.</para> + </listitem> + <listitem> + <para><command>systemctl status <replaceable><servicename.service></replaceable></command>: + shows the status of the servicename service. The .service extension + can be omitted if there are no other unit files with the same name, + such as .socket files (which create a listening socket that provides + similar functionality to inetd/xinetd).</para> + </listitem> + </itemizedlist> + + </sect2> + + <sect2> + <title>Working with the Systemd Journal</title> + + <para>Logging on a system booted with systemd is handled by + systemd-journald (default), rather than a typical unix syslog daemon. + systemd-journald write log entries to a binary file format, rather than + a plain text log file. To assist with parsing the file, the command + <command>journalctl</command> is provided. Here are some examples of + frequently used commands:</para> + + <itemizedlist> + <listitem> + <para><command>journalctl -r</command>: shows all contents of the + journal in reverse chronological order.</para> + </listitem> + <listitem> + <para><command>journalctl -u <replaceable>UNIT</replaceable></command>: + shows the journal entries associated with the specified UNIT + file.</para> + </listitem> + <listitem> + <para><command>journalctl -b[=ID] -r</command>: shows the journal + entries since last successfull boot (or for boot ID) in reverse + chronological order.</para> + </listitem> + <listitem> + <para><command>journalctl -f</command>: povides functionality similar + to tail -f (follow).</para> + </listitem> + </itemizedlist> + + </sect2> +</sect1> |