sysd-custom.xml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 Customization</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>
  74. <title>Debugging the Boot Sequence</title>
  75. <para>There are several commands that can be used to help debug the systemd
  76. boot process. Here are some examples:</para>
  77. <itemizedlist>
  78. <listitem><para>systemctl list-units -t service [--all]</para></listitem>
  79. <listitem><para>systemctl list-units -t target [--all]</para></listitem>
  80. <listitem><para>systemctl show -p Wants multi-user.target</para></listitem>
  81. <listitem><para>systemctl status sshd.service</para></listitem>
  82. </itemizedlist>
  83. </sect2>
  84. </sect1>