mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-06-19 03:39:20 +01:00
Add section on systemd customization
git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10527 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689
This commit is contained in:
parent
ba75f1313a
commit
c729bc928c
@ -35,6 +35,15 @@
|
|||||||
</itemizedlist>
|
</itemizedlist>
|
||||||
</listitem>
|
</listitem>
|
||||||
-->
|
-->
|
||||||
|
<listitem>
|
||||||
|
<para>2014-04-07</para>
|
||||||
|
<itemizedlist>
|
||||||
|
<listitem>
|
||||||
|
<para>[bdubbs] - Add section on systemd customization.</para>
|
||||||
|
</listitem>
|
||||||
|
</itemizedlist>
|
||||||
|
</listitem>
|
||||||
|
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>2014-03-31</para>
|
<para>2014-03-31</para>
|
||||||
<itemizedlist>
|
<itemizedlist>
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
|
||||||
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="sysd-custom.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="setclock.xml"/>
|
||||||
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/>
|
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="console.xml"/>
|
||||||
|
@ -23,6 +23,9 @@
|
|||||||
equivalent settings in <filename>rc.site</filename>), the
|
equivalent settings in <filename>rc.site</filename>), the
|
||||||
<command>console</command> bootscript will do nothing.</para>
|
<command>console</command> bootscript will do nothing.</para>
|
||||||
|
|
||||||
|
<sect2 id="ch-scripts-sysv-console">
|
||||||
|
<title>Systemd V</title>
|
||||||
|
|
||||||
<para>The <command>console</command> script reads the
|
<para>The <command>console</command> script reads the
|
||||||
<filename>/etc/sysconfig/console</filename> file for configuration
|
<filename>/etc/sysconfig/console</filename> file for configuration
|
||||||
information. Decide which keymap and screen font will be used. Various
|
information. Decide which keymap and screen font will be used. Various
|
||||||
@ -227,10 +230,96 @@ EOF</userinput></screen>
|
|||||||
<!-- Added because folks keep posting their console file with X questions
|
<!-- Added because folks keep posting their console file with X questions
|
||||||
to blfs-support list -->
|
to blfs-support list -->
|
||||||
<note>
|
<note>
|
||||||
<para>The <filename>/etc/sysconfig/console</filename> file only controls the Linux text console localization. It has nothing to do with setting the
|
<para>The <filename>/etc/sysconfig/console</filename> file only controls
|
||||||
proper keyboard layout and terminal fonts in the X Window System, with ssh
|
the Linux text console localization. It has nothing to do with setting
|
||||||
sessions or with a serial console. In such situations, limitations mentioned
|
the proper keyboard layout and terminal fonts in the X Window System, with
|
||||||
in the last two list items above do not apply.</para>
|
ssh sessions or with a serial console. In such situations, limitations
|
||||||
|
mentioned in the last two list items above do not apply.</para>
|
||||||
</note>
|
</note>
|
||||||
|
|
||||||
|
</sect2>
|
||||||
|
|
||||||
|
<sect2 id="ch-scripts-systemd-console">
|
||||||
|
<title>Systemd</title>
|
||||||
|
|
||||||
|
<indexterm zone="ch-scripts-systemd-console">
|
||||||
|
<primary sortas="d-console">systemd console</primary>
|
||||||
|
<secondary>configuring</secondary>
|
||||||
|
</indexterm>
|
||||||
|
|
||||||
|
<para>This section discusses how to configure the
|
||||||
|
<command>systemd-vconsole-setup</command> system service, which configures
|
||||||
|
the virtual console font and console keymap.</para>
|
||||||
|
|
||||||
|
<para>The <command>systemd-vconsole-setup</command> service reads the
|
||||||
|
<filename>/etc/vconsole.conf</filename> file for configuration
|
||||||
|
information. Decide which keymap and screen font will be used. Various
|
||||||
|
language-specific HOWTOs can also help with this, see <ulink
|
||||||
|
url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>.
|
||||||
|
Examine <command>localectl list-keymaps</command> output for a list of
|
||||||
|
valid console keymaps. Look in
|
||||||
|
<filename class="directory">/usr/share/consolefonts</filename>
|
||||||
|
directory for valid screen fonts.</para>
|
||||||
|
|
||||||
|
<para>The <filename>/etc/vconsole.conf</filename> file should contain lines
|
||||||
|
of the form: VARIABLE="value". The following variables are recognized:</para>
|
||||||
|
|
||||||
|
<variablelist>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>KEYMAP</term>
|
||||||
|
<listitem>
|
||||||
|
<para>This variable specifies the key mapping table for the keyboard. If
|
||||||
|
unset, it defaults to <literal>us</literal>.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>KEYMAP_TOGGLE</term>
|
||||||
|
<listitem>
|
||||||
|
<para>This variable can be used to configure a second toggle keymap and
|
||||||
|
is unset by default.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>FONT</term>
|
||||||
|
<listitem>
|
||||||
|
<para>This variable specifies the font used by the virtual
|
||||||
|
console.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
<varlistentry>
|
||||||
|
<term>FONT_MAP</term>
|
||||||
|
<listitem>
|
||||||
|
<para>This variable specifies the console map to be used.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>FONT_UNIMAP</term>
|
||||||
|
<listitem>
|
||||||
|
<para>This variable specifies the unicode font map.</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
|
</variablelist>
|
||||||
|
|
||||||
|
<para>An example for a German keyboard and console is given below:</para>
|
||||||
|
|
||||||
|
<screen role="nodump"><userinput>cat > /etc/vconsole.conf << "EOF"
|
||||||
|
<literal>KEYMAP=de-latin1
|
||||||
|
FONT=Lat2-Terminus16</literal>
|
||||||
|
EOF</userinput></screen>
|
||||||
|
|
||||||
|
<para>You can change KEYMAP value at runtime by using the
|
||||||
|
<command>localectl</command> utility:</para>
|
||||||
|
|
||||||
|
<screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
|
||||||
|
|
||||||
|
<note><para>Please note that <command>localectl</command> command can
|
||||||
|
be used only on a system booted with Systemd.</para></note>
|
||||||
|
|
||||||
|
</sect2>
|
||||||
|
|
||||||
</sect1>
|
</sect1>
|
||||||
|
@ -206,12 +206,12 @@ EOF</userinput></screen>
|
|||||||
<para>To disable a previously enabled network interface
|
<para>To disable a previously enabled network interface
|
||||||
card configuration at boot, run:</para>
|
card configuration at boot, run:</para>
|
||||||
|
|
||||||
<screen><userinput>systemctl disable ifupdown@eth0</userinput></screen>
|
<screen role="nodump"><userinput>systemctl disable ifupdown@eth0</userinput></screen>
|
||||||
|
|
||||||
<para>To manually start the network interface card configuration,
|
<para>To manually start the network interface card configuration,
|
||||||
run:</para>
|
run:</para>
|
||||||
|
|
||||||
<screen><userinput>systemctl start ifupdown@eth0</userinput></screen>
|
<screen role="nodump"><userinput>systemctl start ifupdown@eth0</userinput></screen>
|
||||||
|
|
||||||
<para>Replace eth0 with the correct network interface card
|
<para>Replace eth0 with the correct network interface card
|
||||||
name as described on the beginning of this page.</para>
|
name as described on the beginning of this page.</para>
|
||||||
|
116
chapter07/sysd-custom.xml
Normal file
116
chapter07/sysd-custom.xml
Normal file
@ -0,0 +1,116 @@
|
|||||||
|
<?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>
|
@ -1,5 +1,5 @@
|
|||||||
<!ENTITY version "SVN-20140404">
|
<!ENTITY version "SVN-20140407">
|
||||||
<!ENTITY releasedate "April 4, 2014">
|
<!ENTITY releasedate "April 7, 2014">
|
||||||
<!ENTITY copyrightdate "1999-2014"><!-- jhalfs needs a literal dash, not – -->
|
<!ENTITY copyrightdate "1999-2014"><!-- jhalfs needs a literal dash, not – -->
|
||||||
<!ENTITY milestone "8.0">
|
<!ENTITY milestone "8.0">
|
||||||
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->
|
<!ENTITY generic-version "development"> <!-- Use "development", "testing", or "x.y[-pre{x}]" -->
|
||||||
|
Loading…
Reference in New Issue
Block a user