Moving /etc/rc.conf.local to /usr/local/etc/rc.conf

From: Juan Manuel Palacios <jmpalacios_at_gmail.com>
Date: Sat, 06 Jan 2024 19:58:11 UTC
Hi everyone,

I’m new on this mailing list (though not to FreeBSD proper), so apologies if this question has already been beaten to death, but I couldn’t find any discussions on the topic anywhere. I’m happy to be pointed to existing answers if they exist, though.

Basically, my question is if it’s possible to use something like /usr/local/etc/rc.conf to configure stuff like services that should start on system boot, rather than putting that stuff in /etc/rc.conf.local (or /etc/rc.conf, for that matter). And the context of my question is that lately I’ve been looking for ways to simplify my jail management as I move through several of them for multiple reasons (major userland upgrades, major application upgrades, etc.), and one thing I find myself doing more-and-more is extracting all sorts of configuration to mounts, with /urs/local/etc being one of them (and turning the jails themselves more-and-more into disposable units).

So, if I have a configs directory mounted onto jail A’s /usr/local/etc, and at some point I want to upgrade that jail to its successor jail B, moving that same mount to the latter’s /usr/local/etc makes upgrading a breeze. The only problem I have is that this process fails to capture the configurations made in rc.conf(5).

The best technique I’ve come up with so far to remediate this problem is indeed creating a /usr/local/etc/rc.conf file, which I configure to my liking, and then symlink’ing /etc/rc.conf.local to it. But, other than having to remember to create the symlink in the new jail, I keep thinking that there must be a better way that’d keep my local configurations fully out of /etc.

So, is there a reason why rc(8) supporting (or me “forcing” it to support via my symlink) a /usr/local/etc/rc.conf file would be a bad idea? Or would this be a worthy enhancement to rc(8)?

Thank you in advance for any help!