aboutsummarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiachen YANG2020-12-08 16:01:20 +0900
committerJiachen YANG2020-12-08 16:01:20 +0900
commit18eadd836754e5b52b9d2c426fcf8939a41432e1 (patch)
treeb716e548165a69709043ef07ee05f7b259413a1c
parent1e942b920b64da0d1a52526c20215bc8f886649f (diff)
downloadaur-18eadd836754e5b52b9d2c426fcf8939a41432e1.tar.gz
systemd-report-entropy: sync from github
-rw-r--r--.SRCINFO4
-rw-r--r--PKGBUILD4
-rw-r--r--README.md111
-rwxr-xr-xsystemd-report-entropy7
4 files changed, 41 insertions, 85 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 30b232dae0e3..394dc6066873 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = systemd-report-entropy
pkgdesc = report system entropy to journald during boot
- pkgver = 2
+ pkgver = 3
pkgrel = 1
url = http://github.com/farseerfc/systemd-report-entropy
arch = any
@@ -10,7 +10,7 @@ pkgbase = systemd-report-entropy
source = systemd-report-entropy
source = systemd-report-entropy.service
source = LICENSE
- sha512sums = c96c9178f2b8716d75e6a2ff7f4674c2dd0056661000243a66de6c12790ba45123fc4dec7e1fcc7c19fe51578163a5e69b269ce8d4492247e2cc3c064628f178
+ sha512sums = e15412015f32665f24715c099fd658f561a4ef71207e5820e7c0ff6e4f38083d5c593bc72b344d9af0c00998fabc2a734037c74580434a22fde562548f31fcd2
sha512sums = 847444c837ab903e46f9944352a93d76c8663d43fe9960bcf4d8533b2a647d276d870d8963594a26d0a67035499d7d88091af7ed8e6957c67f0679ee8edd3517
sha512sums = 6b75fd3686d5b4ae44c7dae0ede5caf38203bb285242e2abaa6f587f357c11138e969fead87f8362834803cea3b1a488da7bfc952545110d0c9a02cf230d4e48
diff --git a/PKGBUILD b/PKGBUILD
index 32aa835ace3d..bb291b8f7e09 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -1,6 +1,6 @@
# Maintainer: Jiachen Yang <farseerfc@gmail.com>
pkgname=systemd-report-entropy
-pkgver=2
+pkgver=3
pkgrel=1
pkgdesc="report system entropy to journald during boot"
arch=(any)
@@ -11,7 +11,7 @@ source=("$pkgname"
"$pkgname.service"
'LICENSE'
)
-sha512sums=('c96c9178f2b8716d75e6a2ff7f4674c2dd0056661000243a66de6c12790ba45123fc4dec7e1fcc7c19fe51578163a5e69b269ce8d4492247e2cc3c064628f178'
+sha512sums=('e15412015f32665f24715c099fd658f561a4ef71207e5820e7c0ff6e4f38083d5c593bc72b344d9af0c00998fabc2a734037c74580434a22fde562548f31fcd2'
'847444c837ab903e46f9944352a93d76c8663d43fe9960bcf4d8533b2a647d276d870d8963594a26d0a67035499d7d88091af7ed8e6957c67f0679ee8edd3517'
'6b75fd3686d5b4ae44c7dae0ede5caf38203bb285242e2abaa6f587f357c11138e969fead87f8362834803cea3b1a488da7bfc952545110d0c9a02cf230d4e48')
diff --git a/README.md b/README.md
index b5fd7c08870a..491bc6ca1fd9 100644
--- a/README.md
+++ b/README.md
@@ -31,84 +31,39 @@ journalctl -b0 -u systemd-report-entropy.service
## Example output:
```
--- Logs begin at Sat 2020-08-01 09:15:18 JST, end at Fri 2020-11-06 01:40:57 JST. --
-Nov 06 01:40:01 farseerfc-mbp systemd[1]: Started Start to report entropy in journal.
-Nov 06 01:40:01 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:01,821656364+09:00 2256
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[424]: starting
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:02,094607322+09:00 2257
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[467]: starting
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:02,342393182+09:00 2261
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[529]: starting
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:02,624923358+09:00 2265
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[639]: starting
-Nov 06 01:40:02 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:02,888413750+09:00 2269
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[778]: starting
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:03,130162362+09:00 2270
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[797]: starting
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:03,369049032+09:00 2271
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[864]: starting
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:03,611843147+09:00 2272
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[905]: starting
-Nov 06 01:40:03 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:03,851492751+09:00 2273
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[913]: starting
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:04,091936135+09:00 2275
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[1036]: starting
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:04,330146916+09:00 2275
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[1053]: starting
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:04,570204545+09:00 2276
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[1092]: starting
-Nov 06 01:40:04 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:04,817767855+09:00 2277
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[1117]: starting
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:05,058280321+09:00 2277
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[1125]: starting
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:05,297474806+09:00 2278
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[1132]: starting
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:05,538473136+09:00 2279
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[1139]: starting
-Nov 06 01:40:05 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:05,779119853+09:00 2282
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[1146]: starting
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:06,019094053+09:00 2287
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[1153]: starting
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:06,262658068+09:00 2293
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[1160]: starting
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:06,503870376+09:00 2296
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[1167]: starting
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:06,749538576+09:00 2299
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[1175]: starting
-Nov 06 01:40:06 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:06,990995043+09:00 2301
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[1182]: starting
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:07,232147585+09:00 2301
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[1189]: starting
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:07,476427253+09:00 2302
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[1233]: starting
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: ENTROPY 2020-11-06T01:40:07,717667752+09:00 2302
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY is-system-running:
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[1249]: running
-Nov 06 01:40:07 farseerfc-mbp systemd-report-entropy[311]: REPORT ENTROPY systemd boot finished, quit.
+-- Journal begins at Mon 2020-11-30 11:05:02 JST, ends at Mon 2020-12-07 11:32:10 JST. --
+12月 07 11:30:31 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:31,703999577+09:00 ENTROPY 2273 sleeping 227.30000000000000000000 ms
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: is-system-running: initializing
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:32,028432113+09:00 ENTROPY 2278 sleeping 227.80000000000000000000 ms
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: is-system-running: initializing
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:32,275582469+09:00 ENTROPY 2281 sleeping 228.10000000000000000000 ms
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: is-system-running: initializing
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:32,530915564+09:00 ENTROPY 2296 sleeping 229.60000000000000000000 ms
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: is-system-running: initializing
+12月 07 11:30:32 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:32,776745567+09:00 ENTROPY 2306 sleeping 230.60000000000000000000 ms
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: is-system-running: initializing
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:33,019687024+09:00 ENTROPY 2308 sleeping 230.80000000000000000000 ms
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: is-system-running: starting
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:33,262886342+09:00 ENTROPY 2310 sleeping 231.00000000000000000000 ms
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: is-system-running: starting
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:33,506260356+09:00 ENTROPY 2313 sleeping 231.30000000000000000000 ms
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: is-system-running: starting
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: At 2020-12-07T11:30:33,749220139+09:00 ENTROPY 2313 sleeping 231.30000000000000000000 ms
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: is-system-running: running
+12月 07 11:30:33 imacssd systemd-report-entropy[317]: REPORT ENTROPY systemd boot finished, quit.
```
+## What do these outputs all mean?
+
+The service will start before system enters `basic.target` and report time, entropy several times per second.
+
+The output line with `is-system-running` is from `systemctl is-system-running`, which is used to determine the systemd bootup status.
+`initializing` means the system hasn't reach `basic.target`, and is most likely tring to mount local filesystems.
+`starting` is after `basic.target` and before `default.target`, when systemd is starting up system services.
+
+You can co-relate the timestamps, entropy with other systemd units to see at which point the entropy is enough.
+
+To initialize kernel PRNG(Pseudo-Random Number Generator), that is for programs to able to read from `/dev/urandom` or `getrandom`,
+the kernel needs at least 512 bits of entropy. Therefore any value less than 512 indicates that you may want to add entropy sources.
+
diff --git a/systemd-report-entropy b/systemd-report-entropy
index ed5c306d9de8..482d32db03a5 100755
--- a/systemd-report-entropy
+++ b/systemd-report-entropy
@@ -1,12 +1,13 @@
#!/bin/bash
while true; do
entropy=$(cat /proc/sys/kernel/random/entropy_avail)
- echo -n "ENTROPY $(date -Ins) $entropy"
+ echo -n "At $(date -Ins) ENTROPY $entropy"
sleepms=$(echo "$(( $entropy < 100 ? 100 : $entropy )) / 10" | bc -l)
echo -e " sleeping $sleepms ms"
sleep $(echo "$sleepms / 1000" | bc -l)
- echo -n "is-system-running: "
- if systemctl is-system-running; then
+ is_running=$(systemctl is-system-running)
+ echo "is-system-running: $is_running"
+ if [[ $is_running != initializing && $is_running != starting ]]; then
echo "REPORT ENTROPY systemd boot finished, quit."
exit
fi