aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Maste <emaste@FreeBSD.org>2025-06-19 19:48:14 +0000
committerEd Maste <emaste@FreeBSD.org>2025-07-30 18:06:38 +0000
commit525795cde28bbbc0aba3e5f359dfc877b9f248d1 (patch)
tree0574d70348677f4b4b4d058c59d733b49fd6dae2
parent185bd9cf219999a38093e853bfda8ed1ca21fc5b (diff)
bsdinstall: Emit a warning if the system has too little memory
PR: 251993 Reviewed by: adrian Event: Kitchener-Waterloo Hackathon 202506 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50944 (cherry picked from commit eb5884c564ae0e37df1d8a3fc5704ab6b2fa07d0)
-rwxr-xr-xusr.sbin/bsdinstall/scripts/auto8
1 files changed, 8 insertions, 0 deletions
diff --git a/usr.sbin/bsdinstall/scripts/auto b/usr.sbin/bsdinstall/scripts/auto
index ab0191feea17..5375b73e57d4 100755
--- a/usr.sbin/bsdinstall/scripts/auto
+++ b/usr.sbin/bsdinstall/scripts/auto
@@ -178,6 +178,14 @@ environment_save
rm -rf $BSDINSTALL_TMPETC
mkdir $BSDINSTALL_TMPETC
+# With pkgbase, pkg OOM has been observed with QEMU-default 128 MiB memory size.
+# Ensure we have at least about 256 MiB (with an allowance for rounding etc.).
+physmem=$(($(sysctl -n hw.physmem) / 1048576))
+if [ $physmem -lt 200 ]; then
+ bsddialog --backtitle "$OSNAME Installer" --title "Warning" \
+ --msgbox "Insufficient physical memory (${physmem} MiB) detected. At least 256 MiB is recommended. The installer or installed system may not function correctly." 0 0
+fi
+
[ -f /usr/libexec/bsdinstall/local.pre-everything ] && f_dprintf "Running local.pre-everything" && sh /usr/libexec/bsdinstall/local.pre-everything "$BSDINSTALL_CHROOT"
trap true SIGINT # This section is optional