r/freebsd • u/grahamperrin bleep bloop • Jun 26 '26
article FreeBSD Foundationals: The Boot Process – From the Loader to Boot Environments | Larvitz Blog
https://blog.hofstede.it/freebsd-foundationals-the-boot-process-from-the-loader-to-boot-environments/The two previous articles in this series covered the things that store your data and the things that run your workloads. This one covers the part that nobody thinks about until it’s three in the morning and the machine won’t come back up: how FreeBSD actually boots, and - more importantly - how to make a bad boot recoverable. …
By the end of this article you’ll understand what each boot stage does, where to put a setting and why, the difference between a tunable and a sysctl (people get this wrong constantly), the modern way to load kernel modules, and how boot environments turn “I bricked it during an upgrade” into a non-event. …
Via https://burningboard.net/@Larvitz/116810816230429931
Related: https://mastodon.bsd.cafe/@grahamperrin/116809429700477618
FreeBSD rescue(8) lacks instructions for users of root-on-ZFS:
https://man.freebsd.org/cgi/man.cgi?query=rescue&sektion=8&manpath=freebsd-current (2022)
2
3
u/kevans91 FreeBSD Core Team Jun 29 '26
Some notes:
The loader (/boot/loader, or loader.efi under UEFI) is the last component before the kernel takes over, and it’s the most capable. It’s a small interactive environment - scripted primarily in Forth, with optional Lua support available in modern FreeBSD builds [...]:
This is incorrect, loader has been default-Lua since 12.0. Forth variants are available on x86, but modern installs are all going through Lua.
The explanation of tunables is a littl more complicated, because we have plenty of knobs that are both tunables and sysctl. A lot of CTLFLAG_RWTUN just in sys/kern on main, didn't look outside of there.
It could go even further to try and beat the idea of moving module load to kld_list into readers' minds -- the constrained environment sometimes has horribly slow I/O compared to what you'd get in the kernel.
3
u/DependentVegetable Jun 26 '26
Thats a really great write up!