systemd-custom.xml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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-systemd-custom">
  8. <?dbhtml filename="systemd-custom.html"?>
  9. <title>Systemd Usage and Configuration</title>
  10. <indexterm zone="ch-scripts-systemd-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 options to control basic systemd operations. The default file has all
  17. entries commented out with the default settings indicated. This file is
  18. where the log level may be changed as well as some basic logging settings.
  19. See <filename>systemd-system.conf(5)</filename> manual page for details on
  20. each configuration option.</para>
  21. </sect2>
  22. <sect2>
  23. <title>Disabling Screen Clearing at Boot Time</title>
  24. <para>The normal behavior for systemd is to clear the screen at
  25. the end of the boot sequence. If desired, this behavior may be
  26. changed by running the following command:</para>
  27. <screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/getty@tty1.service.d
  28. cat &gt; /etc/systemd/system/getty@tty1.service.d/noclear.conf &lt;&lt; EOF
  29. <literal>[Service]
  30. TTYVTDisallocate=no</literal>
  31. EOF</userinput></screen>
  32. <para>The boot messages can always be revied by using the
  33. <userinput>journalctl -b</userinput> command as the root user.</para>
  34. </sect2>
  35. <sect2>
  36. <title>Disabling tmpfs for /tmp</title>
  37. <para>By default, <filename class="directory">/tmp</filename> is created as
  38. a tmpfs. If this is not desired, it can be overridden by the following:</para>
  39. <screen role="nodump"><userinput>ln -sfv /dev/null /etc/systemd/system/tmp.mount</userinput></screen>
  40. <para>This is not necessary if there is a separate partition for
  41. <filename class="directory">/tmp</filename> specified in
  42. <filename>/etc/fstab</filename>.</para>
  43. </sect2>
  44. <sect2>
  45. <title>Configuring Automatic File Creation and Deletion</title>
  46. <para>There are several services that create or delete files or
  47. directories:</para>
  48. <itemizedlist>
  49. <listitem><para>systemd-tmpfiles-clean.service</para></listitem>
  50. <listitem><para>systemd-tmpfiles-setup-dev.service</para></listitem>
  51. <listitem><para>systemd-tmpfiles-setup.service</para></listitem>
  52. </itemizedlist>
  53. <para>The system location for the configuration files is
  54. <filename>/usr/lib/tmpfiles.d/*.conf</filename>. The local
  55. configuration files are in
  56. <filename class="directory">/etc/tmpfiles.d</filename>. Files in
  57. <filename class="directory">/etc/tmpfiles.d</filename> override
  58. files with the same name in
  59. <filename class="directory">/usr/lib/tmpfiles.d</filename>. See
  60. <filename>tmpfiles.d(5)</filename> manual page for file format
  61. details.</para>
  62. </sect2>
  63. <sect2>
  64. <title>Overriding Default Services Behavior</title>
  65. <para>A systemd service contents can be overriden by creating a directory
  66. and a configuration file in <filename
  67. class="directory">/etc/systemd/system</filename>. For example:</para>
  68. <screen role="nodump"><userinput>mkdir -pv /etc/systemd/system/foobar.service.d
  69. cat > /etc/systemd/system/foobar.service.d/foobar.conf &lt;&lt; EOF
  70. <literal>[Service]
  71. Restart=always
  72. RestartSec=30</literal>
  73. EOF</userinput></screen>
  74. <para>See <filename>systemd.unit(5)</filename> manual page for more
  75. information. After creating the configuration file, run
  76. <userinput>systemctl daemon-reload</userinput> and <userinput>systemctl
  77. restart foobar</userinput> to activate the changes to a service.</para>
  78. </sect2>
  79. <sect2>
  80. <title>Debugging the Boot Sequence</title>
  81. <para>There are several commands that can be used to help debug the systemd
  82. boot process. Here are some examples:</para>
  83. <itemizedlist>
  84. <listitem><para>systemctl list-units -t service [--all]</para></listitem>
  85. <listitem><para>systemctl list-units -t target [--all]</para></listitem>
  86. <listitem><para>systemctl show -p Wants multi-user.target</para></listitem>
  87. <listitem><para>systemctl status sshd.service</para></listitem>
  88. </itemizedlist>
  89. </sect2>
  90. </sect1>