diff options
author | Jiachen Yang | 2020-11-06 01:52:05 +0900 |
---|---|---|
committer | Jiachen Yang | 2020-11-06 01:52:05 +0900 |
commit | b259bd0a6c90c9ef4072efe27fcc0c12c1249342 (patch) | |
tree | 66b3238c279dff41f3925131d1588063b28d9ca3 | |
download | aur-b259bd0a6c90c9ef4072efe27fcc0c12c1249342.tar.gz |
addpkg systemd-report-entropy
-rw-r--r-- | .SRCINFO | 15 | ||||
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | LICENSE | 29 | ||||
-rw-r--r-- | PKGBUILD | 22 | ||||
-rw-r--r-- | README.md | 114 | ||||
-rwxr-xr-x | systemd-report-entropy | 11 | ||||
-rw-r--r-- | systemd-report-entropy.service | 11 |
7 files changed, 205 insertions, 0 deletions
diff --git a/.SRCINFO b/.SRCINFO new file mode 100644 index 000000000000..bb450c4a5ca3 --- /dev/null +++ b/.SRCINFO @@ -0,0 +1,15 @@ +pkgbase = systemd-report-entropy + pkgdesc = help to diagnose shutdown sequence for systemd + pkgver = 1 + pkgrel = 1 + url = http://github.com/farseerfc/systemd-report-entropy + arch = any + license = custom:BSD + source = systemd-report-entropy + source = systemd-report-entropy.service + source = LICENSE + sha512sums = 9b344e44bdd3eef9f1f07fe69f9d8a1c6248f942f71a239e0a46290ac9d915da0c11c023477a5fc51b84e39436e1cb01874e3806396bbfaf83c1417a056eb371 + sha512sums = 8c5be83a650cac8bb969091e586627cf24bbd1dc92011529541f244a589981d3e7b0973606e4af087f46034043a01f37c7cd4062fb8b5d00fc685ed0780848ad + sha512sums = 6b75fd3686d5b4ae44c7dae0ede5caf38203bb285242e2abaa6f587f357c11138e969fead87f8362834803cea3b1a488da7bfc952545110d0c9a02cf230d4e48 + +pkgname = systemd-report-entropy diff --git a/.gitignore b/.gitignore new file mode 100644 index 000000000000..b32f0f035cf3 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +pkg/ +src/ +*.pkg.tar.zst diff --git a/LICENSE b/LICENSE new file mode 100644 index 000000000000..0f52cfbce423 --- /dev/null +++ b/LICENSE @@ -0,0 +1,29 @@ +BSD 3-Clause License + +Copyright (c) 2020, Jiachen Yang +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 000000000000..ea2950b1dd71 --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,22 @@ +# Maintainer: Jiachen Yang <farseerfc@gmail.com> +pkgname=systemd-report-entropy +pkgver=1 +pkgrel=1 +pkgdesc="help to diagnose shutdown sequence for systemd" +arch=(any) +url="http://github.com/farseerfc/systemd-report-entropy" +license=('custom:BSD') +depends=() +source=("$pkgname" + "$pkgname.service" + 'LICENSE' +) +sha512sums=('9b344e44bdd3eef9f1f07fe69f9d8a1c6248f942f71a239e0a46290ac9d915da0c11c023477a5fc51b84e39436e1cb01874e3806396bbfaf83c1417a056eb371' + '8c5be83a650cac8bb969091e586627cf24bbd1dc92011529541f244a589981d3e7b0973606e4af087f46034043a01f37c7cd4062fb8b5d00fc685ed0780848ad' + '6b75fd3686d5b4ae44c7dae0ede5caf38203bb285242e2abaa6f587f357c11138e969fead87f8362834803cea3b1a488da7bfc952545110d0c9a02cf230d4e48') + +package() { + install -Dm755 $pkgname "$pkgdir/usr/bin/$pkgname" + install -Dm644 $pkgname.service "$pkgdir/usr/lib/systemd/system/$pkgname.service" + install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" +} diff --git a/README.md b/README.md new file mode 100644 index 000000000000..c4c79a2eef3e --- /dev/null +++ b/README.md @@ -0,0 +1,114 @@ +# systemd-report-entropy +some helper to diagnose early boot entropy + +## Why ? +Because it is hard to check available entropy during system boot, +and lack of entropy can cause delay in system boot process. + +## How ? +Just start a systemd service early enough to report available entropy +to the journal, until systemd finished its booting. + +## Ok, how to use it + +1. Build and install the package +```bash +makepkg -si +``` + +2. Enable the service +```bash +sudo systemctl enable systemd-report-entropy.service +``` + +3. reboot + +4. check entropy report +```bash +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. +``` + + diff --git a/systemd-report-entropy b/systemd-report-entropy new file mode 100755 index 000000000000..27feefe32c63 --- /dev/null +++ b/systemd-report-entropy @@ -0,0 +1,11 @@ +#!/bin/bash +while true; do + entropy=$(cat /proc/sys/kernel/random/entropy_avail) + echo "ENTROPY $(date -Ins) $entropy" + sleep $(echo "$entropy / 10000" | bc -l) + echo -n "REPORT ENTROPY is-system-running: " + if systemctl is-system-running; then + echo "REPORT ENTROPY systemd boot finished, quit." + exit + fi +done diff --git a/systemd-report-entropy.service b/systemd-report-entropy.service new file mode 100644 index 000000000000..5c9e11aeb093 --- /dev/null +++ b/systemd-report-entropy.service @@ -0,0 +1,11 @@ +[Unit] +Description=Start to report entropy in journal +Before=default.target + +[Service] +Type=simple +ExecStart=/usr/bin/systemd-report-entropy +RemainAfterExit=yes + +[Install] +WantedBy=local-fs.target |