Changeset cba2d4e for chapter07


Ignore:
Timestamp:
04/03/2014 09:52:09 PM (10 years ago)
Author:
Bruce Dubbs <bdubbs@…>
Branches:
10.0, 10.0-rc1, 10.1, 10.1-rc1, 11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, 7.6, 7.7, 7.8, 7.9, 8.0, 8.1, 8.2, 8.3, 8.4, 9.0, 9.1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
9839808
Parents:
008436e
Message:

Added systemd and dbus to the book.
Set up systemd and System V side-by-side with the
ability to reboot to either system.

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@10520 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

Location:
chapter07
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • chapter07/bootscripts.xml

    r008436e rcba2d4e  
    2424    <title/>
    2525
    26     <para>The LFS-Bootscripts package contains a set of scripts to start/stop the
    27     LFS system at bootup/shutdown.</para>
     26    <para>The LFS-Bootscripts package contains a set of scripts to start/stop
     27    the LFS system at bootup/shutdown.  The networking systemd unit file is
     28    also installed.</para>
    2829
    2930    <segmentedlist>
     
    5253    <segmentedlist>
    5354      <segtitle>Installed scripts</segtitle>
     55      <segtitle>Installed unit</segtitle>
    5456      <segtitle>Installed directories</segtitle>
    5557
     
    5961        sendsignals, setclock, ipv4-static, swap, sysctl, sysklogd, template,
    6062        udev, and udev_retry</seg>
     63        <seg>ifupdown@.service</seg>
    6164        <seg>/etc/rc.d, /etc/init.d (symbolic link), /etc/sysconfig,
    6265        /lib/services, /lib/lsb (symbolic link)</seg>
  • chapter07/chapter07.xml

    r008436e rcba2d4e  
    1010  <?dbhtml filename="chapter07.html"?>
    1111
    12   <title>Setting Up System Bootscripts</title>
     12  <title>System Configuration and Bootscripts</title>
    1313
    1414  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="introduction.xml"/>
     15  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
    1516  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="network.xml"/>
    1617  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hosts.xml"/>
    1718  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="udev.xml"/>
    1819  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="symlinks.xml"/>
    19   <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="bootscripts.xml"/>
    2020  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="usage.xml"/>
    2121  <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="hostname.xml"/>
  • chapter07/hostname.xml

    r008436e rcba2d4e  
    1616  </indexterm>
    1717
    18   <para>Part of the job of the <command>localnet</command> script is setting the
    19   system's hostname. This needs to be configured in the
    20   <filename>/etc/sysconfig/network</filename> file.</para>
     18  <para>Durein gthe boot process, both Systemd and System V use the same
     19  file for establixhg the system's hostname.This needs to be configured by
     20  creating <filename>/etc/hostname</filename>.</para>
    2121
    22   <para>Create the <filename>/etc/sysconfig/network</filename> file and enter a
     22  <para>Create the <filename>/etc/hostname</filename> file and enter a
    2323  hostname by running:</para>
    2424
    25 <screen><userinput>echo "HOSTNAME=<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/sysconfig/network</userinput></screen>
     25<screen><userinput>echo "<replaceable>&lt;lfs&gt;</replaceable>" &gt; /etc/hostname</userinput></screen>
    2626
    2727  <para><replaceable>&lt;lfs&gt;</replaceable> needs to be replaced with the name given
  • chapter07/introduction.xml

    r008436e rcba2d4e  
    1111  <title>Introduction</title>
    1212
    13   <para>This chapter discusses configuration files and boot scripts.
    14   First, the general configuration files needed to set up networking are
    15   presented.</para>
    16 
    17   <itemizedlist>
    18      <listitem>
    19        <para><xref linkend="ch-scripts-network" role="."/></para>
    20      </listitem>
    21      <listitem>
    22        <para><xref linkend="ch-scripts-hosts" role="."/></para>
    23      </listitem>
    24   </itemizedlist>
    25 
    26   <para>Second, issues that affect the proper setup of devices are
    27   discussed.</para>
    28 
    29   <itemizedlist>
    30      <listitem>
    31        <para><xref linkend="ch-scripts-udev" role="."/></para>
    32      </listitem>
    33      <listitem>
    34        <para><xref linkend="ch-scripts-symlinks" role="."/></para>
    35      </listitem>
    36   </itemizedlist>
    37 
    38   <para>The next sections detail how to install and configure the LFS system
    39   scripts needed during the boot process. Most of these scripts will work
    40   without modification, but a few require additional configuration files
    41   because they deal with hardware-dependent information.</para>
    42 
    43   <para>System-V style init scripts are employed in this book because they are
    44   widely used and relatively simple. For additional options, a hint detailing
    45   the BSD style init setup is available at <ulink
    46   url="&hints-root;bsd-init.txt"/>.  Searching the LFS mailing lists for
    47   <quote>depinit</quote>, <quote>upstart</quote>, or <quote>systemd</quote>
    48   will also offer additional information.</para>
    49 
    50   <para>If using an alternative style of init scripts, skip these sections.</para>
    51 
    52   <para>A listing of the boot scripts are found in <xref linkend="scripts"
    53   role="."/>.</para>
    54 
    55 
    56   <itemizedlist>
    57      <listitem>
    58        <para><xref linkend="ch-scripts-bootscripts" role="."/></para>
    59      </listitem>
    60      <listitem>
    61        <para><xref linkend="ch-scripts-usage" role="."/></para>
    62      </listitem>
    63      <listitem>
    64        <para><xref linkend="ch-scripts-hostname" role="."/></para>
    65      </listitem>
    66      <listitem>
    67        <para><xref linkend="ch-scripts-setclock" role="."/></para>
    68      </listitem>
    69      <listitem>
    70        <para><xref linkend="ch-scripts-console" role="."/></para>
    71      </listitem>
    72      <listitem>
    73        <para><xref linkend="ch-scripts-sysklogd" role="."/></para>
    74      </listitem>
    75   </itemizedlist>
    76 
    77 
    78   <para>Finally, there is a brief introduction to the scripts and configuration
    79   files used when the user logs into the system.</para>
    80 
    81   <itemizedlist>
    82      <listitem>
    83        <para><xref linkend="ch-scripts-profile" role="."/></para>
    84      </listitem>
    85      <listitem>
    86        <para><xref linkend="ch-scripts-inputrc" role="."/></para>
    87      </listitem>
    88   </itemizedlist>
    89 
     13    <para>Booting a Linux system involves several tasks.  The process must
     14    mount both virtual and real file systems, initialize devices, activate swap,
     15    check file systems for integrity, mount any swap partitions or files, set
     16    the system clock, bring up networking, start any daemons required by the
     17    system, and accomplish any other custom tasks needed by the user.  This
     18    process must be organized to ensure the tasks are performed in the correct
     19    order but, at the same time, be executed as fast as possible.</para>
     20
     21    <para>In the packages that were installed in Chapter 6, there were two
     22    different boot systems installed.  LFS provides the ability to easily
     23    select which system the user wants to use and to compare and contrast the
     24    two systems by actually running each system on the local computer.  The
     25    advantages and disadvantages of these systems is presented below.</para>
     26
     27  <sect2 id='sysv-desc'>
     28    <title>System V</title>
     29
     30    <para>System V is the classic boot process that has been used in Unix and
     31    Unix-like systems such as Linux since about 1983.  It consists of a small
     32    program, <command>init</command>, that sets up basic programs such as
     33    <command>login</command> (via getty) and runs a script.  This script,
     34    usually named <command>rc</command>,  controls the execution of a set of
     35    additional scripts that perform the tasks required to initialize the
     36    system.</para>
     37
     38    <para>The <command>init</command> program is controlled by the
     39    <filename>/etc/inittab</filename> file and is organized into run levels that
     40    can be run by the user:</para>
     41
     42    <itemizedlist>
     43      <listitem><para>0 &mdash; halt</para></listitem>
     44      <listitem><para>1 &mdash; Single user mode</para></listitem>
     45      <listitem><para>2 &mdash; Multiuser, without networking</para></listitem>
     46      <listitem><para>3 &mdash; Full multiuser mode</para></listitem>
     47      <listitem><para>4 &mdash; User definable</para></listitem>
     48      <listitem><para>5 &mdash; Full multiuser mode with display manager</para></listitem>
     49      <listitem><para>6 &mdash; reboot</para></listitem>
     50    </itemizedlist>
     51
     52    <para>The usual default run level is 3 or 5.</para>
     53
     54    <bridgehead renderas="sect3">Advantages</bridgehead>
     55
     56    <itemizedlist>
     57      <listitem>
     58          <para>Established, well understood system.</para>
     59      </listitem>
     60
     61      <listitem>
     62          <para>Easy to customize.</para>
     63      </listitem>
     64
     65    </itemizedlist>
     66
     67
     68    <bridgehead renderas="sect3">Disadvantages</bridgehead>
     69
     70    <itemizedlist>
     71      <listitem>
     72          <para>Slower to boot.  A medium speed base LFS system
     73          takes 8-12 seconds where the boot time is measured from the
     74          first kernel message to the login prompt.  Network
     75          connectivity is typically established about 2 seconds
     76          after the login prompt.</para>
     77      </listitem>
     78
     79      <listitem>
     80          <para>Serial processing of boot tasks. This is related to the previous
     81          point.  A delay in any process such as a file system check, will
     82          delay the entire boot process.</para>
     83      </listitem>
     84
     85      <listitem>
     86          <para>Does not directly support advanced features like
     87          control groups (cgroups), and per-user fair share scheduling.</para>
     88      </listitem>
     89
     90      <listitem>
     91          <para>Adding scripts requires manual, static sequencing decisions.</para>
     92      </listitem>
     93
     94    </itemizedlist>
     95
     96  </sect2>
     97
     98  <sect2 id='sysd-desc'>
     99    <title>Systemd</title>
     100
     101    <para>Systemd is a group of interconnected programs that handles system and
     102    individual process requests.  It provides a dependency system between
     103    various entities called "units".  It automatically addresses dependencies
     104    between units and can execute several startup tasks in parallel.  It
     105    provides login, inetd, logging, time, and networking services. </para>
     106
     107    <bridgehead renderas="sect3">Advantages</bridgehead>
     108
     109    <itemizedlist>
     110      <listitem>
     111          <para>Used on many established distributions by default.</para>
     112      </listitem>
     113
     114      <listitem>
     115          <para>There is extensive documentation.
     116          See <ulink url="http://www.freedesktop.org/wiki/Software/systemd/"/>.</para>
     117      </listitem>
     118
     119      <listitem>
     120          <para>Parallel execution of boot processes. A medium speed
     121          base LFS system takes 6-10 seconds from kernel start to a
     122          login prompt.  Network connectivity is typically established
     123          about 2 seconds after the login prompt.  More complex startup
     124          procedures may show a greater speedup when compared to System V.</para>
     125      </listitem>
     126
     127      <listitem>
     128          <para>Implements advanced features such as control groups to
     129          manage related processes.</para>
     130      </listitem>
     131
     132      <listitem>
     133          <para>Maintains backward compatibility with System V programs
     134          and scripts.</para>
     135      </listitem>
     136    </itemizedlist>
     137
     138    <bridgehead renderas="sect3">Disadvantages</bridgehead>
     139
     140    <itemizedlist>
     141      <listitem>
     142          <para>There is a substantial learning curve.</para>
     143      </listitem>
     144
     145      <listitem>
     146          <para>Some advanced features such as dbus or cgroups cannot be
     147          disabled if they are not otherwise needed.</para>
     148      </listitem>
     149
     150      <listitem>
     151          <para>Although implemented as several executable programs
     152          the user cannot choose to implement only the portions desired.</para>
     153      </listitem>
     154
     155      <listitem>
     156          <para>Due to the nature of using compiled programs, systemd is
     157          more difficult to debug.</para>
     158      </listitem>
     159
     160      <listitem>
     161          <para>Logging is done in a binary format.  Extra tools must
     162          be used to process logs or additional processes must be implemented
     163          to duplicate traditional logging programs.</para>
     164      </listitem>
     165
     166    </itemizedlist>
     167
     168  </sect2>
     169
     170  <sect2 id='sysv'>
     171    <title>Selecting a Boot Method</title>
     172
     173    <para>Selecting a boot method in LFS is relatively easy. 
     174    Both systems are installed side-by-side.  The only task needed is to
     175    ensure the files that are needed by the system have the correct names.
     176    The following scripts do that.</para>
     177
     178<screen><userinput remap="install">cat &gt; /usr/local/sbin/set-systemd &lt;&lt; "EOF"
     179#! /bin/bash
     180
     181ln -svfn init-systemd   /sbin/init
     182ln -svfn init.d-systemd /etc/init.d
     183
     184for tool in halt poweroff reboot runlevel shutdown telinit; do
     185  ln -sfvn  $(tool}-systemd   /sbin/${tool}
     186  ln -svfn  ${tool}-systemd.8 /usr/share/man/man8/${tool}.8
     187done
     188
     189echo "Now reboot with /sbin/reboot-sysv"
     190EOF
     191
     192chmod 0744 /usr/local/sbin/set-systemd
     193
     194cat &gt; /usr/local/sbin/set-sysv &lt;&lt; "EOF"
     195ln -sfvn init-sysv    /sbin/init
     196ln -svfn init.d-sysv  /etc/init.d
     197
     198for tool in halt poweroff reboot runlevel shutdown telinit; do
     199  ln -sfvn  ${tool}-sysv   /sbin/${tool}
     200  ln -svfn  ${tool}-sysv.8 /usr/share/man/man8/${tool}.8
     201done
     202
     203echo "Now reboot with /sbin/reboot-systemd"
     204EOF
     205
     206chmod 0744 /usr/local/sbin/set-sysv</userinput></screen>
     207
     208  <para>Now set the desired boot system.  The default is System V:</para>
     209
     210<screen><userinput remap="install">/usr/local/sbin/set-sysv</userinput></screen>
     211
     212  <para>Changing the boot system can be done at any time by running the
     213  appropriate script above and rebooting.</para>
     214
     215  </sect2>
    90216
    91217</sect1>
  • chapter07/network.xml

    r008436e rcba2d4e  
    4343    to network cards based on their MAC address.</para>
    4444
    45     <para>The rules were pre-generated in the build instructions for
    46     <application>udev (systemd)</application> in the last chapter.  Inspect the
     45    <para>If using the traditional network interface names such as eth0 is desired,
     46    generate a custom Udev rule:</para>
     47
     48<screen><userinput>bash /lib/udev/init-net-rules.sh</userinput></screen>   
     49
     50    <para> Now, inspect the
    4751    <filename>/etc/udev/rules.d/70-persistent-net.rules</filename> file, to
    4852    find out which name was assigned to which network device:</para>
     
    123127    class="directory">/etc/sysconfig/</filename>.  This directory should
    124128    contain a file for each interface to be configured, such as
    125     <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is
    126     meaningful to the administrator such as the device name (e.g. eth0).
    127     Inside this file are attributes to this interface, such as its IP
    128     address(es), subnet masks, and so forth.  It is necessary that
    129     the stem of the filename be <emphasis>ifconfig</emphasis>.</para>
     129    <filename>ifconfig.xyz</filename>, where <quote>xyz</quote> is required to
     130    be a Network Card Interface name (e.g. eth0).  Inside this file are
     131    attributes to this interface, such as its IP address(es), subnet masks, and
     132    so forth.  It is necessary that the stem of the filename be
     133    <emphasis>ifconfig</emphasis>.</para>
     134
     135    <note><para>If the procedure in the previous section was not used, Udev
     136    will assign network card interface names based on system physical
     137    characteristics such as enp2s1. If you are not sure what your interface
     138    name is, you can always run <command>ip link</command>  after you have
     139    booted your system.  Again, it is important that ifconfig.xyz is named
     140    after correct network card interface name (e.g. ifconfig.enp2s1 or
     141    ifconfig.eth0) or your network interface will not be initialized during
     142    the boot process.</para></note>
    130143
    131144    <para>The following command creates a sample file for the
     
    137150IFACE=eth0
    138151SERVICE=ipv4-static
    139 IP=192.168.1.1
    140 GATEWAY=192.168.1.2
     152IP=192.168.1.2
     153GATEWAY=192.168.1.1
    141154PREFIX=24
    142155BROADCAST=192.168.1.255</literal>
     
    147160
    148161    <para>If the <envar>ONBOOT</envar> variable is set to <quote>yes</quote> the
    149     network script will bring up the Network Interface Card (NIC) during
     162    System V network script will bring up the Network Interface Card (NIC) during
    150163    booting of the system. If set to anything but <quote>yes</quote> the NIC
    151164    will be ignored by the network script and not be automatically brought up.
     
    182195  </sect2>
    183196
     197  <sect2 id="systemd-net-enable">
     198    <title>Configuring the Network Interface Card at boot (systemd)</title>
     199
     200    <para>Enabling of the network interface card configuration
     201    in systemd is done per interface. To enable network interface card
     202    configuration at boot, run:</para>
     203
     204<screen><userinput>systemctl enable ifupdown@eth0</userinput></screen>
     205
     206    <para>To disable a previously enabled network interface
     207    card configuration at boot, run:</para>
     208
     209<screen><userinput>systemctl disable ifupdown@eth0</userinput></screen>
     210
     211    <para>To manually start the network interface card configuration,
     212    run:</para>
     213
     214<screen><userinput>systemctl start ifupdown@eth0</userinput></screen>
     215
     216    <para>Replace eth0 with the correct network interface card
     217    name as described on the beginning of this page.</para>
     218
     219    <note><para>The network card can also be started or stopped
     220    with the traditional <command>ifup &lt;device&gt;</command> or
     221    <command>ifdown &lt;device&gt;</command> commands.</para></note>
     222
     223  </sect2>
     224
    184225  <sect2 id="resolv.conf">
    185226    <title>Creating the /etc/resolv.conf File</title>
  • chapter07/setclock.xml

    r008436e rcba2d4e  
    66]>
    77
    8 <sect1 id="ch-scripts-setclock">
    9   <?dbhtml filename="setclock.html"?>
     8<sect1 id="ch-scripts-clock">
     9  <?dbhtml filename="clock.html"?>
    1010
    11   <title>Configuring the setclock Script</title>
     11  <title>Configuring the System Clock</title>
    1212
    13   <indexterm zone="ch-scripts-setclock">
    14     <primary sortas="d-setclock">setclock</primary>
    15   <secondary>configuring</secondary></indexterm>
     13  <para>Procedures for setting the system clock differ between systemd and
     14  System V, however the separate procedures do not conflict so both
     15  procedures should be accomplished to allow switching between systems.</para>
    1616
    17   <para>The <command>setclock</command> script reads the time from the hardware
    18   clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
    19   (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
    20   hardware clock's time to the local time using the
    21   <filename>/etc/localtime</filename> file (which tells the
    22   <command>hwclock</command> program which timezone the user is in). There is no
    23   way to detect whether or not the hardware clock is set to UTC, so this
    24   needs to be configured manually.</para>
     17  <sect2 id="ch-scripts-setclock">
     18    <title>System V Clock Configuration</title>
    2519
    26   <para>The <command>setclock</command> is run via
    27   <application>udev</application> when the kernel detects the hardware
    28   capability upon boot.  It can also be run manually with the stop parameter to
    29   store the system time to the CMOS clock.</para>
     20    <indexterm zone="ch-scripts-setclock">
     21      <primary sortas="d-setclock">setclock</primary>
     22    <secondary>configuring</secondary></indexterm>
    3023
    31   <para>If you cannot remember whether or not the hardware clock is set to UTC,
    32   find out by running the <userinput>hwclock --localtime --show</userinput>
    33   command. This will display what the current time is according to the hardware
    34   clock. If this time matches whatever your watch says, then the hardware clock is
    35   set to local time. If the output from <command>hwclock</command> is not local
    36   time, chances are it is set to UTC time. Verify this by adding or subtracting
    37   the proper amount of hours for the timezone to the time shown by
    38   <command>hwclock</command>. For example, if you are currently in the MST
    39   timezone, which is also known as GMT -0700, add seven hours to the local
    40   time.</para>
     24    <para>The <command>setclock</command> script reads the time from the hardware
     25    clock, also known as the BIOS or the Complementary Metal Oxide Semiconductor
     26    (CMOS) clock. If the hardware clock is set to UTC, this script will convert the
     27    hardware clock's time to the local time using the
     28    <filename>/etc/localtime</filename> file (which tells the
     29    <command>hwclock</command> program which timezone the user is in). There is no
     30    way to detect whether or not the hardware clock is set to UTC, so this
     31    needs to be configured manually.</para>
    4132
    42   <para>Change the value of the <envar>UTC</envar> variable below
    43   to a value of <parameter>0</parameter> (zero) if the hardware clock
    44   is <emphasis>not</emphasis> set to UTC time.</para>
     33    <para>The <command>setclock</command> is run via
     34    <application>udev</application> when the kernel detects the hardware
     35    capability upon boot.  It can also be run manually with the stop parameter to
     36    store the system time to the CMOS clock.</para>
    4537
    46   <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
    47   the following:</para>
     38    <para>If you cannot remember whether or not the hardware clock is set to UTC,
     39    find out by running the <userinput>hwclock --localtime --show</userinput>
     40    command. This will display what the current time is according to the hardware
     41    clock. If this time matches whatever your watch says, then the hardware clock is
     42    set to local time. If the output from <command>hwclock</command> is not local
     43    time, chances are it is set to UTC time. Verify this by adding or subtracting
     44    the proper amount of hours for the timezone to the time shown by
     45    <command>hwclock</command>. For example, if you are currently in the MST
     46    timezone, which is also known as GMT -0700, add seven hours to the local
     47    time.</para>
     48
     49    <para>Change the value of the <envar>UTC</envar> variable below
     50    to a value of <parameter>0</parameter> (zero) if the hardware clock
     51    is <emphasis>not</emphasis> set to UTC time.</para>
     52
     53    <para>Create a new file <filename>/etc/sysconfig/clock</filename> by running
     54    the following:</para>
    4855
    4956<screen><userinput>cat &gt; /etc/sysconfig/clock &lt;&lt; "EOF"
     
    5966EOF</userinput></screen>
    6067
    61   <para>A good hint explaining how to deal with time on LFS is available
    62   at <ulink url="&hints-root;time.txt"/>. It explains issues such as
    63   time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
     68    <para>A good hint explaining how to deal with time on LFS is available
     69    at <ulink url="&hints-root;time.txt"/>. It explains issues such as
     70    time zones, UTC, and the <envar>TZ</envar> environment variable.</para>
    6471
    65   <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
    66   in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
     72    <note><para>The CLOCKPARAMS and UTC paramaters may be alternatively set
     73    in the <filename>/etc/sysconfig/rc.site</filename> file.</para></note>
     74
     75  </sect2>
     76
     77  <sect2 id="ch-scripts-systemd-clock">
     78    <title>Systemd Clock Configuration</title>
     79
     80  <indexterm zone="ch-scripts-clock">
     81    <primary sortas="d-clock">clock</primary>
     82  <secondary>configuring</secondary></indexterm>
     83
     84  <para>This section discusses how to configure the
     85  <command>systemd-timedated</command> system service, which configures
     86  system clock and timezone.</para>
     87
     88  <para><command>systemd-timedated</command> reads
     89  <filename>/etc/adjtime</filename>, and depending on the contents of the file,
     90  it sets the clock to either UTC or local time.  Create the
     91  <filename>/etc/adjtime</filename> file with the following contents <emphasis>if your
     92  hardware clock is set to local time</emphasis>:</para>
     93
     94<screen role="nodump"><userinput>cat &gt; /etc/adjtime &lt;&lt; "EOF"
     95<literal>0.0 0 0.0
     960
     97LOCAL</literal>
     98EOF</userinput></screen>
     99
     100    <para>If <filename>/etc/adjtime</filename> isn't present at first boot,
     101    <command>systemd-timedated</command> will assume that hardware clock is
     102    set to UTC and create the file using that setting.</para>
     103
     104    <para>You can also use the <command>timedatectl</command> utility to tell
     105    <command>systemd-timedated</command> if your hardware clock is set to
     106    UTC or local time:</para>
     107
     108<screen role="nodump"><userinput>timedatectl set-local-rtc 1</userinput></screen>
     109
     110    <para><command>timedatectl</command> can also be used to change system time and
     111    time zone.</para>
     112
     113    <para>To change your current system time, issue:</para>
     114
     115<screen role="nodump"><userinput>timedatectl set-time YYYY:MM:DD HH:MM:SS</userinput></screen>
     116
     117    <para>Hardware clock will also be updated accordingly.</para>
     118
     119    <para>To change your current time zone, issue:</para>
     120
     121<screen role="nodump"><userinput>timedatectl set-timezone TIMEZONE</userinput></screen>
     122
     123    <para>You can get list of available time zones by running:</para>
     124
     125<screen role="nodump"><userinput>timedatectl list-timezones</userinput></screen>
     126
     127    <note><para>Please note that <command>timedatectl</command> command can
     128    be used only on a system booted with Systemd.</para></note>
     129
     130  </sect2>
    67131
    68132</sect1>
  • chapter07/site.xml

    r008436e rcba2d4e  
    1717
    1818  <para>The optional <filename>/etc/sysconfig/rc.site</filename> file contains
    19   settings that are automatically set for each boot script.  It can alternatively
    20   set the values specified in the <filename>hostname</filename>,
     19  settings that are automatically set for each SystemV boot script.  It can
     20  alternatively set the values specified in the <filename>hostname</filename>,
    2121  <filename>console</filename>, and <filename>clock</filename> files in the
    2222  <filename class='directory'>/etc/sysconfig/</filename> directory.  If the
  • chapter07/sysklogd.xml

    r008436e rcba2d4e  
    1717
    1818  <para>The <filename>sysklogd</filename> script invokes the
    19   <command>syslogd</command> program with the <parameter>-m 0</parameter>
    20   option.  This option turns off the periodic timestamp mark that
     19  <command>syslogd</command> program as a part of System V initialization.  The
     20  <parameter>-m 0</parameter> option turns off the periodic timestamp mark that
    2121  <command>syslogd</command> writes to the log files every 20 minutes by
    2222  default.  If you want to turn on this periodic timestamp mark, edit
  • chapter07/usage.xml

    r008436e rcba2d4e  
    99  <?dbhtml filename="usage.html"?>
    1010
    11   <title>How Do These Bootscripts Work?</title>
     11  <title>How Do the System V Bootscripts Work?</title>
    1212
    1313  <indexterm zone="ch-scripts-usage">
Note: See TracChangeset for help on using the changeset viewer.