| 1 |
'\" t |
| 2 |
.TH "SYSTEMD\-BOOT\-RANDOM\-SEED\&.SERVICE" "8" "" "systemd 261~rc3" "systemd-boot-random-seed.service" |
| 3 |
.\" ----------------------------------------------------------------- |
| 4 |
.\" * Define some portability stuff |
| 5 |
.\" ----------------------------------------------------------------- |
| 6 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 7 |
.\" http://bugs.debian.org/507673 |
| 8 |
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html |
| 9 |
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
.ie \n(.g .ds Aq \(aq |
| 11 |
.el .ds Aq ' |
| 12 |
.\" ----------------------------------------------------------------- |
| 13 |
.\" * set default formatting |
| 14 |
.\" ----------------------------------------------------------------- |
| 15 |
.\" disable hyphenation |
| 16 |
.nh |
| 17 |
.\" disable justification (adjust text to left margin only) |
| 18 |
.ad l |
| 19 |
.\" ----------------------------------------------------------------- |
| 20 |
.\" * MAIN CONTENT STARTS HERE * |
| 21 |
.\" ----------------------------------------------------------------- |
| 22 |
.SH "NAME" |
| 23 |
systemd-boot-random-seed.service \- Refresh boot loader random seed at boot |
| 24 |
.SH "SYNOPSIS" |
| 25 |
.PP |
| 26 |
systemd\-boot\-random\-seed\&.service |
| 27 |
.SH "DESCRIPTION" |
| 28 |
.PP |
| 29 |
systemd\-boot\-random\-seed\&.service |
| 30 |
is a system service that automatically refreshes the boot loader random seed stored in the EFI System Partition (ESP), from the Linux kernel entropy pool\&. The boot loader random seed is primarily consumed and updated by |
| 31 |
\fBsystemd-boot\fR(7) |
| 32 |
from the UEFI environment (or |
| 33 |
\fBsystemd-stub\fR(7) |
| 34 |
if the former is not used, but the latter is), and passed as initial RNG seed to the OS\&. It is an effective way to ensure the OS comes up with a random pool that is fully initialized\&. |
| 35 |
.PP |
| 36 |
The service also automatically generates a \*(Aqsystem token\*(Aq to store in an EFI variable in the system\*(Aqs NVRAM\&. The boot loader may then combine the on\-disk random seed and the system token by cryptographic hashing, and pass it to the OS it boots as initialization seed for its entropy pool\&. Note: the random seed stored in the ESP is refreshed on |
| 37 |
\fIevery\fR |
| 38 |
reboot ensuring that multiple subsequent boots will boot with different seeds\&. On the other hand, the system token is generated randomly |
| 39 |
\fIonce\fR, and then persistently stored in the system\*(Aqs EFI variable storage, ensuring the same disk image will not result in the same series of boot loader seed values if used on multiple systems in parallel\&. |
| 40 |
.PP |
| 41 |
The |
| 42 |
systemd\-boot\-random\-seed\&.service |
| 43 |
unit invokes the |
| 44 |
\fBbootctl random\-seed\fR |
| 45 |
command, which updates the random seed in the ESP, and initializes the system token if it is not initialized yet\&. The service is conditionalized so that it is run only when a boot loader is used that implements the |
| 46 |
\m[blue]\fBBoot Loader Interface\fR\m[]\&\s-2\u[1]\d\s+2\&. |
| 47 |
.PP |
| 48 |
For further details see |
| 49 |
\fBbootctl\fR(1), regarding the command this service invokes\&. |
| 50 |
.PP |
| 51 |
Note the relationship between |
| 52 |
systemd\-boot\-random\-seed\&.service |
| 53 |
and |
| 54 |
\fBsystemd-random-seed\fR(8)\&. The former maintains the random seed consumed and updated by the boot environment (i\&.e\&. by |
| 55 |
\fBsystemd-boot\fR(7) |
| 56 |
or |
| 57 |
\fBsystemd-stub\fR(7)), the latter maintains a random seed consumed and updated by the OS itself\&. The former ensures that the OS has a filled entropy pool already during earliest boot when regular disk access is not available yet (i\&.e\&. when the OS random seed cannot be loaded yet)\&. The latter is processed much later, once writable disk access is available\&. Thus it cannot be used to seed the initial boot phase, but typically has much higher quality of entropy\&. Both files are consumed and updated at boot, but at different times\&. Specifically: |
| 58 |
.sp |
| 59 |
.RS 4 |
| 60 |
.ie n \{\ |
| 61 |
\h'-04' 1.\h'+01'\c |
| 62 |
.\} |
| 63 |
.el \{\ |
| 64 |
.sp -1 |
| 65 |
.IP " 1." 4.2 |
| 66 |
.\} |
| 67 |
In UEFI mode, the |
| 68 |
\fBsystemd-boot\fR(7) |
| 69 |
or |
| 70 |
\fBsystemd-stub\fR(7) |
| 71 |
components load the boot loader random seed from the ESP, hash it with available entropy and the system token, and then update it on disk\&. A derived seed is passed to the kernel which writes it to its entropy pool\&. |
| 72 |
.RE |
| 73 |
.sp |
| 74 |
.RS 4 |
| 75 |
.ie n \{\ |
| 76 |
\h'-04' 2.\h'+01'\c |
| 77 |
.\} |
| 78 |
.el \{\ |
| 79 |
.sp -1 |
| 80 |
.IP " 2." 4.2 |
| 81 |
.\} |
| 82 |
In userspace the |
| 83 |
systemd\-random\-seed\&.service |
| 84 |
service loads the OS random seed, writes it to the kernel entropy pool, and then updates it on disk with a new value derived from the kernel entropy pool\&. |
| 85 |
.RE |
| 86 |
.sp |
| 87 |
.RS 4 |
| 88 |
.ie n \{\ |
| 89 |
\h'-04' 3.\h'+01'\c |
| 90 |
.\} |
| 91 |
.el \{\ |
| 92 |
.sp -1 |
| 93 |
.IP " 3." 4.2 |
| 94 |
.\} |
| 95 |
In userspace the |
| 96 |
systemd\-boot\-random\-seed\&.service |
| 97 |
service updates the boot loader random seed with a new value derived from the kernel entropy pool\&. |
| 98 |
.RE |
| 99 |
.PP |
| 100 |
This logic should ensure that the kernel\*(Aqs entropy pool is seeded during earliest bool already, if possible, but the highest quality entropy is propagated back to both on\-disk seeds\&. |
| 101 |
.SH "SEE ALSO" |
| 102 |
.PP |
| 103 |
\fBsystemd\fR(1), \fBrandom\fR(4), \fBbootctl\fR(1), \fBsystemd-boot\fR(7), \fBsystemd-stub\fR(7), \fBsystemd-random-seed.service\fR(8) |
| 104 |
.SH "NOTES" |
| 105 |
.IP " 1." 4 |
| 106 |
Boot Loader Interface |
| 107 |
.RS 4 |
| 108 |
\%https://systemd.io/BOOT_LOADER_INTERFACE |
| 109 |
.RE |