Solved sysrc on /boot/loader.conf - good or bad idea? -> BAD IDEA (currently)

Observing that loader.conf has the same syntax as the rc.conf file(s), it looks like a good idea.
Observing that sysrc does not know about the variables in loader.conf (no descriptions etc.), it looks like a bad idea.

I just want to set and/or remove values, so it looks like the "good idea" aspect prevails - but am I overlooking something and it's still a bad idea?
 
You can use sysrc against /boot/loader.conf using the -f flag. There's an example in the man page of sysrc being used against the /etc/crontab file.
 
Right, "-f /boot/loader.conf" is what I'm using.
Question is: What are the caveats? E.g. descriptions don't seem to exist, e.g. "sysrc -f /boot/loader.conf -d kern.vty" complains about a syntax error, "sysrc -f /boot/loader.conf" -d zfs_load" gives me an empty text.

Actually sysrc -f /boot/loader.conf -d kern.vty="sc" does not work, the error messages is the frustratingly vague sysrc: kern.vty: name contains characters not allowed in shell (what character? for what use? in what shell?) but I guess that's just the way it is; I'd rather like to know whether this is a basic problem and the idea was bad, or whether I'm just overlooking how to really do it any the idea was good after all.
 
Doesn't give a solution, but someone else running into a similar issue.

As you can see in this bug report, some people consider it to not be the right tool.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=187461

Note that is from 2014 and they were talking about a new tool, sysconf. That doesn't seem to exist but I do see devel/sysconftool
 
E.g. descriptions don't seem to exist, e.g. "sysrc -f /boot/loader.conf -d kern.vty" complains about a syntax error
I'm not in front of a FreeBSD box to check, but the man page for sysrc() states:

Code:
The list of system    configuration files is configured in the file
     `/etc/defaults/rc.conf' within the    variable `rc_conf_files', which    by-de-
     fault contains a space-separated list of pathnames.  On all FreeBSD sys-
     tems, this    defaults to the    value "/etc/rc.conf /etc/rc.conf.local".  Each
     pathname is sourced in-order upon startup.     It is in the same fashion
     that sysrc    sources    the configuration files    before returning the value of
     the given variable.

And the only example I can find that uses the -d option is this:

sysrc -d timed_enable

which returns timed_enable: Run the time daemon (or NO).

So, sysrc does not need the -f option to find the description for a variable, which means that it's probably using a default list of files. So, you may need to add /boot/loader.conf to the list of pathnames for sysrc to check for a description. However, this is just a guess on my part. If you get this to work please let us know. Thanks.
 
Last edited by a moderator:
Well, given that I can't make kern.vty work with sysrc, I'm just giving up - nothing to be gained here.
Conclusion: BAD IDEA.
 
Back
Top