pihole-FTL.service (About Failed to restart)

Many people (including me ^^), have problems with the FTL service (after a reboot and / or update).

Host: MXServeur Kernel: 4.16.12-xanmod11 x86_64 bits: 64 Desktop: Xfce 4.12.3
Distro: MX-17.1_x64 Horizon March 14, 2018 (Debian based, cooperative venture between the antiX and former MEPIS)
Machine Type: Desktop Mobo: ASUSTeK model: Z10PE-D16 WS v: Rev 1.xx
CPU: 2x 6-Core model: Intel Xeon E5-2603 v3 bits: 64 type: MCP SMP

pihole -v

Pi-hole version is v3.3.1 (Latest: v3.3.1)
AdminLTE version is v3.3 (Latest: v3.3)
FTL version is v3.0 (Latest: v3.0)

whereis pihole-FTL

pihole-FTL: /usr/bin/pihole-FTL

locate pihole-FTL

/etc/.pihole/advanced/pihole-FTL.service
/etc/init.d/pihole-FTL
/etc/pihole/pihole-FTL.conf
/etc/pihole/pihole-FTL.db
/usr/bin/pihole-FTL
/var/log/pihole-FTL.log
/var/log/pihole-FTL.log.1
/var/log/pihole-FTL.log.2.gz
/var/log/pihole-FTL.log.3.gz

ls -l /usr/bin/pihole-FTL

-rwxr-xr-x 1 root root 1533731 juin 5 19:33 /usr/bin/pihole-FTL

The problem disappears at home after changing the rights on /var/log/pihole-FTL.log

pihole-FTL test

FATAL: Opening of FTL log (/var/log/pihole-FTL.log) failed!
Make sure it exists and is writeable by user kmz

sudo chmod 0755 /var/log/pihole-FTL.log
pihole-FTL test

FATAL: Opening of FTL log (/var/log/pihole-FTL.log) failed!
Make sure it exists and is writeable by user kmz

sudo chmod 0777 /var/log/pihole-FTL.log

pihole-FTL test
FTL started!

Could you, please, make the change in /etc/init.d/pihole-FTL

I did it manually, but as soon as an update, or a change of version takes place, ... badaboum, broken again

Is pihole the owner of your pihole-FTL.log?

This is my pihole-FTL.log

-rw-r--r-- 1 pihole pihole 6.8K Jun 5 18:46 /var/log/pihole-FTL.log

Yeah, it should be 644 not 7 anything.

yes, it is.
ls -l /var/log/pihole-FTL.log

-rwxrwxrwx 1 pihole pihole 114849 juin 5 20:52 /var/log/pihole-FTL.log

Right, and what about:
sudo chmod 0666 /var/log/pihole-FTL.log
(for the log 'only')

ls -l /var/log/pihole-FTL.log

-rw-rw-rw- 1 pihole pihole 119126 juin 5 21:36 /var/log/pihole-FTL.log

pihole-FTL test

FTL started!

Or simply:
sudo chmod 0646 /var/log/pihole-FTL.log

ls -l /var/log/pihole-FTL.log

-rw-r--rw- 1 pihole pihole 130878 juin 5 21:48 /var/log/pihole-FTL.log

pihole-FTL test

FTL started!

another small remark (as long as we are in the service):
sudo service pihole-FTL restart

stopped
rm: can not delete '/var/run/pihole/FTL.sock': No file or folder of this type
FTL started!

Remove the alert by putting rm -f in front of /var/run/pihole/FTL.sock in /etc/init.d/pihole-FTL

644 would work fine, there's no need for Others/World to write to that file.

Ok, so explain this to me:

pihole-FTL test
FATAL: Opening of FTL log (/var/log/pihole-FTL.log) failed!
Make sure it exists and is writeable by user kmz

If it works so well, then why can not I run FTL-pihole

What user account is the pihole-FTL daemon running under? sudo cat /etc/init.d/pihole-FTL

pihole-FTL is a priv'd command, you need to run it as sudo pihole-FTL test if you want to test it as your regular user.

ls -l /etc/init.d/pihole-FTL

-rwxr-xr-x 1 root root 1799 juin 6 00:10 /etc/init.d/pihole-FTL

sudo cat /etc/init.d/pihole-FTL

!/bin/bash
BEGIN INIT INFO
Provides: pihole-FTL
Required-Start: $remote_fs $syslog
Required-Stop: $remote_fs $syslog
Default-Start: 2 3 4 5
Default-Stop: 0 1 6
Short-Description: pihole-FTL daemon
Description: Enable service provided by pihole-FTL daemon
END INIT INFO

FTLUSER=pihole
PIDFILE=/var/run/pihole-FTL.pid

get_pid() {
pidof "pihole-FTL"
}

is_running() {
ps "$(get_pid)" > /dev/null 2>&1
}

#Start the service
start() {
if is_running; then
echo "pihole-FTL is already running"
else
touch /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
mkdir -p /var/run/pihole
mkdir -p /var/log/pihole
chown pihole:pihole /var/run/pihole /var/log/pihole
rm -f /var/run/pihole/FTL.sock
chown pihole:pihole /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /etc/pihole
chmod 0644 /var/log/pihole-FTL.log /run/pihole-FTL.pid /run/pihole-FTL.port /var/log/pihole.log
su -s /bin/sh -c "/usr/bin/pihole-FTL" "$FTLUSER"
echo
fi
}

#Stop the service
stop() {
if is_running; then
kill "$(get_pid)"
for i in {1..5}; do
if ! is_running; then
break
fi

  echo -n "."
  sleep 1
done
echo

if is_running; then
  echo "Not stopped; may still be shutting down or shutdown may have failed, killing now"
  kill -9 "$(get_pid)"
  exit 1
else
  echo "Stopped"
fi

else
echo "Not running"
fi
echo
}

case "$1" in
stop)
stop
;;
status)
status pihole-FTL
;;
start|restart|reload|condrestart)
stop
start
;;
*)
echo $"Usage: $0 {start|stop|restart|reload|status}"
exit 1
esac

exit 0

FTL must be run as the pihole user

This is why your pihole-FTL test commands are not working as you expect. You should normally only run FTL through the service commands. If you want to run it with --test, run it as:

sudo -u pihole pihole-FTL --test
1 Like

After much research and testing, I do not really know why or how, but FTL-pihole was simply no longer in startup services.
(In fact I wanted to test the 'dev' version and then I'm back to the 'master')

So I did:
sudo update-rc.d pihole-FTL defaults
sudo update-rc.d pihole-FTL enable

Several successive starts without failures.

Problem solved, Thanks for your help.

1 Like

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.