1

I installed fwknop-server package on the newly installed Ubuntu 16.04 and tried to start its daemon. The package does not provide systemd unit file and instead uses old init scripts which report as active(exited):

$ service fwknop-server status
● fwknop-server.service - LSB: start and stop fwknopd
   Loaded: loaded (/etc/init.d/fwknop-server; bad; vendor preset: enabled)
   Active: active (exited) since Sat 2016-10-01 18:24:16 CEST; 3s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 32581 ExecStop=/etc/init.d/fwknop-server stop (code=exited, status=0/SUCCESS)
  Process: 32618 ExecStart=/etc/init.d/fwknop-server start (code=exited, status=0/SUCCESS)

Oct 01 18:24:16 fwknop systemd[1]: Starting LSB: start and stop fwknopd...
Oct 01 18:24:16 fwknop systemd[1]: Started LSB: start and stop fwknopd.

$ ps aux | grep fwknop
jakuje   32727  0.0  0.0  14224   928 pts/0    S+   19:11   0:00 grep --color=auto fwknop

Starting or stopping does not change the status nor does start the fwknopd. This is more general question about the "legacy" init.d service, but I accept reasonable answers fitting for the fwknop itself, except starting the fwknop manually.

Edit:
The virtual machine have different network interface than the default expected by fwknop. This can be fixed by modifying /etc/fwknop/fwknop.config with

PCAP_INTF                   ens3;

but still the service is not starting.

4

TL;DR:

Change START_DAEMON="yes" in the file /etc/default/fwknop-server.

Explanation

The package does not provide systemd unit file […]

Debian and Ubuntu do not. The software's authors, however, do:

This can be improved:

[Unit]
Documentation=http://askubuntu.com/a/832231/43344
Description=Firewall Knock Operator Daemon
After=network-online.target

[Service]
RuntimeDirectory=fwknop
RuntimeDirectoryMode=0700
ExecStart=/usr/sbin/fwknopd --foreground
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target

Lennart Poettering wrote in 2011:

Many of the configuration settings in /etc/sysconfig allow disabling services. By this they basically become a second level of enabling/disabling over what the init system already offers: when a service is enabled with systemctl enable or chkconfig on these settings override this, and turn the daemon of[f] even though the init system was configured to start it. This of course is very confusing to the user/administrator, and brings virtually no benefit.

And that is precsisely what the van Smoorenbug rc script in your package is doing:

START_DAEMON="no"
DAEMON_ARGS=""
[ -r /etc/default/fwknop-server ] && . /etc/default/fwknop-server

# Exit if the dameon must not be started
[ "$START_DAEMON" = "yes" ] || exit 0
1
  • Great. Thanks for the links and explanation to my missing knowledge (I do package fwknop in Fedora and we use the upstream systemd unit file which works just fine. Therefore I was confused by the Ubuntu behavior). Can you explain why the RuntimeDirectory should come here? – Jakuje Oct 2 '16 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.