git: e5579f98c02f - main - nanobsd: Avoid read-only file system warnings
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 16 Nov 2024 07:23:45 UTC
The branch main has been updated by jlduran:
URL: https://cgit.FreeBSD.org/src/commit/?id=e5579f98c02ff64b0c305f6731c3557ba69c2d25
commit e5579f98c02ff64b0c305f6731c3557ba69c2d25
Author: Jose Luis Duran <jlduran@FreeBSD.org>
AuthorDate: 2024-11-08 18:13:48 +0000
Commit: Jose Luis Duran <jlduran@FreeBSD.org>
CommitDate: 2024-11-16 06:55:57 +0000
nanobsd: Avoid read-only file system warnings
The default setting of some loader or rc variables generate warnings
because the file system is read-only:
Set the following options to avoid printing these warnings:
/boot/defaults/loader.conf:
- hostuuid_load="NO" to disable loading /etc/hostid early at boot time
- entropy_cache_load="NO" to disable loading cached entropy at boot time
- kern.random.initial_seeding.disable_bypass_warnings="1" to disable
logging a warning if the 'bypass_before_seeding' knob is enabled
(enabled by default) and a request is submitted prior to initial
seeding
/etc/defaults/rc.conf:
- kldxref_enable="NO" to disable building linker.hints files with
kldxref(8)
- entropy_boot_file="NO" to disable very early (used at early boot-time)
entropy caching through reboots
- entropy_dir="NO" to disable caching entropy via cron
While here, move rc.conf options before sourcing vendor.conf, so they
can be overridden.
PR: 277601
Reviewed by: imp
Approved by: emaste (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D47502
---
tools/tools/nanobsd/defaults.sh | 41 +++++++++++++++++++++++++++++++++++------
1 file changed, 35 insertions(+), 6 deletions(-)
diff --git a/tools/tools/nanobsd/defaults.sh b/tools/tools/nanobsd/defaults.sh
index 910ec69865df..0161a8ab8fd3 100755
--- a/tools/tools/nanobsd/defaults.sh
+++ b/tools/tools/nanobsd/defaults.sh
@@ -570,13 +570,42 @@ setup_nanobsd_etc ( ) (
# create diskless marker file
touch etc/diskless
- [ -n "${NANO_NOPRIV_BUILD}" ] && chmod 666 etc/defaults/rc.conf
-
- # Make root filesystem R/O by default
- echo "root_rw_mount=NO" >> etc/defaults/rc.conf
- # Disable entropy file, since / is read-only /var/db/entropy should be enough?
- echo "entropy_file=NO" >> etc/defaults/rc.conf
+ [ -n "${NANO_NOPRIV_BUILD}" ] && chmod 666 boot/defaults/loader.conf
+ {
+ echo
+ echo '### NanoBSD configuration ##################################'
+ echo 'hostuuid_load="NO"'
+ echo 'entropy_cache_load="NO" # Disable loading cached entropy at boot time.'
+ echo 'kern.random.initial_seeding.disable_bypass_warnings="1" # Do not log a warning'
+ echo " # if the 'bypass_before_seeding' knob is enabled"
+ echo " # and a request is submitted prior to initial"
+ echo " # seeding."
+ } >> boot/defaults/loader.conf
+ [ -n "${NANO_NOPRIV_BUILD}" ] && chmod 444 boot/defaults/loader.conf
+ [ -n "${NANO_NOPRIV_BUILD}" ] && chmod 666 etc/defaults/rc.conf
+ if ! ed -s etc/defaults/rc.conf <<\EOF
+/^### Define source_rc_confs, the mechanism used by \/etc\/rc\.\* ##$/i
+### NanoBSD options ########################################
+##############################################################
+
+kldxref_enable="NO" # Disable building linker.hints files with kldxref(8).
+root_rw_mount="NO" # Inhibit remounting root read-write.
+entropy_boot_file="NO" # Disable very early (used at early boot time)
+ # entropy caching through reboots.
+entropy_file="NO" # Disable late (used when going multi-user)
+ # entropy through reboots.
+entropy_dir="NO" # Disable caching entropy via cron.
+
+##############################################################
+.
+w
+q
+EOF
+ then
+ echo "Regular expression pattern not found"
+ exit 2
+ fi
[ -n "${NANO_NOPRIV_BUILD}" ] && chmod 444 etc/defaults/rc.conf
# save config file for scripts