Fun with FreeBSD
Wed 22 March 2023
Do *not* do the following :D
Please scroll down to the **Update** section below, instead
I was watching this video about FreeBSD last night, and the gentleman made mention of a blog which had extra information on FreeBSD. Looking at the blog, I found an excellent article describing how to make the FreeBSD boot process less visually noisy.
The first step they gave is to add the lines:
boot_mute=YES
autoboot_delay=2
to /boot/loader.conf
.
The first line replaces the kernel boot messages with a graphic FreeBSD logo. It's not as pretty, colorful or high-resolution as modern Plymouth
boot images on Linux, but it definitely gets the job done. The second line reduces the automatic boot delay from 10 seconds to 2, which just speeds up the boot process by eliminating the need to manually hit "Enter" to start the boot right away.
The rest of the instructions given entail modifying a handful of init scripts to redirect the output of some verbose commands to /dev/null
.
Now, anyone new to an OS would have some understandable trepidation modifying init scripts right away, but ultimately, a script is a script, and as long as you know what you're doing, there shouldn't be any serious danger that can't be fairly easily undone. However, I didn't like the idea of permanently altering the boot process, so I added my own failsafe:
I touch
ed a file called /etc/.quietboot
, and then I added the following lines to the beginning of the init scripts I changed:
if [ -e /etc/.quietboot ]
then
debugout() {
cat >/dev/null
}
else
debugout() {
cat
}
fi
The code above checks for the presence of the /etc/.quietboot
flag file I just created, and if found, it defines a function debugout()
which simply runs cat >/dev/null
, essentially serving as a pipe terminator to the null device.
If the flag file is not found, the debugout()
function will simply run cat, continuing the pipe to STDOUT
, and not silencing any init messages.
I then went to every line which the blog post recommended have a >/dev/null
added at the end of (in order to eliminate unneeded boot init messages), and added | debugout
instead.
That way, if there's something wrong with the system and I need to verbosely see what the init scripts are doing, I can just comment out the autoboot_delay=2
line from loader.conf
, then delete the /etc/.quietboot
flag file and reboot, and everything will be normal. No need to go hunting through init scripts to remove >/dev/null
from several lines.
Update: Oops, or: "I coulda just read the manpage!"
I found out that I didn't have to modify the init scripts at all. Thanks to "evilham" and vermaden himself, I learned that with two simple lines added to /etc/rc.conf, I could reduce all of the boot messages down to a mere 22 status lines, which easily fits in one screenful. I then undid all of the init script changes (so obviously skip all the steps above about modifying init scripts. The only changes needed for a pretty quite FreeBSD boot are add:
boot_mute=YES
autoboot_delay=2
to /boot/loader.conf
, and add:
rc_info="NO"
rc_startmsgs="NO"
to /etc/rc.conf
.
That's it! You may now safely disregard the rest of this blog post above, which I'm keeping intact for... posterity? Laughing at myself later? :D
#100DaysToOffload - Day 7
Category: Tech Tagged: 100DaysToOffload Computing FOSS (Free and Open Source Software) Linux/Unix Tips BSD FreeBSD Non-religious post