Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 244700 - app-admin/denyhosts - rc-status of denyhosts is listed as "crashed"
Summary: app-admin/denyhosts - rc-status of denyhosts is listed as "crashed"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High minor with 2 votes (vote)
Assignee: Thomas Anderson (tanderson) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on: 319723
Blocks:
  Show dependency tree
 
Reported: 2008-10-28 03:51 UTC by John Baxter
Modified: 2010-10-07 12:46 UTC (History)
18 users (show)

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


Attachments
Possible fix attached for the denyhosts initscript. (denyhosts_openrc.patch,433 bytes, patch)
2009-10-22 14:00 UTC, Lex Brugman
Details | Diff
Possible fix attached for the denyhosts initscript. (denyhosts_openrc.patch,442 bytes, patch)
2010-10-05 21:02 UTC, Lex Brugman
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description John Baxter 2008-10-28 03:51:05 UTC
With baselayout-2 and rc-status-0.3.0-r1, the rc-service lists the status of denyhosts as "crashed". However, the denyhosts process is running, it is not properly detected by rc-status.

Reproducible: Always

Steps to Reproduce:
1.rc-service denyhosts start
2.rc-status | grep denyhosts

Actual Results:  
denyhosts                                                         [  crashed  ]


Expected Results:  
denyhosts                                                         [  ok  ]


rc-service will properly start, stop and restart the daemon.
Comment 1 Rabbe Fogelholm 2008-12-28 18:00:00 UTC
I have the same versions of baselayout and openrc and I see the problem too. My version of denyhosts is 2.6-r1.

The "crashed" status is also reported in response to
`/etc/init.d/denyhosts status'.
Comment 2 Santiago M. Mola (RETIRED) gentoo-dev 2008-12-30 18:42:04 UTC
I've got the same behavior on nfblockd (not in portage) when I send it SIGHUP with start-stop-daemon, so I guess this problem may be a bug in openrc. CC'ing base-system and Roy.
Comment 3 Santiago M. Mola (RETIRED) gentoo-dev 2008-12-30 18:52:57 UTC
My problem seems to be unrelated so I'll report it later.
Comment 4 Roy Marples 2008-12-30 19:09:59 UTC
The denyhosts init script incorrectly uses the --name option.
The process name would be python, or the full path to python.

OpenRC-0.4.1 does not require the --name option at all as it can knows what the interpreter is if the file exists and can be read.

And coldwind, please don't CC me unless you're sure it's an OpenRC bug. Gentoo should be big and clever enough to write init scripts or at least read the fine manual pages I wrote for start-stop-daemon.
Comment 5 Vladimir Kulev 2009-04-10 08:59:29 UTC
Hello there! I have this problem too, openrc-0.4.1-r1. Does anybody has ability to test it on baselayout-1?
Comment 6 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2009-08-01 20:22:14 UTC
assigning to maintainer
Comment 7 Matthias Hanft 2009-09-20 11:15:32 UTC
Same error with baselayout 1.12.11.1 (and denyhosts 2.6-r1):

fileserver ~ # /etc/init.d/denyhosts start
 * Starting DenyHosts daemon ...                                          [ !! ]
fileserver ~ # /etc/init.d/denyhosts status
 * status:  stopped
fileserver ~ # ps -ef|grep deny
root     13726     1  0 13:13 ?        00:00:00 /usr/bin/python2.6 /usr/bin/denyhosts --daemon -c /etc/denyhosts.conf

Removing "--name denyhosts" from the init script (or using "--name python" instead) doesn't help either.
Comment 8 floppe 2009-09-22 05:59:56 UTC
I confirm comment #7 and tested with --name python2.6 which seems to work for me.
Comment 9 parafin 2009-09-22 17:03:27 UTC
--name denyhosts doesn't work anymore because of introducing python-wrapper, which execs selected python interpreter, so name gets overwriten by "python2.6". You can check that by changing denyhosts to denyhosts.py (/usr/bin/denyhosts.py has #!/usr/bin/python2.6 on the first line - it's probably a bug that this file gets installed at all, let alone with python version hard-coded) - it will work. Removing --name doesn't work, because then start-stop-daemon starts searching for /proc/*/exe pointing to denyhosts and of course won't find it. --name python2.6 on the other hand works for me on baselayout-1, but imho it's wrong - what if there is more than one python scripts running? So I added --pidfile option:
start-stop-daemon --name python2.6 --pidfile /var/run/denyhosts.pid --start --exec /usr/bin/denyhosts -- --daemon -c /etc/denyhosts.conf
Just --pidfile without --name doesn't work - start-stop-daemon checks exe then and fails.
Comment 10 parafin 2009-09-22 17:09:35 UTC
Hmm, some more thoughts:
It's bad to hard-code python version in init script, i think. We should use $(eselect python show). Also we can remove --name and change --exec to /usr/bin/$(eselect python show) (and move /usr/bin/denyhosts beyond -- of course), but this probably doesn't make much sense.
Comment 11 Sam Briesemeister 2009-10-07 03:11:03 UTC
(In reply to comment #10)


This bug discussion was helpful to me. I'm not much a Gentoo developer, but for what it's worth this variation on /etc/init.d/denyhosts worked for me:


start() {
        ebegin "Starting DenyHosts daemon"
        start-stop-daemon --start -p /var/run/denyhosts.pid --exec /usr/bin/$(eselect python show) -- /usr/bin/denyhosts --daemon -c /etc/denyhosts.conf 
        eend $?
}


Integrating this (i.e. a patch) into the main portage directory for DenyHosts would be great. (As said, being not a frequent contributor to Gentoo, I'm not sure what the right procedure is for that...)
Comment 12 Aleister 2009-10-07 15:31:55 UTC
(In reply to comment #11)
> (In reply to comment #10)
> 
> 
> This bug discussion was helpful to me. I'm not much a Gentoo developer, but for
> what it's worth this variation on /etc/init.d/denyhosts worked for me:
> 
> 
> start() {
>         ebegin "Starting DenyHosts daemon"
>         start-stop-daemon --start -p /var/run/denyhosts.pid --exec
> /usr/bin/$(eselect python show) -- /usr/bin/denyhosts --daemon -c
> /etc/denyhosts.conf 
>         eend $?
> }
> 
> 
> Integrating this (i.e. a patch) into the main portage directory for DenyHosts
> would be great. (As said, being not a frequent contributor to Gentoo, I'm not
> sure what the right procedure is for that...)
> 

i can confirm this solution works but it might not be the best one.
Comment 13 Lex Brugman 2009-10-22 14:00:53 UTC
Created attachment 207903 [details, diff]
Possible fix attached for the denyhosts initscript.
Comment 14 Lex Brugman 2009-10-22 14:03:18 UTC
(In reply to comment #13)
> Created an attachment (id=207903) [details]
> fix for denyhosts init script 
> 

This possible fix would be cleaner than the one proposed in #11
Comment 15 parafin 2009-10-22 22:21:26 UTC
(In reply to comment #9)
> Just --pidfile without --name doesn't work - start-stop-daemon checks exe then
> and fails.
> 
So fix in comment #13 won't work, at least on baselayout-1
Comment 16 parafin 2009-10-22 22:27:33 UTC
I'll repeat my suggestion:
start-stop-daemon --name $(eselect python show) --pidfile /var/run/denyhosts.pid --start --exec /usr/bin/denyhosts -- --daemon -c /etc/denyhosts.conf
Comment 17 Lex Brugman 2009-10-22 22:30:39 UTC
(In reply to comment #15)
> (In reply to comment #9)
> > Just --pidfile without --name doesn't work - start-stop-daemon checks exe then
> > and fails.
> > 
> So fix in comment #13 won't work, at least on baselayout-1

It does work with baselayout-2 (OpenRC), I didn't test it with baselayout-1 though.
Comment 18 David Sparks 2009-11-04 18:40:03 UTC
(In reply to comment #16)
> I'll repeat my suggestion:
> start-stop-daemon --name $(eselect python show) --pidfile
> /var/run/denyhosts.pid --start --exec /usr/bin/denyhosts -- --daemon -c
> /etc/denyhosts.conf


Before:
 denyhosts                                                          [ stopped  ]

After parafin suggestion:
 denyhosts                                                          [ started  ]

Comment 19 Till Korten 2009-12-16 10:34:22 UTC
The suggestion by parafin in comment #16 works fine for me. Any news on implementing this in the official version?
Comment 20 Chris Ribble 2009-12-30 01:21:39 UTC
Can we please get an official fix in portage? I have quite a number of gentoo boxes with Denyhosts installed and I'd prefer not to have to manually patch all of the denyhosts init scripts (or deal with having to manually kill the process).
Comment 21 svrmarty 2010-04-03 11:49:31 UTC
any news on this ?
Comment 22 Maik Nijhuis 2010-04-21 08:25:03 UTC
(In reply to comment #16)
> I'll repeat my suggestion:
> start-stop-daemon --name $(eselect python show) --pidfile
> /var/run/denyhosts.pid --start --exec /usr/bin/denyhosts -- --daemon -c
> /etc/denyhosts.conf
> 
This patch works like a charm with baselayout-1. My denyhosts executable is /usr/bin/denyhosts.py, instead of /usr/bin/denyhosts, though. I have denyhosts version 2.6-r1, baselayout-1.12.13, and python-2.6.4-r1 on an x86 machine.

Please apply this simple patch ASAP. Like Chris, people do not want to patch everything manually.
Comment 23 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-04-27 15:48:46 UTC
Hi all,
It looks like most of comments #7-22 are duplicates of bug 286424

Comment #4 is the real fix. IOW, patch from comment #13 should be correct. I'll try to get to the bottom of this.
Comment 24 parafin 2010-04-27 17:15:38 UTC
IMHO, there is no fix that would work on baselayout-1 with both 20091230 and 20100321 eselect-python versions. Probably with stabilization of eselect-python-20100321 this bug will go away altogether. Smb should run some tests.
Comment 25 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-04-27 17:22:05 UTC
(In reply to comment #24)
> Probably with stabilization of eselect-python-20100321 this bug will go away 
> altogether. Smb should run some

You mean like bug 316367 ? :)
Comment 26 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-05-07 16:35:45 UTC
For stable hosts (baselayout-1, not openrc):
You need python-2.6.5-r2, not an upgraded eselect-python. Relevant packages:

[binary   R   ] app-admin/eselect-python-20091230 
[binary   R   ] sys-apps/baselayout-1.12.13  USE="unicode -bootstrap -build -static" 
[binary   R   ] dev-lang/python-2.6.5-r2 USE="berkdb gdbm ipv6 ncurses readline ssl threads (wide-unicode) xml -build -doc -examples -sqlite -tk -wininst" 
[binary   R   ] app-admin/denyhosts-2.6-r1 


For ~arch hosts (baselayout-2, openrc):
(Tested with stable python-2.6.4-r1). I couldn't reproduce the issue. Relevant packages:

[binary   R   ] app-admin/eselect-python-20091230 
[binary   R   ] dev-lang/python-2.6.4-r1  USE="berkdb gdbm ncurses readline ssl threads (wide-unicode) xml -build -doc -examples -ipv6 -sqlite -tk -wininst" 
[binary   R   ] sys-apps/baselayout-2.0.1  USE="-build" 
[binary   R   ] sys-apps/openrc-0.6.1-r1  USE="ncurses pam unicode -debug" 
[binary   R   ] app-admin/denyhosts-2.6-r1 

So, it looks like this problem will resolve itself without package changes. Does anyone disagree? Comments welcome.
Comment 27 parafin 2010-05-07 16:48:37 UTC
Haven't checked, but comments to bug 315919 seem to indicate that comment #26 is probably true.
Comment 28 Nico Schlömer 2010-05-13 14:39:09 UTC
I'm running on a stable system, denyhosts always had rc-status "crashed".
Just upgraded to dev-lang/python-2.6.5-r2, and the problem disappears.

Thanks Jeremy for the writeup.

Cheers,
Nico
Comment 29 Aleister 2010-05-28 12:39:41 UTC
on amd64 (app-admin/denyhosts-2.6.1-r1) with python-2.6.5-r2 and eselect-python-20100321 the problem is gone :)
Comment 30 Rabbe Fogelholm 2010-05-29 15:47:01 UTC
Works for me too! At last my bootup sequence looks healthy with green OKs all along.

Portage 2.1.8.3 (default/linux/amd64/10.0/desktop, gcc-4.4.3, glibc-2.10.1-r1, 2.6.32-gentoo-r7 x86_64)
=================================================================
System uname: Linux-2.6.32-gentoo-r7-x86_64-Intel-R-_Core-TM-2_Duo_CPU_T7500_@_2.20GHz-with-gentoo-1.12.13
Timestamp of tree: Sat, 29 May 2010 08:30:18 +0000
app-shells/bash:     4.0_p37
dev-java/java-config: 2.1.10
dev-lang/python:     2.6.5-r99, 3.1.2-r3
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    1.6-r2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.4_p6, 1.7.9-r1, 1.8.5-r3, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       3.4.6-r2, 4.3.4, 4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.33
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA dlj-1.1 skype-eula"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=core2 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
Comment 31 Alexander Sulfrian 2010-06-03 22:49:01 UTC
It do _not_ work for me, even with python-2.6.5-r2.

Portage 2.2_rc67 (default/linux/amd64/10.0, gcc-4.4.3, glibc-2.10.1-r1, 2.6.33-vs2.3.0.36.30.4-gentoo x86_64)
=================================================================
System uname: Linux-2.6.33-vs2.3.0.36.30.4-gentoo-x86_64-Intel-R-_Xeon-TM-_CPU_2.80GHz-with-gentoo-1.12.13
Timestamp of tree: Tue, 01 Jun 2010 22:15:01 +0000
app-shells/bash:     4.0_p37
dev-lang/python:     2.6.5-r2, 3.1.2-r3
sys-apps/baselayout: 1.12.13
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.65
sys-devel/automake:  1.11.1
sys-devel/binutils:  2.18-r3
sys-devel/gcc:       4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6b
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="* -@EULA"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=nocona -O2 -pipe -fomit-frame-pointer"
CHOST="x86_64-pc-linux-gnu"
Comment 32 Vladimir Berezhnoy 2010-06-04 20:47:40 UTC
I'm also still having this problem. Tried updating it with noconfmem and reselecting python version, but with no result.

Portage 2.2_rc67 (default/linux/x86/10.0/desktop, gcc-4.4.3, glibc-2.11.1-r0, 2.6.27-openvz-briullov.1-r2-srv i686)
=================================================================
System uname: Linux-2.6.27-openvz-briullov.1-r2-srv-i686-Intel-R-_Atom-TM-_CPU_330_@_1.60GHz-with-gentoo-2.0.1
Timestamp of tree: Thu, 03 Jun 2010 23:00:23 +0000
distcc 3.1 i686-pc-linux-gnu [enabled]
ccache version 2.4 [enabled]
app-shells/bash:     4.1_p7
dev-java/java-config: 2.1.11
dev-lang/python:     2.5.4-r2, 2.6.5-r2, 3.1.2-r3
dev-python/pycrypto: 2.1.0
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.8.1-r2
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.6.1-r1
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.65
sys-devel/automake:  1.5, 1.7.9-r1, 1.8.5-r4, 1.9.6-r3, 1.10.3, 1.11.1
sys-devel/binutils:  2.20.1-r1
sys-devel/gcc:       4.3.3-r2, 4.4.3-r2
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.7b
virtual/os-headers:  2.6.33
Comment 33 Lex Brugman 2010-10-05 12:47:20 UTC
@Valdimir and Alexander: please try if it works when you apply the patch attached to this bug: http://bugs.gentoo.org/attachment.cgi?id=207903
Comment 34 Alexander Sulfrian 2010-10-05 16:46:19 UTC
(In reply to comment #33)
> @Valdimir and Alexander: please try if it works when you apply the patch
> attached to this bug: http://bugs.gentoo.org/attachment.cgi?id=207903

Yes, with that patch it works.
Comment 35 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-10-05 17:15:44 UTC
The patch doesn't even apply to current installed files. I question the results.
Comment 36 Lex Brugman 2010-10-05 21:02:53 UTC
Created attachment 249674 [details, diff]
Possible fix attached for the denyhosts initscript.

Looks like they've changed the filename of the denyhosts file without bumping the version of the package. Patch is updated, please try again.
Comment 37 Victor Mataré 2010-10-07 09:42:17 UTC
I confirm this patch works after re-emerging the unbumped denyhosts. Can we please get it in the tree? The blocker is effectively resolved (except for sparc-fbsd and x86-fbsd).
Comment 38 Lex Brugman 2010-10-07 10:04:49 UTC
I've just tested my patch with baselayout-1 and it works, just like with baselayout-2.
Comment 39 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-10-07 12:28:40 UTC
(In reply to comment #37)
> I confirm this patch works after re-emerging the unbumped denyhosts. Can we
> please get it in the tree? The blocker is effectively resolved (except for
> sparc-fbsd and x86-fbsd).
> 

If someone can explain why some people have issues and some don't, that would be nice (like I tried with comment #26). No issues here for bl-1 or bl-2 hosts with version in the tree.
Comment 40 Lex Brugman 2010-10-07 12:32:23 UTC
(In reply to comment #39)
> (In reply to comment #37)
> > I confirm this patch works after re-emerging the unbumped denyhosts. Can we
> > please get it in the tree? The blocker is effectively resolved (except for
> > sparc-fbsd and x86-fbsd).
> > 
> 
> If someone can explain why some people have issues and some don't, that would
> be nice (like I tried with comment #26). No issues here for bl-1 or bl-2 hosts
> with version in the tree.
> 

The bug is only for baselayout-2 (as noted in the description), the patch fixes it and doesn't break baselayout-1. The Python thingy was a different problem I guess.

And aside from that, the way the current init script works is kinda weird anyway, the process creates a pid file, why not use it?
Comment 41 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2010-10-07 12:46:38 UTC
Ok, thanks for the explanation. I didn't get that there were multiple issues here (or something). You have your patch from comment #36 committed.

+*denyhosts-2.6-r4 (07 Oct 2010)
+
+  07 Oct 2010; Jeremy Olexa <darkside@gentoo.org> -denyhosts-2.6-r3.ebuild,
+  +denyhosts-2.6-r4.ebuild, files/denyhosts.init:
+  Modify init script (in place) to fix bug 244700 affecting baselayout-2
+  users. Revision bump to force the new file install. Work by Lex Brugman