Bug 208445 - /usr/sbin/service: WARNING: $xyz is not set properly - see rc.conf(5).
Summary: /usr/sbin/service: WARNING: $xyz is not set properly - see rc.conf(5).
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.2-RELEASE
Hardware: Any Any
: --- Affects Many People
Assignee: Hiroki Sato
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-04-01 03:11 UTC by mail
Modified: 2020-02-11 07:29 UTC (History)
9 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mail 2016-04-01 03:11:01 UTC
I notice on FreeBSD 10.2-REL (also 10.3-RC2), executing:

service -e

results in the following appended to /var/log/messages:

Mar 13 17:09:57 blizzard ozzmosis: /usr/sbin/service: WARNING: $growfs_enable is not set properly - see rc.conf(5).
Mar 13 17:09:57 blizzard ozzmosis: /usr/sbin/service: WARNING: $ is not set properly - see rc.conf(5).
Mar 13 17:09:57 blizzard ozzmosis: /usr/sbin/service: WARNING: $tcsd_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $mpd_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $poudriered_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $mdnsresponderposix_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $mdnsd_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $dbus_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $avahi_daemon_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $cupsd_enable is not set properly - see rc.conf(5).
Mar 13 17:09:58 blizzard ozzmosis: /usr/sbin/service: WARNING: $avahi_dnsconfd_enable is not set properly - see rc.conf(5).

"$ is not set properly" looks like a bug, but I'm wondering whether these messages are necessary at all?

For example, I don't have growfs_enable set at all in rc.conf, so I'd have thought that /usr/sbin/service would treat this as the same as growfs_enable="NO".

Also, "not set properly" does not have the same meaning as "not set", so at the very least the warning is erroneous.

Thanks.
Comment 1 Jonathan de Boyne Pollard 2016-12-31 07:42:24 UTC
I filed a PC-BSD bug about growfs_enable back in January 2016:

https://bugs.pcbsd.org/issues/12988
Comment 2 Riri 2018-07-03 14:07:43 UTC
Also present in FreeBSD 11.2
Comment 3 DomF 2019-03-09 11:13:43 UTC
Still present in FreeBSD12.0-RELEASE

"$ is not set properly"

... is caused by this in /etc/rc.d/addswap:

rcvar=

and this code in service(8):

                        eval `grep ^rcvar $file`
                        if [ -n "$rcvar" ]; then
                                load_rc_config_var ${name} ${rcvar}
                        fi
                        checkyesno $rcvar 2>/dev/null && echo $file
 
So although service(8) checks whether $rcvar has non-zero length (-n), it still goes on to use it with checkyesno (from /etc/rc.subr) which emits the warning.

Other /etc/rc.d scripts with empty rcvar, like dhclient, have "nostart" in their keywords so are not considered by service(8) thanks to it calling rcorder(8) with "-s nostart"

That's the 'why' but I don't know enough to say whether the fix should be:

1. move checkyesno inside the if-block for service(8)
2. change checkyesno to remove warning if arg (rcvar) is unset/empty
3. add "nostart" keyword /etc/rc.d/addswap
Comment 4 JibJabM 2020-02-06 22:20:46 UTC
FWIW I'm also getting this too in FreeBSD12.1 x64, where a Java app using Tanuki Service Wrapper (FreeBSD version) installs its script at /etc/rc.d/java-App and puts its java-App_enable="YES" in /etc/rc.conf.

running "service java-App start" gets the following:

/etc/rc.conf: java-App_enable=YES: not found
/etc/rc.conf: java-App_enable=YES: not found
eval: java-App_enable=YES: not found
/etc/rc.d/java-App: WARNING: $java-App_enable is not set properly - see rc.conf(5).
Cannot 'status' java-App. Set java-App_enable to YES in /etc/rc.conf or use 'onestatus' instead of 'status'.



When I take away the dashes in the service name, the warning message goes away. 

So may or may not be related, but having dashes in the service name causes the same error message.