Jail, InfluxDB 1.4.2 won't start as demon.

Perm1990

Dabbler
Joined
Feb 25, 2016
Messages
43
Hello.
I running FreeNAS 11.3 stable,
The influxdb 1.4.2 is running in the 10.3-RELEASE jail. Running without problems since years.
Most recently after a power fail - UPS shutdowns the FreeNAS - the influxd just don't start as a service anymore.
I cannot find any reason why.

Any hints? I'm very little expert here.

PS: /var/log/influxdb/influxdb.log last entry is 2 years old even the influxd war sunning until now!

Many thanks in advanced.
 
Last edited:

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Login to your jail (via ssh) and do sh -x /usr/local/etc/rc.d/influxd start as root. The last couple of lines show how influxd is actually started. You can then try and use that isolated command. If you need help with that, copy & paste the last, say, 20 lines here.
 

Perm1990

Dabbler
Joined
Feb 25, 2016
Messages
43
[ -n influxd ]
+ _d=/etc
+ [ -f /etc/rc.conf.d/influxd ]
+ [ -d /etc/rc.conf.d/influxd ]
+ _d=/usr/local/etc
+ [ -f /usr/local/etc/rc.conf.d/influxd ]
+ [ -d /usr/local/etc/rc.conf.d/influxd ]
+ eval '_defval=$influxd_enable_defval'
+ _defval=''
+ [ -n '' ]
+ : YES
+ : influxd
+ : influxd
+ :
+ : daemon
+ : info
+ : /usr/local/etc/influxd.conf
+ : -config=/usr/local/etc/influxd.conf
+ influxd_pidfile=/var/run/influxdb/influxd.pid
+ procname=/usr/local/bin/influxd
+ command=/usr/sbin/daemon
+ start_precmd=influxd_precmd
+ start_cmd=influxd_startcmd_logger
+ run_rc_command start
+ _return=0
+ rc_arg=start
+ [ -z influxd ]
+ shift 1
+ rc_extra_args=''
+ _rc_prefix=''
+ eval '_override_command=$influxd_program'
+ _override_command=''
+ command=/usr/sbin/daemon
+ _keywords='start stop restart rcvar enabled '
+ rc_pid=''
+ _pidcmd=''
+ _procname=/usr/local/bin/influxd
+ [ -n /usr/local/bin/influxd ]
+ [ -n '' ]
+ _pidcmd='rc_pid=$(check_process /usr/local/bin/influxd )'
+ [ -n 'rc_pid=$(check_process /usr/local/bin/influxd )' ]
+ _keywords='start stop restart rcvar enabled status poll'
+ [ -z start ]
+ [ start = enabled ]
+ [ -n '' ]
+ eval 'rc_flags=$influxd_flags'
+ rc_flags=''
+ eval '_chdir=$influxd_chdir' '_chroot=$influxd_chroot' '_nice=$influxd_nice' '_user=$influxd_user' '_group=$influxd_group' '_groups=$influxd_groups' '_fib=$influxd_fib' '_env=$influxd_env' '_prepend=$influxd_prepend'
+ _chdir='' _chroot='' _nice='' _user=influxd _group=influxd _groups='' _fib='' _env='' _prepend=''
+ [ -n influxd ]
+ eval if [ -x /usr/bin/id '];' then /usr/bin/id '-un;' fi
+ [ -x /usr/bin/id ]
+ /usr/bin/id -un
+ [ influxd = root ]
+ [ -z '' ]
+ eval 'rc_pid=$(check_process' /usr/local/bin/influxd ')'
+ check_process /usr/local/bin/influxd
+ _procname=/usr/local/bin/influxd
+ _interpreter=''
+ [ -z /usr/local/bin/influxd ]
+ _find_processes /usr/local/bin/influxd . -ax
+ [ 3 -ne 3 ]
+ _procname=/usr/local/bin/influxd
+ _interpreter=.
+ _psargs=-ax
+ _pref=''
+ [ . != . ]
+ _procnamebn=influxd
+ _fp_args='_arg0 _argv'
+ _fp_match='case "$_arg0" in
$_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")'
+ _proccheck=' /bin/ps -ww 2>/dev/null -o pid= -o jid= -o command= -ax |
while read _npid _jid _arg0 _argv; do
case "$_arg0" in
$_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")
if [ "$JID" -eq "$_jid" ];
then echo -n "$_pref$_npid";
_pref=" ";
fi
;;
esac
done'
+ eval /bin/ps -ww '2>/dev/null' -o pid= -o jid= -o command= -ax '|' while read _npid _jid _arg0 '_argv;' do case '"$_arg0"' in '$_procname|$_procnamebn|${_procnamebn}:|"(${_procnamebn})"|"[${_procnamebn}]")' if [ '"$JID"' -eq '"$_jid"' '];' then echo -n '"$_pref$_npid";' '_pref="' '";' fi ';;' esac done
+ /bin/ps -ww -o pid= -o jid= -o command= -ax
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ read _npid _jid _arg0 _argv
+ rc_pid=''
+ [ start != start ]
+ [ -n influxd_enable -a start != rcvar -a start != stop ]
+ checkyesno influxd_enable
+ eval '_value=$influxd_enable'
+ _value=YES
+ debug 'checkyesno: influxd_enable is set to YES.'
+ return 0
+ [ start = start -a -z '' -a -n '' ]
+ eval '_cmd=$start_cmd' '_precmd=$start_precmd' '_postcmd=$start_postcmd'
+ _cmd=influxd_startcmd_logger _precmd=influxd_precmd _postcmd=''
+ [ -n influxd_startcmd_logger ]
+ _run_rc_precmd
+ check_required_before start
+ local _f
+ return 0
+ [ -n influxd_precmd ]
+ debug 'run_rc_command: start_precmd: influxd_precmd '
+ eval 'influxd_precmd '
+ influxd_precmd
+ install -d -o influxd /var/run/influxdb/
+ _return=0
+ [ 0 -ne 0 ]
+ check_required_after start
+ local _f _args
+ return 0
+ return 0
+ _run_rc_doit 'influxd_startcmd_logger '
+ debug 'run_rc_command: doit: influxd_startcmd_logger '
+ eval 'influxd_startcmd_logger '
+ influxd_startcmd_logger
+ echo 'Starting influxd.'
Starting influxd.
+ /usr/sbin/daemon -c -p /var/run/influxdb/influxd.pid -u influxd /bin/sh -c '/usr/local/bin/influxd -config=/usr/local/etc/influxd.conf 2>&1 | /usr/bin/logger -t influxd -p daemon.info'
+ _return=0
+ [ 0 -ne 0 ]
+ return 0
+ _run_rc_postcmd
+ [ -n '' ]
+ return 0
+ return 0
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
I wrote "the last 20 lines" :wink: There are only two that are relevant, namely
+ /usr/sbin/daemon -c -p /var/run/influxdb/influxd.pid -u influxd /bin/sh -c '/usr/local/bin/influxd -config=/usr/local/etc/influxd.conf 2>&1 | /usr/bin/logger -t influxd -p daemon.info' and the next one.

So it seems to start. At least it logs "everything ok" - that's what + _return=0 means.

What does service influxd status say?

If it does not show the service running, then please try this and post the output:
su -m influxd -c "/usr/local/bin/influxd -config=/usr/local/etc/influxd.conf"
 

Perm1990

Dabbler
Joined
Feb 25, 2016
Messages
43
# service influxd status
influxd is not running.
# service influxd restart
influxd not running?
Starting influxd.
# service influxd status
influxd is not running.


The 'ps aux' does not provide any influx.

# su -m influxd -c "/usr/local/bin/influxd -config=/usr/local/etc/influxd.conf"

8888888 .d888 888 8888888b. 888888b.
888 d88P" 888 888 "Y88b 888 "88b
888 888 888 888 888 888 .88P
888 88888b. 888888 888 888 888 888 888 888 888 8888888K.
888 888 "88b 888 888 888 888 Y8bd8P' 888 888 888 "Y88b
888 888 888 888 888 888 888 X88K 888 888 888 888
888 888 888 888 888 Y88b 888 .d8""8b. 888 .d88P 888 d88P
8888888 888 888 888 888 "Y88888 888 888 8888888P" 8888888P"

2022-02-19T08:25:58Z InfluxDB starting, version 1.4.2, branch unknown, commit unknown
2022-02-19T08:25:58Z Go version go1.9.2, GOMAXPROCS set to 2
2022-02-19T08:25:58Z Using configuration at: /usr/local/etc/influxd.conf
run: parse config: open /usr/local/etc/influxd.conf: permission denied



# ls -la
...
-rw-r--r-- 1 root wheel 14155 Mar 1 2017 influxd.conf
-rw-r--r-- 1 root wheel 15537 Dec 11 2017 influxd.conf.sample
...
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The permissions of one directory somewhere in that path might be wrong. Try ls -ld /usr/local /usr/local/etc
 

Perm1990

Dabbler
Joined
Feb 25, 2016
Messages
43
# ls -ld /usr/local /usr/local/etc
drwxr-xr-x 18 root wheel 20 Nov 1 2016 /usr/local
drwxrwxr-- 20 root wheel 46 Mar 10 2019 /usr/local/etc

PS: many thanks to you to trying to help me.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
Obvious, isn't it?

chmod 755 /usr/local/etc; service influxd start
 

Perm1990

Dabbler
Joined
Feb 25, 2016
Messages
43
Thank you very much! I still cannot explain how could it happen.
But at the end it works again, thanks to you.

:grin:
 

Perm1990

Dabbler
Joined
Feb 25, 2016
Messages
43
I still miss the log file of the influxdb. It suppost to be here /var/log/influxdb but isn't.
I checked the access right to the influxdb log folder - it was wrong in the same way as the config folder.
I corrected the access rights now but still no log file.
 

Patrick M. Hausen

Hall of Famer
Joined
Nov 25, 2013
Messages
7,776
The log directory needs to be writeable by the influxd user, probably.
 
Top