Local rc.d scripts in /usr/local/etc/rc.d not callable from "service"-command

Hi,

I just updated a jail from 13.1 to 14.0. My problem now is that services installed from packages that puts rc.d-scripts in /usr/local/etc/rc.d is not callable from the service-command. However, they work if being called directly like this:
/usr/local/etc/rc.d/tomcat9 start


# service tomcat9 status
tomcat9 does not exist in /etc/rc.d or the local startup
directories (YES), or is not executable

It is enabled in /etc/rc.conf

And config looks good:

# grep -ri "/usr/local/etc/rc.d" /etc/*
/etc/defaults/rc.conf:local_startup="/usr/local/etc/rc.d" # startup script dirs.


What could be wrong?
 
Code:
# service tomcat9 status
tomcat9 does not exist in /etc/rc.d or the local startup
directories (YES), or is not executable

The error message is odd, it prints "YES" when it should be printing /usr/local/etc/rc.d/ there.

Code:
# If the script was not found
echo "$script does not exist in /etc/rc.d or the local startup"
echo "directories (${local_startup}), or is not executable"
exit 1
 
The error message is odd, it prints "YES" when it should be printing /usr/local/etc/rc.d/ there.
I had a typo in rc.conf (version of tomcat had changed from 85 to 9 tomcat85_enable="YES"). This is now fixed. But the problem still remains but the error message is now:
Code:
# service tomcat9 start
tomcat9 does not exist in /etc/rc.d or the local startup
directories (/etc/rc.d), or is not executable

grep local_startup /etc/rc.conf
No hits:
Code:
# grep local_startup /etc/rc.conf
#
 
Code:
# service tomcat9 start 
tomcat9 does not exist in /etc/rc.d or the local startup 
directories (/etc/rc.d), or is not executable
Some progress I guess. Looks like $_localbase is empty:
Code:
local_startup="${_localbase}/etc/rc.d" # startup script dirs.

That gets set at the top:
Code:
# Set default value of _localbase if not previously set
: ${_localbase:="/usr/local"}
So, you have defined _localbase somewhere, with an empty string in it.

Can you post the whole /etc/rc.conf?
 
Can you post the whole /etc/rc.conf?


hostname="subsonic"

cron_flags=" -J 15"

subsonic_enable="YES"
subsonic_http_port="4040"
subsonic_https_port="4043"
subsonic_port="4040"
subsonic_context_path="/subsonic"
subsonic_ssl="NO"
subsonic_music_folder=/zstorage/media
subsonic_max_memory=512
#jetty_flags="-Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -Xms96m -Xmx512m -Djava.awt.headless=true"



# Disable Sendmail by default
sendmail_enable="NONE"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

# Run secure syslog
syslogd_flags="-c -ss"

# Enable IPv6
ipv6_activate_all_interfaces="NO"

sshd_enable="YES"
tomcat9_enable="YES"
tomcat9_env="LANG=en_US.UTF-8 TZ=Europe/Stockholm"


So, you have defined _localbase somewhere, with an empty string in it.
Thanks a ton! This pointed me in the right direction! Turned out that I must have screwed up /etc/defaults/rc.conf when freebsd-update ran merge on /etc. I fixed it by copying /etc/default/* from another system of the same FreeBSD-version.
 
Never edit /etc/defaults/rc.conf. If you think freebsd-update managed to hose it you might want to open a PR.
So I upgraded an iocage-jail from 13.1->14.0 -- and for some reason freebsd-upgrade had me to manually merge all (or at least most) files in /etc. Mostly it was that it couldn't merge the header of the files or updated commented lines. But for some files there were actually changes but as it was so many files there is a high likelihood that I somewhere lost my sharpness and made mistakes when it came to which files I kept and which I removed. For /etc/defaults/rc.conf there were none of my changes in it from the beginning -- it was just more default lines added that freebsd-update couldn't handle automatically it seems -- and then when I had ot maually merge it I obviously screwed up.

But I am not sure how I can reproduce this potential bug when it comes to freebsd-update not being able to automatically handle uncommented lines? Would it be worth to open a PR also then?

Then I have a general question about updating -- if I understand the handbook correctly then etcupdate is only used when updating from source -- is there any way to use it also when not updating from source? The reason I am askin is that 10 years ago when I were running Gentoo Linux I remember that over there it as possible to configure it in a way that it would automatically update all non-edited /etc-files. What is the best practice for doing this in jails in FreeBSD?
 
Back
Top