sysd-custom.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. <sect1 id="ch-scripts-sysd-custom">
  8. <?dbhtml filename="sysd-custom.html"?>
  9. <title>Systemd Usage and Confiuration</title>
  10. <indexterm zone="ch-scripts-sysd-custom">
  11. <primary sortas="e-Systemd">Systemd Customization</primary>
  12. </indexterm>
  13. <sect2>
  14. <title>Basic Configuration</title>
  15. <para>The <filename>/etc/systemd/system.conf</filename> file contains a set
  16. of items to control basic operations. The default file has all entries
  17. commented out with the default settings indicated. This file is where the
  18. log level may be changed as well as some basic journal settings.</para>
  19. </sect2>
  20. <sect2>
  21. <title>Disabling Screen Clearing at Boot Time</title>
  22. <para>The normal behavior for systemd is to clear the secreen at
  23. the end of the boot sequence. If desired, this behavior may be
  24. changed by the following:</para>
  25. <screen role="nodump"><userinput>mkdir -p /etc/systemd/system/getty@tty1.service.d
  26. cat > /etc/systemd/system/getty@tty1.service.d/noclear.conf &lt;&lt; EOF
  27. [Service]
  28. TTYVTDisallocate=no
  29. EOF</userinput></screen>
  30. <para>The boot messages can always be revied by using the
  31. <userinput>journalctl -b</userinput> command as the root user.</para>
  32. </sect2>
  33. <sect2>
  34. <title>Disabling tmpfs for /tmp </title>
  35. <para>By default, <filename class="directory">/tmp</filename> is created as
  36. a tmpfs. If this is not desired, it can be overridden by the following:</para>
  37. <screen role="nodump"><userinput>ln -s /dev/null /etc/systemd/system/tmp.mount</userinput></screen>
  38. <para>This is not necessary if there is a separate partition for /tmp
  39. specified in <filename>/etc/fstab</filename>.</para>
  40. </sect2>
  41. <sect2>
  42. <title>Configuring Automatic File Creation and Deletion</title>
  43. <para>There are several services that create or delete files or
  44. directories:</para>
  45. <itemizedlist>
  46. <listitem><para>systemd-tmpfiles-clean.service</para></listitem>
  47. <listitem><para>systemd-tmpfiles-setup-dev.service</para></listitem>
  48. <listitem><para>systemd-tmpfiles-setup.service</para></listitem>
  49. </itemizedlist>
  50. <para>The system location for the configuration files is
  51. <filename>/usr/lib/tmpfiles.d/*.conf</filename>. The local
  52. configuration files are in <filename>/etc/tmpfiles.d/*.conf</filename>.
  53. Files in /etc/tmpfiles.d override files with the same name in
  54. /usr/lib/tmpfiles.d. See <userinput>man tmpfiles.d</userinput>
  55. for file format details.</para>
  56. </sect2>
  57. <sect2>
  58. <title>Adding Custom Units and Services</title>
  59. <para>A custom service can be added by creating a directory and
  60. configuration file in <filename class="directory">/etc/systemd/system/</filename>.
  61. For example:</para>
  62. <screen role="nodump"><userinput>mkdir -p /etc/systemd/system/foobar.service.d
  63. cat > /etc/systemd/system/foobar.service.d/foobar.conf &lt;&lt; EOF
  64. [Service]
  65. Restart=always
  66. RestartSec=30
  67. EOF</userinput></screen>
  68. <para>See the man page for systemd.unit for more information. After
  69. creating the configuration file, run <userinput>systemctl
  70. daemon-reload</userinput> and <userinput>systemctl restart
  71. foobar</userinput> to activate a service or changes to a service.</para>
  72. </sect2>
  73. <sect2 id="ch-scripts-systemd-console">
  74. <title>Setting Console Fonts and Keyboard</title>
  75. <indexterm zone="ch-scripts-systemd-console">
  76. <primary sortas="d-console">systemd console</primary>
  77. <secondary>configuring</secondary>
  78. </indexterm>
  79. <para>This section discusses how to configure the
  80. <command>systemd-vconsole-setup</command> system service, which configures
  81. the virtual console font and console keymap.</para>
  82. <para>The <command>systemd-vconsole-setup</command> service reads the
  83. <filename>/etc/vconsole.conf</filename> file for configuration
  84. information. Decide which keymap and screen font will be used. Various
  85. language-specific HOWTOs can also help with this, see <ulink
  86. url="http://www.tldp.org/HOWTO/HOWTO-INDEX/other-lang.html"/>.
  87. Examine <command>localectl list-keymaps</command> output for a list of
  88. valid console keymaps. Look in
  89. <filename class="directory">/usr/share/consolefonts</filename>
  90. directory for valid screen fonts.</para>
  91. <para>The <filename>/etc/vconsole.conf</filename> file should contain lines
  92. of the form: VARIABLE="value". The following variables are recognized:</para>
  93. <variablelist>
  94. <varlistentry>
  95. <term>KEYMAP</term>
  96. <listitem>
  97. <para>This variable specifies the key mapping table for the keyboard. If
  98. unset, it defaults to <literal>us</literal>.</para>
  99. </listitem>
  100. </varlistentry>
  101. <varlistentry>
  102. <term>KEYMAP_TOGGLE</term>
  103. <listitem>
  104. <para>This variable can be used to configure a second toggle keymap and
  105. is unset by default.</para>
  106. </listitem>
  107. </varlistentry>
  108. <varlistentry>
  109. <term>FONT</term>
  110. <listitem>
  111. <para>This variable specifies the font used by the virtual
  112. console.</para>
  113. </listitem>
  114. </varlistentry>
  115. <varlistentry>
  116. <term>FONT_MAP</term>
  117. <listitem>
  118. <para>This variable specifies the console map to be used.</para>
  119. </listitem>
  120. </varlistentry>
  121. <varlistentry>
  122. <term>FONT_UNIMAP</term>
  123. <listitem>
  124. <para>This variable specifies the unicode font map.</para>
  125. </listitem>
  126. </varlistentry>
  127. </variablelist>
  128. <para>An example for a German keyboard and console is given below:</para>
  129. <screen role="nodump"><userinput>cat &gt; /etc/vconsole.conf &lt;&lt; "EOF"
  130. <literal>KEYMAP=de-latin1
  131. FONT=Lat2-Terminus16</literal>
  132. EOF</userinput></screen>
  133. <para>You can change KEYMAP value at runtime by using the
  134. <command>localectl</command> utility:</para>
  135. <screen role="nodump"><userinput>localectl set-keymap MAP</userinput></screen>
  136. <note><para>Please note that <command>localectl</command> command can
  137. be used only on a system booted with Systemd.</para></note>
  138. </sect2>
  139. <sect2>
  140. <title>Clock Configuration</title>
  141. <indexterm zone="ch-scripts-clock">
  142. <primary sortas="d-clock">clock</primary>
  143. <secondary>configuring</secondary></indexterm>
  144. <para>This section discusses how to configure the
  145. <command>systemd-timedated</command> system service, which configures
  146. system clock and timezone.</para>
  147. <para><command>systemd-timedated</command> reads
  148. <filename>/etc/adjtime</filename>, and depending on the contents of the file,
  149. it sets the clock to either UTC or local time. Create the
  150. <filename>/etc/adjtime</filename> file with the following contents <emphasis>if your
  151. hardware clock is set to local time</emphasis>:</para>
  152. <screen role="nodump"><userinput>cat &gt; /etc/adjtime &lt;&lt; "EOF"
  153. <literal>0.0 0 0.0
  154. 0
  155. LOCAL</literal>
  156. EOF</userinput></screen>
  157. <para>If <filename>/etc/adjtime</filename> isn't present at first boot,
  158. <command>systemd-timedated</command> will assume that hardware clock is
  159. set to UTC and create the file using that setting.</para>
  160. <para>You can also use the <command>timedatectl</command> utility to tell
  161. <command>systemd-timedated</command> if your hardware clock is set to
  162. UTC or local time:</para>
  163. <screen role="nodump"><userinput>timedatectl set-local-rtc 1</userinput></screen>
  164. <para><command>timedatectl</command> can also be used to change system time and
  165. time zone.</para>
  166. <para>To change your current system time, issue:</para>
  167. <screen role="nodump"><userinput>timedatectl set-time YYYY:MM:DD HH:MM:SS</userinput></screen>
  168. <para>Hardware clock will also be updated accordingly.</para>
  169. <para>To change your current time zone, issue:</para>
  170. <screen role="nodump"><userinput>timedatectl set-timezone TIMEZONE</userinput></screen>
  171. <para>You can get list of available time zones by running:</para>
  172. <screen role="nodump"><userinput>timedatectl list-timezones</userinput></screen>
  173. <note><para>The <command>timedatectl</command> command can
  174. be used only on a system booted with Systemd.</para></note>
  175. </sect2>
  176. <sect2>
  177. <title>Debugging the Boot Sequence</title>
  178. <para>There are several commands that can be used to help debug the systemd
  179. boot process. Here are some examples:</para>
  180. <itemizedlist>
  181. <listitem><para>systemctl list-units -t service [--all]</para></listitem>
  182. <listitem><para>systemctl list-units -t target [--all]</para></listitem>
  183. <listitem><para>systemctl show -p Wants multi-user.target</para></listitem>
  184. <listitem><para>systemctl status sshd.service</para></listitem>
  185. </itemizedlist>
  186. </sect2>
  187. </sect1>