| 1 |
<?xml version="1.0"?> |
| 2 |
<!--*-nxml-*--> |
| 3 |
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 4 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 5 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 6 |
<refentry id="systemd-random-seed.service" conditional='ENABLE_RANDOMSEED' |
| 7 |
xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 8 |
|
| 9 |
<refentryinfo> |
| 10 |
<title>systemd-random-seed.service</title> |
| 11 |
<productname>systemd</productname> |
| 12 |
</refentryinfo> |
| 13 |
|
| 14 |
<refmeta> |
| 15 |
<refentrytitle>systemd-random-seed.service</refentrytitle> |
| 16 |
<manvolnum>8</manvolnum> |
| 17 |
</refmeta> |
| 18 |
|
| 19 |
<refnamediv> |
| 20 |
<refname>systemd-random-seed.service</refname> |
| 21 |
<refname>systemd-random-seed</refname> |
| 22 |
<refpurpose>Load and save the OS system random seed at boot and shutdown</refpurpose> |
| 23 |
</refnamediv> |
| 24 |
|
| 25 |
<refsynopsisdiv> |
| 26 |
<para><filename>systemd-random-seed.service</filename></para> |
| 27 |
<para><filename>/usr/lib/systemd/systemd-random-seed</filename></para> |
| 28 |
</refsynopsisdiv> |
| 29 |
|
| 30 |
<refsect1> |
| 31 |
<title>Description</title> |
| 32 |
|
| 33 |
<para><filename>systemd-random-seed.service</filename> is a service that loads an on-disk random seed |
| 34 |
into the kernel entropy pool during boot and saves it at shutdown. See |
| 35 |
<citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for |
| 36 |
details. By default, no entropy is credited when the random seed is written into the kernel entropy pool, |
| 37 |
but this may be changed with <varname>$SYSTEMD_RANDOM_SEED_CREDIT</varname>, see below. On disk the random |
| 38 |
seed is stored in <filename>/var/lib/systemd/random-seed</filename>.</para> |
| 39 |
|
| 40 |
<para>Note that this service runs relatively late during the early boot phase, i.e. generally after the |
| 41 |
initrd phase has finished and the <filename>/var/</filename> file system has been mounted. Many system |
| 42 |
services require entropy much earlier than this — this service is hence of limited use for complex |
| 43 |
system. It is recommended to use a boot loader that can pass an initial random seed to the kernel to |
| 44 |
ensure that entropy is available from earliest boot on, for example |
| 45 |
<citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>, with |
| 46 |
its <command>bootctl random-seed</command> functionality.</para> |
| 47 |
|
| 48 |
<para>When loading the random seed from disk, the file is immediately updated with a new seed retrieved |
| 49 |
from the kernel, in order to ensure no two boots operate with the same random seed. This new seed is |
| 50 |
retrieved synchronously from the kernel, which means the service will not complete start-up until the |
| 51 |
random pool is fully initialized. On entropy-starved systems this may take a while. This functionality is |
| 52 |
intended to be used as synchronization point for ordering services that require an initialized entropy |
| 53 |
pool to function securely (i.e. services that access <filename>/dev/urandom</filename> without any |
| 54 |
further precautions).</para> |
| 55 |
|
| 56 |
<para>Care should be taken when creating OS images that are replicated to multiple systems: if the random |
| 57 |
seed file is included unmodified each system will initialize its entropy pool with the same data, and |
| 58 |
thus — if otherwise entropy-starved — generate the same or at least guessable random seed streams. As a |
| 59 |
safety precaution crediting entropy is thus disabled by default. It is recommended to remove the random |
| 60 |
seed from OS images intended for replication on multiple systems, in which case it is safe to enable |
| 61 |
entropy crediting, see below. Also see <ulink url="https://systemd.io/BUILDING_IMAGES">Safely Building |
| 62 |
Images</ulink>.</para> |
| 63 |
|
| 64 |
<para>See <ulink url="https://systemd.io/RANDOM_SEEDS">Random Seeds</ulink> for further |
| 65 |
information.</para> |
| 66 |
</refsect1> |
| 67 |
|
| 68 |
<refsect1> |
| 69 |
<title>Environment</title> |
| 70 |
|
| 71 |
<variablelist class='environment-variables'> |
| 72 |
<varlistentry> |
| 73 |
<term><varname>$SYSTEMD_RANDOM_SEED_CREDIT</varname></term> |
| 74 |
<listitem><para>By default, <filename>systemd-random-seed.service</filename> does not credit any |
| 75 |
entropy when loading the random seed. With this option this behaviour may be changed: it either takes |
| 76 |
a boolean parameter or the special string <literal>force</literal>. Defaults to false, in which case |
| 77 |
no entropy is credited. If true, entropy is credited if the random seed file and system state pass |
| 78 |
various superficial concisistency checks. If set to <literal>force</literal> entropy is credited, |
| 79 |
regardless of these checks, as long as the random seed file exists.</para> |
| 80 |
|
| 81 |
<xi:include href="version-info.xml" xpointer="v243"/></listitem> |
| 82 |
</varlistentry> |
| 83 |
</variablelist> |
| 84 |
</refsect1> |
| 85 |
|
| 86 |
<refsect1> |
| 87 |
<title>See Also</title> |
| 88 |
<para><simplelist type="inline"> |
| 89 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 90 |
<member><citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry></member> |
| 91 |
<member><citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 92 |
<member><citerefentry><refentrytitle>systemd-stub</refentrytitle><manvolnum>7</manvolnum></citerefentry></member> |
| 93 |
<member><citerefentry><refentrytitle>bootctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 94 |
<member><citerefentry><refentrytitle>systemd-boot-random-seed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 95 |
</simplelist></para> |
| 96 |
</refsect1> |
| 97 |
|
| 98 |
</refentry> |