Debian Bug report logs - #460514
cron: can't lock /etc/crond.pid, otherpid may be 6898: Resource temporarily unavailable

version graph

Package: cron; Maintainer for cron is Javier Fernández-Sanguino Peña <jfs@debian.org>; Source for cron is src:cron.

Reported by: Axel Beckert <abe@deuxchevaux.org>

Date: Sun, 13 Jan 2008 10:51:01 UTC

Severity: serious

Tags: patch

Found in version cron/3.0pl1-101

Fixed in version cron/3.0pl1-102

Done: Javier Fernandez-Sanguino Pen~a <jfs@debian.org>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Javier Fernandez-Sanguino Pen~a <jfs@computer.org>:
Bug#460514; Package cron. Full text and rfc822 format available.

Acknowledgement sent to Axel Beckert <abe@deuxchevaux.org>:
New Bug report received and forwarded. Copy sent to Javier Fernandez-Sanguino Pen~a <jfs@computer.org>. Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Axel Beckert <abe@deuxchevaux.org>
To: submit@bugs.debian.org
Subject: cron: can't lock /etc/crond.pid, otherpid may be 6898: Resource temporarily unavailable
Date: Sun, 13 Jan 2008 11:49:57 +0100
Package: cron
Version: 3.0pl1-101
Severity: serious
Justification: Policy 9.1.1 (FHS)

At least since updating to this version of cron on kfreebsd-amd64 (maybe
earlier), cron seems to look for the pid in /etc/crond.pid which
doesn't work. It argues about it as follows:

18/0/0 root@c-metisse:pts/ttyp0 11:25:36 [~] # /etc/init.d/cron stop
Stopping periodic command scheduler: crond failed!
19/0/0 root@c-metisse:pts/ttyp0 11:38:39 [~] # /etc/init.d/cron start
Starting periodic command scheduler: crond/usr/sbin/cron: can't lock /etc/crond.pid, otherpid may be 6898: Resource temporarily unavailable
 failed!
20/0/0 root@c-metisse:pts/ttyp0 11:38:44 [~] # 

So this are three bugs in one. ;-)

a) The usage of /etc/crond.pid violates the FHS and therefore the Debian
   Policy Manual, section 9.1.1

b) The init.d script is unable to stop or restart crond.

c) The init.d script does not return an exit code unequal to zero if it
   fails (see the prompts above).

-- System Information:
Debian Release: lenny/sid
Architecture: kfreebsd-amd64 (x86_64)

Kernel: kFreeBSD 7.0-1-amd64-generic
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Shell: /bin/sh linked to /bin/bash

Versions of packages cron depends on:
ii  adduser                       3.105      add and remove users and groups
ii  debianutils                   2.28.2     Miscellaneous utilities specific t
ii  libc0.1                       2.7-6      GNU C Library: Shared libraries
ii  lsb-base                      3.1-24     Linux Standard Base 3.1 init scrip

Versions of packages cron recommends:
ii  postfix [mail-transport-agent 2.4.6-4    High-performance mail transport ag

-- no debconf information




Information forwarded to debian-bugs-dist@lists.debian.org, Javier Fernandez-Sanguino Pen~a <jfs@computer.org>:
Bug#460514; Package cron. Full text and rfc822 format available.

Acknowledgement sent to Javier Fernández-Sanguino Peña <jfs@computer.org>:
Extra info received and forwarded to list. Copy sent to Javier Fernandez-Sanguino Pen~a <jfs@computer.org>. Full text and rfc822 format available.

Message #10 received at 460514@bugs.debian.org (full text, mbox):

From: Javier Fernández-Sanguino Peña <jfs@computer.org>
To: Axel Beckert <abe@deuxchevaux.org>, 460514@bugs.debian.org
Subject: Re: Bug#460514: cron: can't lock /etc/crond.pid, otherpid may be 6898: Resource temporarily unavailable
Date: Sun, 13 Jan 2008 17:38:59 +0100
[Message part 1 (text/plain, inline)]
On Sun, Jan 13, 2008 at 11:49:57AM +0100, Axel Beckert wrote:
> At least since updating to this version of cron on kfreebsd-amd64 (maybe
> earlier), cron seems to look for the pid in /etc/crond.pid which
> doesn't work. It argues about it as follows:

Ummm... there are several issues here, you should report them separately:

> a) The usage of /etc/crond.pid violates the FHS and therefore the Debian
>    Policy Manual, section 9.1.1

Your architecture's /usr/include/paths.h (this is provided by the libc6-dev)
header is missing the following line:

#define    _PATH_VARRUN "/var/run/"

This makes cron use /etc/ instead of /var/run.

> b) The init.d script is unable to stop or restart crond.

Yes, that's because the pid file is not found.

> c) The init.d script does not return an exit code unequal to zero if it
>    fails (see the prompts above).

Init.d scripts which fail to stop should still return a code equal to zero
(see the LSB specs). I don't parse your command lines, could you explain how
can I infer that the exit code is not cero?

Regards

Javier
[signature.asc (application/pgp-signature, inline)]

Information forwarded to debian-bugs-dist@lists.debian.org, Javier Fernandez-Sanguino Pen~a <jfs@computer.org>:
Bug#460514; Package cron. Full text and rfc822 format available.

Acknowledgement sent to Axel Beckert <abe@deuxchevaux.org>:
Extra info received and forwarded to list. Copy sent to Javier Fernandez-Sanguino Pen~a <jfs@computer.org>. Full text and rfc822 format available.

Message #15 received at 460514@bugs.debian.org (full text, mbox):

From: Axel Beckert <abe@deuxchevaux.org>
To: 460514@bugs.debian.org
Cc: control@bugs.debian.org
Subject: Re: Bug#460514: cron: can't lock /etc/crond.pid, otherpid may be 6898: Resource temporarily unavailable
Date: Sun, 13 Jan 2008 21:37:11 +0100
tag 460514 + patch
thanks

Hi,

On Sun, Jan 13, 2008 at 05:38:59PM +0100, Javier Fernández-Sanguino Peña wrote:
> Ummm... there are several issues here, you should report them separately:

Ok, I'll have a closer look at LSB what return code should be given if
/etc/init.d/cron start fails and will eventually report it as own bug.

> > a) The usage of /etc/crond.pid violates the FHS and therefore the Debian
> >    Policy Manual, section 9.1.1
> 
> Your architecture's /usr/include/paths.h (this is provided by the
> libc6-dev)

Well, it's libc0.1 on Debian GNU/kFreeBSD, but it has the same source
package as libc6: glibc.

> header is missing the following line:
> 
> #define    _PATH_VARRUN "/var/run/"

Nope:

$ fgrep _PATH_VARRUN /usr/include/paths.h
#define _PATH_VARRUN    "/var/run/"

There also seems to be only one further such bug in the BTS:
http://merkel.debian.org/~don/cgi/search.cgi?phrase=_PATH_VARRUN&search=search&skip=0&order_field=&order_operator=STRA&max_results=10

I had a look into pathnames.h and the Makefile. At the moment I
suspect the following cpp macros plus Makefile entries as the source
of the problem:

pathnames.h:

 22 #if (defined(BSD)) && (BSD >= 199103) || defined(__linux__) || defined(AIX)
 23 # include <paths.h>
 24 #endif /*BSD*/

Makefile:

 65 #(BSD is only needed if <sys/params.h> does not define it, as on ULTRIX)
 66 #COMPAT         =       -DBSD

For testing I compiled cron just with main() replaced by a routine
which just outputs the values of the cpp macros BSD, DEBIAN and
_PATH_VARRUN:

---snip---
#include <stdio.h>   

#ifndef BSD
#define BSD ""
#endif

#ifndef DEBIAN
#define DEBIAN ""
#endif

#ifndef _PATH_VARRUN
#define _PATH_VARRUN ""
#endif

int main (void) {
    printf("bsd=%s\n", BSD);
    printf("path_varrun=%s\n", _PATH_VARRUN);
    printf("debian=%s\n", DEBIAN);
    return 0;
}
---snap---

What I get is: 

bsd=
path_varrun=
debian=

With an additional "#include <paths.h>", I get the following output:

bsd=
path_varrun=/var/run/
debian=

which seems fine.

If I do include an "#include <sys/param.h>" _instead_, I again get 

bsd=
path_varrun=
debian=

And an

egrep '# *define +BSD' /usr/include/sys/*.h

doesn't find anything.

So <sys/param.h> does not define BSD ob GNU/kFreeBSD (which is
reasonable since it's no BSD userland and no BSD libc) but it also
defines neither __linux__ nor AIX and therefore /usr/include/paths.h
is not included at all -- so that's probably the reason why cron
doesn't know about /var/run.

Following is a patch which fixes this issue:

diff -U3 -r cron-3.0pl1-101/Makefile cron-3.0pl1/Makefile
--- cron-3.0pl1-101/Makefile	2008-01-13 20:46:16.000000000 +0100
+++ cron-3.0pl1/Makefile	2008-01-13 21:18:52.000000000 +0100
@@ -65,7 +65,7 @@
 #(BSD is only needed if <sys/params.h> does not define it, as on ULTRIX)
 #COMPAT		=	-DBSD
 # (POSIX)
-COMPAT		=	-DPOSIX
+COMPAT		=	-DPOSIX $(shell test "`uname -o`" = "GNU/kFreeBSD" && echo -n -DGNUKFREEBSD)
 #<<lint flags of choice?>>
 LINTFLAGS	=	-hbxa $(INCLUDE) $(COMPAT) $(DEBUGGING)
 #<<want to use a nonstandard CC?>>
diff -U3 -r cron-3.0pl1-101/pathnames.h cron-3.0pl1/pathnames.h
--- cron-3.0pl1-101/pathnames.h	2008-01-13 20:46:16.000000000 +0100
+++ cron-3.0pl1/pathnames.h	2008-01-13 21:19:19.000000000 +0100
@@ -19,7 +19,7 @@
  * $Id: pathnames.h,v 1.3 1994/01/15 20:43:43 vixie Exp $
  */
 
-#if (defined(BSD)) && (BSD >= 199103) || defined(__linux__) || defined(AIX)
+#if (defined(BSD)) && (BSD >= 199103) || defined(__linux__) || defined(AIX) || defined(GNUKFREEBSD)
 # include <paths.h>
 #endif /*BSD*/
 
I have successfully tested it on kfreebsd-amd64, but not oon
non-kfreebsd architectures.

HTH.

	Regards from the just finished BSP in Zurich, Axel
-- 
Axel Beckert - abe@deuxchevaux.org, abe@noone.org - http://noone.org/abe/




Tags added: patch Request was from Axel Beckert <abe@deuxchevaux.org> to control@bugs.debian.org. (Sun, 13 Jan 2008 20:39:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Javier Fernandez-Sanguino Pen~a <jfs@computer.org>:
Bug#460514; Package cron. Full text and rfc822 format available.

Acknowledgement sent to Javier Fernández-Sanguino Peña <jfs@computer.org>:
Extra info received and forwarded to list. Copy sent to Javier Fernandez-Sanguino Pen~a <jfs@computer.org>. Full text and rfc822 format available.

Message #22 received at 460514@bugs.debian.org (full text, mbox):

From: Javier Fernández-Sanguino Peña <jfs@computer.org>
To: Axel Beckert <abe@deuxchevaux.org>, 460514@bugs.debian.org
Subject: Re: Bug#460514: cron: can't lock /etc/crond.pid, otherpid may be 6898: Resource temporarily unavailable
Date: Sun, 13 Jan 2008 22:33:02 +0100
[Message part 1 (text/plain, inline)]
On Sun, Jan 13, 2008 at 09:37:11PM +0100, Axel Beckert wrote:
> tag 460514 + patch
> thanks
> 
> Hi,
> 
> On Sun, Jan 13, 2008 at 05:38:59PM +0100, Javier Fernández-Sanguino Peña wrote:
> > Ummm... there are several issues here, you should report them separately:
> 
> Ok, I'll have a closer look at LSB what return code should be given if
> /etc/init.d/cron start fails and will eventually report it as own bug.

Notice that my comment applied to the 'stop' action, not to 'start', which
should exit with non-zero if it fails.

Regards

Javier
[signature.asc (application/pgp-signature, inline)]

Reply sent to Javier Fernandez-Sanguino Pen~a <jfs@debian.org>:
You have taken responsibility. Full text and rfc822 format available.

Notification sent to Axel Beckert <abe@deuxchevaux.org>:
Bug acknowledged by developer. Full text and rfc822 format available.

Message #27 received at 460514-close@bugs.debian.org (full text, mbox):

From: Javier Fernandez-Sanguino Pen~a <jfs@debian.org>
To: 460514-close@bugs.debian.org
Subject: Bug#460514: fixed in cron 3.0pl1-102
Date: Sun, 13 Jan 2008 22:32:03 +0000
Source: cron
Source-Version: 3.0pl1-102

We believe that the bug you reported is fixed in the latest version of
cron, which is due to be installed in the Debian FTP archive:

cron_3.0pl1-102.diff.gz
  to pool/main/c/cron/cron_3.0pl1-102.diff.gz
cron_3.0pl1-102.dsc
  to pool/main/c/cron/cron_3.0pl1-102.dsc
cron_3.0pl1-102_i386.deb
  to pool/main/c/cron/cron_3.0pl1-102_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 460514@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Javier Fernandez-Sanguino Pen~a <jfs@debian.org> (supplier of updated cron package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Sun, 13 Jan 2008 23:08:11 +0100
Source: cron
Binary: cron
Architecture: source i386
Version: 3.0pl1-102
Distribution: unstable
Urgency: low
Maintainer: Javier Fernandez-Sanguino Pen~a <jfs@computer.org>
Changed-By: Javier Fernandez-Sanguino Pen~a <jfs@debian.org>
Description: 
 cron       - management of regular background processing
Closes: 459952 460514
Changes: 
 cron (3.0pl1-102) unstable; urgency=low
 .
   * Modify pathnames.h so that GNU/KFreeBSD is detected and /var/run is
     used instead of /etc/ to store the PID file (Closes: #460514)
   * Modify the init.d script so that it uses /etc/cron.pid as its pidfile
     if it exists, this will prevent the init.d script from failing if
     cron is compiled in a system which does not get to define _PATH_RUN
     as /var/run
   * Fix typo in changelog (Closes: 459952)
Files: 
 6bccdd0d45794e82f165a3340a7a3411 685 admin important cron_3.0pl1-102.dsc
 a338971a0c7e67eb068ce9fb42fc22d2 69506 admin important cron_3.0pl1-102.diff.gz
 57da7e2aebb095a0bf9495ceb5d40c67 80034 admin important cron_3.0pl1-102_i386.deb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFHio8VsandgtyBSwkRAvj1AJ0bfttdHz34zFJwA3CiqYNvZ4PxBgCbBaPH
Vtokev/DUx05TbcdVWACuCk=
=bNIb
-----END PGP SIGNATURE-----





Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Wed, 13 Feb 2008 07:31:01 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Sun Apr 20 09:25:20 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.