Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 688820 - app-admin/sshguard-2.4.0 - /etc/init.d/sshguard fails to start
Summary: app-admin/sshguard-2.4.0 - /etc/init.d/sshguard fails to start
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Netmon project
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-27 13:44 UTC by max
Modified: 2019-08-08 07:14 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
sshguard openrc script (sshguard,392 bytes, text/plain)
2019-06-27 13:44 UTC, max
Details

Note You need to log in before you can comment on or make changes to this bug.
Description max 2019-06-27 13:44:02 UTC
Created attachment 581150 [details]
sshguard openrc script

As of commit 32a4676599a900a7a072f66303d9c48b22d1107c in sshguard, the included openrc init script is broken. This is because `command_background=1` will cause the pidfile to be created (adds `--make-pidfile` to arguments), which will then of course fail the `-z $PIDFILE` check in sshguard.

Attached a fixed openrc script.
Comment 1 max 2019-06-27 13:51:35 UTC
That should say `-e $PIDFILE`, not -z, since it checks whether a file in that path exists of course.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2019-06-28 09:51:26 UTC
Comment on attachment 581150 [details]
sshguard openrc script

--- files/sshguard.initd-r1     2018-11-18 11:31:03.091649090 +0100
+++ -   2019-06-28 11:46:12.665458675 +0200
@@ -5,8 +5,7 @@
 command="/usr/sbin/sshguard"
 pidfile="${SSHGUARD_PIDFILE:-/var/run/${SVCNAME}.pid}"
 command_args="-i \"${pidfile}\" ${SSHGUARD_OPTS}"
-command_background=1
-start_stop_daemon_args="--wait ${SSHGUARD_WAIT:-999} --interpreted --quiet"
+start_stop_daemon_args="--background --wait ${SSHGUARD_WAIT:-999} --interpreted --quiet"

 depend() {
        after iptables


Looks like that fixes the `/etc/init.d/sshguard start` and  `/etc/init.d/sshguard stop` cases, but `/etc/init.d/sshguard restart` will fail. Maybe it's not waiting long enough?

# /etc/init.d/sshguard --nodeps restart
 * Starting sshguard ...
 * start-stop-daemon: /usr/sbin/sshguard is already running
 * Failed to start sshguard                                                                                                                              [ !! ]
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2019-06-28 09:54:21 UTC
When I set a higher SSHGUARD_WAIT (like 9999 milliseconds) the `restart` case succeeds.
Comment 4 max 2019-06-28 19:23:05 UTC
This did not seem necessary in my testing, the service restarted fine with the current default wait time.
Comment 5 Larry the Git Cow gentoo-dev 2019-08-08 07:14:08 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=dc154eaae27ee058f7c6153df327bd46a540ce50

commit dc154eaae27ee058f7c6153df327bd46a540ce50
Author:     Jeroen Roovers <jer@gentoo.org>
AuthorDate: 2019-08-08 07:10:59 +0000
Commit:     Jeroen Roovers <jer@gentoo.org>
CommitDate: 2019-08-08 07:14:04 +0000

    app-admin/sshguard: Fix init.d script
    
    Package-Manager: Portage-2.3.71, Repoman-2.3.17
    Fixes: https://bugs.gentoo.org/688820
    Signed-off-by: Jeroen Roovers <jer@gentoo.org>

 app-admin/sshguard/files/{sshguard.initd-r1 => sshguard.initd-r2} | 5 ++---
 app-admin/sshguard/sshguard-2.4.0.ebuild                          | 2 +-
 2 files changed, 3 insertions(+), 4 deletions(-)