Mysterious warning in logfiles

With 10.2-RELEASE-p12 I have this in my logfiles i.e. /var/log/user.log
Code:
Feb 20 20:31:21 xxx xxx: /usr/sbin/service: WARNING: $ is not set properly - see rc.conf(5).
After the '$' in the warning usually appears the name of a service, but here there is none.
What I found so far is that it is generated when doing # service -e.
I'm not sure if it is a false positive warning.

Can you please check if you have that too?
 
I don't see any /var/log/user.log. When I run service -e I do see such a message in /var/log/messages. After temporarily emptying out /usr/local/etc/rc.d/ I did:
Code:
jrm@phe ~ % uname -rs
FreeBSD 10.2-STABLE
% tail -f /var/log/messages&
<snip>
% service -e > /dev/null
Feb 20 20:24:34 phe jrm: /usr/sbin/service: WARNING: $growfs_enable is not set properly - see rc.conf(5).
Feb 20 20:24:34 phe jrm: /usr/sbin/service: WARNING: $ is not set properly - see rc.conf(5).
I'm guessing there is an errant script in /etc/rc.d/.
 
I had the same messages.
https://mebsd.com/make-build-your-f...-freebsd-ensure-all-services-are-running.html

To remove these warnings you will need to add a valid entry for each service into rc.conf. For example: svnserve_enable=”NO”, assuming it shouldn’t be running.

I tried this, and the messages disappeared.
The warnings themselves are coming from the ‘/usr/sbin/service -e’ command, /usr/sbin/service is a shell script that includes the file /etc/rc.subr for some generic functions. The checkyesno() function is producing the warning. This function will return a relevant exit code based on the value passed to it. If it doesn’t recognize the value or if it’s blank, such as this case, it will log the warning message you are seeing.
 
That makes sense, but I think getopt (and I as well now) is curious about the line for the empty service. My testing shows that the message for the empty service will appear whenever a valid message appears. In other words, if I move /etc/rc.d/growfs out of /etc/rc.d/, no message at all will appear.
 
Last edited by a moderator:
The lonely $ happens when the rc-script has intentionally incomplete variables. addswap, growfs, those oddjobs. There's simply
Code:
if grep -q ^rcvar $file; then
  eval `grep ^name= $file`
  eval `grep ^rcvar $file`
  checkyesno $rcvar 2>/dev/null && echo $file
fi
in /usr/sbin/service. checkyesno logs the error when rcvar is set but empty.

Juha
 
Back
Top