Skip to content

Instantly share code, notes, and snippets.

@lparkes
Created March 2, 2023 19:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lparkes/b082088e36c06c6dc0b27309431cf1bf to your computer and use it in GitHub Desktop.
Save lparkes/b082088e36c06c6dc0b27309431cf1bf to your computer and use it in GitHub Desktop.
Enhancement to NetBSD /etc/rc.d/entropy
diff -r 093934994b6c etc/rc.d/entropy
--- a/etc/rc.d/entropy Wed Feb 08 18:28:10 2023 +0000
+++ b/etc/rc.d/entropy Fri Mar 03 08:39:40 2023 +1300
@@ -16,7 +16,11 @@
entropy_start()
{
case ${entropy-} in
- '') ;;
+ '') if [ $(sysctl -n kern.entropy.needed) -gt 0 ]
+ then
+ err 1 "not enough entropy available, see entropy(7)"
+ fi
+ ;;
check) echo -n "Checking for entropy..."
# dd will print an error message `Resource temporarily
# unavailable' to stderr, which is a little annoying,
diff -r 093934994b6c share/man/man7/entropy.7
--- a/share/man/man7/entropy.7 Wed Feb 08 18:28:10 2023 +0000
+++ b/share/man/man7/entropy.7 Fri Mar 03 08:39:40 2023 +1300
@@ -135,6 +135,16 @@
.Nx
will wait for entropy before booting to multiuser (with the caveat that
it may cause boot to hang forever).
+.It
+If
+.Sq Li entropy
+is not set in
+.Xr rc.conf 5
+and the system doesn't have enough entropy, then
+.Pa /etc/rc.d/entropy
+will exit with an error message on the console and in
+.Pa /var/run/rc.log
+without interrupting multiuser boot.
.El
.Pp
Since it is difficult to confidently model the unpredictability of most
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment