This page looks best with JavaScript enabled

Configuration file management in FreeBSD

 ·  🎃 kr0m

FreeBSD manages default configuration parameters in a very intelligent (KISS) way, through a special directory called defaults we can overwrite only the parameters that suit us without altering the rest and without generating problems in future updates.

All default system configuration files are located under the defaults directory. FreeBSD applies the default configuration and overwrites any parameter that we have explicitly indicated. In addition, default configuration files are a good way to visualize all possible options for a particular software.

For example, the boot loader would present the following structure:

- /boot/defaults/loader.conf: Default file with system configuration.
- /boot/loader.conf: Custom configuration file.

Updates to the OS will only modify the default configuration files, leaving custom parameters intact. This way, our adjustments will endure over time.

FreeBSD adds functionality in each version, but we will always have guaranteed backward compatibility. This way, we will not have to worry about updating incompatible configurations or incorrect parameters, we will only consult the default file in case there is any new parameter or functionality that is useful to us and enable it if we wish.

A very common mistake is to copy default files to overwrite custom files and modify the necessary parameters. This can cause problems in certain parts of the system. In some cases, there will be no problem, but in others, there will be. Therefore, such a practice should never be followed. For example, if we copy /etc/defaults/rc.conf to /etc/rc.conf, the system will NOT boot.

If you liked the article, you can treat me to a RedBull here