Bug 191410 - Strange mail report after anacron upgrade
Summary: Strange mail report after anacron upgrade
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: anacron
Version: 5
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Marcela Mašláňová
QA Contact: Brock Organ
URL:
Whiteboard:
: 194081 202463 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-05-11 18:27 UTC by Piergiorgio Sartor
Modified: 2007-11-30 22:11 UTC (History)
21 users (show)

Fixed In Version: anacron-2.3-41.fc5
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-09-29 13:11:16 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Piergiorgio Sartor 2006-05-11 18:27:53 UTC
Description of problem:
After upgrading anacron to the latest available, a strange message
is sent by email by, I guess, anacron itself.

Version-Release number of selected component (if applicable):
2.3-38.FC5

How reproducible:
Well, always after a daily restart, at least so far I had
the opportunity to see.

Steps to Reproduce:
1.
Not too much, restart the PC after one day and wait the
different cron/anacron jobs to be excuted.
2.
3.
  
Actual results:
An email arrives with:

...
From: root@mypc (Anacron)
...
Subject: Anacron job 'cron.daily'

/etc/cron.daily/0anacron:

anacron: Cannot run - another anacron process is already running.: Resource
+deadlock avoided

Expected results:
I would say this email should not occurr, whatever the reason.

Additional info:
All the rest seems to work properly, for example logwatch is
scheduled and executed normally.

Comment 1 Pontus Enhager 2006-05-13 15:26:32 UTC
i see this too, this has been discussed in the fedora.users list as well
(although no solution so far)

Comment 2 Jason Vas Dias 2006-05-13 17:51:33 UTC
The problem is simply that you already have the anacron service running from 
/etc/init.d/anacron, so when the cron.daily/0anacron script tries to run
anacron, it correctly fails and does not run another anacron instance.

anacron now implements a lock file mechanism, to allow the service initscript
to behave correctly when changing run levels.

It now emits a message when it finds it cannot run due to another anacron 
process already running, which is then the output of the cron.daily cron
job and is mailed to you by crond.

There is an easy workaround - either:
 o Do not run anacron as a service :
   # chkconfig --level=0123456 anacron off
OR
 o Do not put an anacron run in cron.daily - 
   # mv /etc/cron.daily/0anacron /etc/cron.daily/.disable_0anacron

It is rather silly to both run anacron as a service and put an anacron run
in cron.daily - particularly as anacron will then always try to run itself. 

I will look into perhaps removing the emission of the message
'Cannot run - another anacron process is already running'
if stdout is not a terminal.

This will shortly become academic as anacron is being replaced by a crond
that keeps a persistent job database and supports anacrontab syntax and
anacron behaviour.

Comment 3 Piergiorgio Sartor 2006-05-13 18:20:59 UTC
(In reply to comment #2)
> It is rather silly to both run anacron as a service and put an anacron run
> in cron.daily - particularly as anacron will then always try to run itself. 

Well, OK, but I did not set the system in this way, I just upgraded.
Would have it been better to clean up things, i.e. disabling anacron
as service _OR_ as cron.daily job, in the upgrade script?

Anyway, maybe it is enough to remove the mailed error.

Thanks.

Comment 4 Markku Kolkka 2006-05-14 18:31:43 UTC
The 0anacron script in cron.daily calls anacron -u, which is supposed to just
update the timestamps, not do a full anacron run. That's not "silly", the
purpose is to make sure anacron knows when the cron.daily scripts were last run,
no matter if they are run by anacron or by regular cron.
The suggested "workaround" is completely stupid, as it breaks an essential
system service just in order to stop a harmless message from appearing.


Comment 5 Jim Cornette 2006-05-15 00:49:55 UTC
I am experiencing this bug also. What is the correct way to deal with this issue? 

It sounds like the cron.daily run serves a purpose and running anacron as a
service is also benificial.

Regardless, preventing the message to admin should continue and a correction to
make things correct should be dealt with.

Comment 6 Jim Cornette 2006-05-15 01:38:20 UTC
Correction for the regardless:

The message regarding the error should continue being sent to admin. A
correction to the collision because of the lock file should be implemented.

Comment 7 Markku Kolkka 2006-05-15 15:13:52 UTC
The problem can be fixed by changing the /etc/cron.daily/0anacron script:

#!/bin/sh
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.

# Don't run anacron if this script is called by anacron.
if [ ! -e /var/run/anacron.pid ]
    then anacron -u cron.daily
fi

/etc/cron.weekly/0anacron and /etc/cron.monthly/0anacron scripts need a similar
change.

Comment 8 Piergiorgio Sartor 2006-05-28 15:29:14 UTC
Well, it seems we got a solution (or "the" solution?).
As my boss use to say: when will it be available in the updates?
Thanks.

Comment 9 Jason Vas Dias 2006-06-05 17:56:56 UTC
*** Bug 194081 has been marked as a duplicate of this bug. ***

Comment 10 Alessandro Volpi 2006-08-06 20:19:44 UTC
Since I switched to FC5 I begun to observe the "strange" e-mail message ...
I got rid of it by removing anacron from the service startup list.

What I still do not understand is that I have observed an unusual activity of
the  LED indicating the Hard Disk operation. Once this activity is started it
will not cease unless the system is restarted . I am not sure about the
correlation between the unusual HD activity and the anacron issue  ... I have
observed that  at least ten times and, when this happens, I ALWAYS get the message.

I have moreover observed another unusual behavior : when the system tries to
start anacron twice it also tries to kill it twice at system shutdows. The
SECOND ATTEMPT OBVIOUSLY RESULTS IN A FAILURE, indicated by a RED CHARACTER
MESSAGE in the shutdown output.

Comment 11 Orion Poplawski 2006-08-16 15:13:30 UTC
*** Bug 202463 has been marked as a duplicate of this bug. ***

Comment 12 Orion Poplawski 2006-08-16 15:22:15 UTC
Patch to the spec file:

Index: anacron.spec
===================================================================
RCS file: /cvs/dist/rpms/anacron/FC-5/anacron.spec,v
retrieving revision 1.19
diff -r1.19 anacron.spec
69,70c69,72
< anacron -u $i
<
---
> # Don't run anacron if this script is called by anacron.
> if [ ! -e /var/run/anacron.pid ]; then
>     anacron -u $i
> fi


Comment 13 Jitka Kozana 2006-08-29 12:05:30 UTC
I dissagree with Jason that this is not a bug. 
I successfully reproduced the bug and have to say, that this is really annoying :) However, I did 
not see such a behavior described in comment #10.

As for the reported bug itself, I just added a test to check whether anacron is running, pretty the 
same as in comment #12.

Comment 14 Orion Poplawski 2006-08-30 20:14:42 UTC
I've implemented the fix from comment #7, but now I'm seeing completely empty
email messages, though not sure it happens every time yet.  It's definitely from
cron.daily.

Return-Path: <root.nwra.com>
Received: from lynx.cora.nwra.com (lynx.cora.nwra.com [192.168.0.56])
	by earth.cora.nwra.com (8.13.7/8.13.7) with ESMTP id k7UGufXU011586
	(version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO)
	for <root.nwra.com>; Wed, 30 Aug 2006 10:56:41 -0600
Received: from lynx.cora.nwra.com (localhost [127.0.0.1])
	by lynx.cora.nwra.com (8.13.7/8.13.7) with ESMTP id k7UGuf3V008995
	for <root.nwra.com>; Wed, 30 Aug 2006 10:56:41 -0600
Received: (from root@localhost)
	by lynx.cora.nwra.com (8.13.7/8.13.7/Submit) id k7UGuee2008985
	for root; Wed, 30 Aug 2006 10:56:40 -0600
Date: Wed, 30 Aug 2006 10:56:40 -0600
From: Anacron <root.nwra.com>
Message-Id: <200608301656.k7UGuee2008985.nwra.com>
Status: O
X-UID: 30331
Content-Length: 0
X-Keywords:


From /var/log/cron:

Aug 30 10:56:40 lynx anacron[2670]: Job `cron.daily' terminated (mailing output)


Comment 15 Jitka Kozana 2006-08-31 11:26:30 UTC
Hm... so the problem could not be fixed so easily. The solution could be in changing the way 
anacron informs the root about errors.

Comment 16 Piergiorgio Sartor 2006-09-01 18:15:08 UTC
(In reply to comment #14)
> I've implemented the fix from comment #7, but now I'm seeing completely empty
> email messages, though not sure it happens every time yet.  It's definitely from
> cron.daily.
...
> From /var/log/cron:
> 
> Aug 30 10:56:40 lynx anacron[2670]: Job `cron.daily' terminated (mailing output)
> 

Strange. I tried a different thing.
I just commented out the line:

anacron -u cron.daily

That is (to be clear):

#anacron -u cron.daily

No empty mail was sent, no mail at all.
In theory, the proposed solution should have the same effect and,
from anacron documentation, the mail is sent _if_ output is generated.

So, I don't know, could it be the proposed solution has anyone some
output, maybe just CR?
/bin/sh is a link to bash, could this affect the behaviour?

I'll try the "if" solution and report the result.

Comment 17 Piergiorgio Sartor 2006-09-01 18:40:29 UTC
OK, from the test I could perform (on a different PC), no mail message was
sent with the solution of comment #7 (empty or full), so I guess something
else is wrong with the result of comment #14.

I must say that /etc/cron.daily was executed by anacron, from what I could see,
and not by crond (the PC was freshly booted).
I do not know if this makes a difference in terms of mailing.
In case it does, maybe there is an other bug to consider.

In my opinion the patch should go mainstream and see how many reports
are generated.

Comment 18 Stanis Trendelenburg 2006-09-08 11:35:36 UTC
The problem with anacron sending empty mails is indeed a different bug. It also
 occurs when anacron is run directly and not via cron.
I have file a new bug report here:

https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=205747


Comment 19 Marcela Mašláňová 2006-09-20 12:40:23 UTC
Please upgrade on anacron-2.3-40.fc5, and let me know. I haven't these annoying 
mail since update.

Comment 20 Orion Poplawski 2006-09-20 16:04:06 UTC
With anacron-2.3-40.fc5, /etc/cron.daily/0anacron is still:

# cat /etc/cron.daily/0anacron
#!/bin/sh
#
# anacron's cron script
#
# This script updates anacron time stamps. It is called through run-parts
# either by anacron itself or by cron.
#
# The script is called "0anacron" to assure that it will be executed
# _before_ all other scripts.

anacron -u cron.daily


and still produces:

anacron: Cannot run - another anacron process is already running.: Resource
deadlock avoided


please apply the patch from comment #12.

Comment 21 Forest Wilkinson 2006-09-28 17:43:54 UTC
To corroborate the report in comment 20, I am using anacron-2.3-40.fc5, and
still get the "process is already running" email from anacron.

Comment 22 Marcela Mašláňová 2006-09-29 13:11:16 UTC
Patch is applied in anacron-2.3-41.fc5


Note You need to log in before you can comment on or make changes to this bug.