Will the gods finally send help? Trying to figure out custom FreeBSD ārc.d servicesā has stumped me.
Hereās the setup:
- TrueNAS Core 13.3
- Jail based on FreeBSD 13.3
The application in question, which works 100% if I run it manually:
- slskd [1]
This works 100% (web UI, connecting to the Soulseek network, searching, downloading, etc):
su soulseek -c "/opt/slskd/slskd --app-dir=/home/soulseek/.local/share/slskd"
As you would expect, it runs the executable /opt/slskd/slskd
as the user soulseek
, with the flag --app-dir
correctly pointing to /home/soulseek/.local/share/slskd
. It properly reads my settings from the configuration file slskd.yml
.
By all accounts, the software ājust worksā.
So, like with my other jails, I want to this to automatically start with the jail as a āserviceā.
I borrowed a similar packageās ārc.dā config (amuled
), and modified it for slskd
. I figured nothing fancy is involved, and so it should work pretty much the same.
/usr/local/etc/rc.d/slskd
#!/bin/sh
# PROVIDE: slskd
# REQUIRE: NETWORKING
# BEFORE: DAEMON
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf to enable slskd at startup
# slskd_enable (bool): Set to "NO" by default.
# Set it to "YES" to enable slskd
# slskd_user (str): Set to user running slskd
# (default 'soulseek')
. /etc/rc.subr
name="slskd"
rcvar=slskd_enable
load_rc_config $name
: ${slskd_enable="NO"}
: ${slskd_user:="soulseek"}
: ${slskd_config:="/home/${slskd_user}/.local/share/slskd"}
pidfile="${slskd_config}/slskd.pid"
procname="/opt/slskd/slskd"
required_files="${slskd_config}/slskd.yml"
command="/usr/sbin/daemon"
command_args="-f -p ${pidfile} ${procname} --app-dir=${slskd_config}"
run_rc_command "$1"
Here is my rc.conf
file (which is pretty plain):
/etc/rc.conf
cron_flags="$cron_flags -J 15"
# Disable Sendmail by default
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
# Run secure syslog
syslogd_flags="-c -ss"
ifconfig_epair0b="SYNCDHCP"
# Soulseek
slskd_enable="YES"
slskd_user="soulseek"
The result?
The service starts!
I am able to login to the web UI on the default port 5030!
The web UI is fully functional!
All my settings (slskd.yml
) are loaded properly!
The process is owned by the user soulseek
!
So whatās the problem?
It cannot connect to the outside world. The log reveals this error:
āFailed to resolve address āvps.slsknet.orgā: Name does not resolveā
Now thatās interesting because:
- As the user
soulseek
, I can absolutely ping vps.slsknet.org - When I run the application (
slskd
) manually, it has no issues connecting to the Soulseek network.
For some reason, running it as a service/daemon blocks its access to the outside internet.
Just to reiterate and to repeat this again: Everything works when it starts as a service, except for outside connectivity.
As you can see, Iām stumped. Any and all help would be greatly appreciated.
slskd is a dotNET application that serves as a web UI frontend for the Soulseek P2P network. It is supported on Linux by its upstream developers, however, FreeBSD āsupportā is quite new, and requires building it yourself. (Needless to say, it works 100% if I manually invoke the command
slskd
) ā©ļø