Bug 505778 - /etc/crontab is empty
/etc/crontab is empty
Status: CLOSED ERRATA
Product: Fedora
Classification: Fedora
Component: crontabs (Show other bugs)
11
x86_64 Linux
low Severity medium
: ---
: ---
Assigned To: Marcela Mašláňová
Fedora Extras Quality Assurance
: Reopened
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-13 14:55 EDT by Maciej Żenczykowski
Modified: 2009-08-13 04:58 EDT (History)
7 users (show)

See Also:
Fixed In Version: 1.10-30.fc11
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2009-08-12 16:55:52 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Maciej Żenczykowski 2009-06-13 14:55:52 EDT
cron is failing to run hourly/daily/weekly/monthly jobs.

[root@gaia ~]# rpm -q crontabs cronie anacron
crontabs-1.10-29.fc11.noarch
cronie-1.2-7.fc11.x86_64
anacron-2.3-74.fc11.x86_64
 
[root@gaia ~]# rpm -q --whatprovides /etc/crontab 
crontabs-1.10-29.fc11.noarch

[root@gaia ~]# rpm -V crontabs
[root@gaia ~]# rpm -Vv crontabs
.........    /etc/cron.daily
.........    /etc/cron.hourly
.........    /etc/cron.monthly
.........    /etc/cron.weekly
.........  c /etc/crontab
.........  c /etc/sysconfig/crontab
.........    /usr/bin/run-parts

[root@gaia ~]# cat /etc/crontab 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
# .---------------- minute (0 - 59) 
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ... 
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7)  OR
#sun,mon,tue,wed,thu,fri,sat 
# |  |  |  |  |
# *  *  *  *  *  command to be executed

Note that this file *DOES NOT* contain something along the lines of:

[maze@tcs ~]$ cat /etc/crontab 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# run-parts
01 * * * * root run-parts /etc/cron.hourly
02 4 * * * root run-parts /etc/cron.daily
22 4 * * 0 root run-parts /etc/cron.weekly
42 4 1 * * root run-parts /etc/cron.monthly

(which was taken from a centos 4.7 box)

Also of note:

[root@gaia ~]# rpm -Vv anacron
.........  c /etc/anacrontab
.........    /etc/cron.d/0hourly
.........    /etc/cron.hourly/0anacron
.........    /usr/sbin/anacron
.........    /usr/share/doc/anacron-2.3
.........  d /usr/share/doc/anacron-2.3/COPYING
.........  d /usr/share/doc/anacron-2.3/README
.........  d /usr/share/man/man5/anacrontab.5.gz
.........  d /usr/share/man/man8/anacron.8.gz
.........    /var/spool/anacron
[root@gaia ~]# rpm -Vv cronie
.........    /etc/cron.d
.........  c /etc/cron.deny
.........  c /etc/pam.d/crond
.........    /etc/rc.d/init.d/crond
.........  c /etc/sysconfig/crond
.........    /usr/bin/crontab
.........    /usr/sbin/crond
.........    /usr/share/doc/cronie-1.2
.........  d /usr/share/doc/cronie-1.2/AUTHORS
.........  d /usr/share/doc/cronie-1.2/COPYING
.........  d /usr/share/doc/cronie-1.2/ChangeLog
.........  d /usr/share/doc/cronie-1.2/INSTALL
.........  d /usr/share/doc/cronie-1.2/README
.........  d /usr/share/man/man1/crontab.1.gz
.........  d /usr/share/man/man5/crontab.5.gz
.........  d /usr/share/man/man8/cron.8.gz
.........  d /usr/share/man/man8/crond.8.gz
.........    /var/spool/cron

[root@gaia ~]# cat /etc/cron.d/0hourly 
01 * * * * root run-parts /etc/cron.hourly

So something weird here... with the hourly runner being owned by anacron?  And nothing providing daily/weekly/monthly runners?

(I just installed anacron right now so it's possible hourly cron jobs will now work)

[root@gaia ~]# cat /etc/anacrontab 
# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
# the maximal random delay added to the base delay of the jobs
RANDOM_DELAY=45
# the jobs will be started during the following hours only
START_HOURS_RANGE=3-22

#period in days   delay in minutes   job-identifier   command
1       5       cron.daily              nice run-parts /etc/cron.daily
7       25      cron.weekly             nice run-parts /etc/cron.weekly
@monthly 45     cron.monthly            nice run-parts /etc/cron.monthly


Does this mean anacron is required by cronie? why?
Comment 1 Maciej Żenczykowski 2009-06-13 15:01:37 EDT
(the following may also be of some use)

[root@gaia ~]# uptime
 20:58:22 up 3 days,  6:23,  1 user,  load average: 0.00, 0.00, 0.00

[root@gaia ~]# date
Sat Jun 13 20:58:22 CEST 2009

[root@gaia ~]# tail -n 12 /var/log/cron
Jun  9 20:11:03 gaia crond[1751]: (CRON) INFO (running with inotify support)
Jun 10 14:06:17 gaia crond[1778]: (CRON) STARTUP (1.2)
Jun 10 14:06:17 gaia crond[1778]: (CRON) INFO (running with inotify support)
Jun 10 14:32:43 gaia crond[1761]: (CRON) STARTUP (1.2)
Jun 10 14:32:43 gaia crond[1761]: (CRON) INFO (running with inotify support)
Jun 13 03:12:40 gaia crond[29027]: (CRON) STARTUP (1.2)
Jun 13 03:12:40 gaia crond[29027]: (CRON) INFO (running with inotify support)
Jun 13 20:03:59 gaia crond[29288]: (CRON) STARTUP (1.2)
Jun 13 20:03:59 gaia crond[29288]: (CRON) INFO (running with inotify support)
Jun 13 20:08:32 gaia crontab[29302]: (root) LIST (root)
Jun 13 20:14:02 gaia crond[29333]: (CRON) STARTUP (1.2)
Jun 13 20:14:02 gaia crond[29333]: (CRON) INFO (running with inotify support)

[root@gaia ~]# tail -n 3 /var/log/yum.log
Jun 10 23:31:37 Installed: ntpdate-4.2.4p6-4.fc11.x86_64
Jun 10 23:31:43 Installed: ntp-4.2.4p6-4.fc11.x86_64
Jun 13 20:09:13 Installed: anacron-2.3-74.fc11.x86_64

(note: that I'm guessing at this point that installing anacron will have fixed the problem)
Comment 2 Maciej Żenczykowski 2009-06-13 15:10:54 EDT
and indeed with anacron installed, cron works more like expected...

[root@gaia ~]# tail /var/log/cron 
Jun 13 20:14:02 gaia crond[29333]: (CRON) INFO (running with inotify support)
Jun 13 21:01:01 gaia CROND[29422]: (root) CMD (run-parts /etc/cron.hourly)
Jun 13 21:01:01 gaia run-parts(/etc/cron.hourly)[29422]: starting 0anacron
Jun 13 21:01:01 gaia anacron[29431]: Anacron 2.3 started on 2009-06-13
Jun 13 21:01:01 gaia anacron[29431]: Will run job `cron.daily' in 33 min.
Jun 13 21:01:01 gaia anacron[29431]: Will run job `cron.weekly' in 53 min.
Jun 13 21:01:01 gaia anacron[29431]: Jobs will be executed sequentially
Jun 13 21:01:01 gaia run-parts(/etc/cron.hourly)[29434]: finished 0anacron
Jun 13 21:01:01 gaia run-parts(/etc/cron.hourly)[29422]: starting test
Jun 13 21:01:02 gaia run-parts(/etc/cron.hourly)[29443]: finished test
Comment 3 Henrique Martins 2009-06-13 18:29:09 EDT
Same problem here,  I just copied the old lines into crontab from another system  I don't have anacron.
Cron used to be easy, but lately it seems every upgrade breaks something...
Comment 4 Terje Røsten 2009-06-14 08:10:20 EDT
So now cronie needs anacron? 
That's sounds horrible. Could we please have this reverted.
Comment 5 Tomas Mraz 2009-06-15 03:04:06 EDT
No. It won't be reverted.

Cronie does not need anacron. Fedora needs anacron to run the cron.daily, cron.weekly and cron.monthly jobs.

Cronie itself supports only /etc/crontab, /etc/cron.d, per-user crontabs and cron.hourly jobs.

And that's how it makes sense.

If you need some job to run at exactly specified time & day, put it into a crontab supported by cronie.
Comment 6 Terje Røsten 2009-06-15 03:28:24 EDT
Great, breaking stuff that has worked for over 10 years, thanks very much...
Comment 7 Tomas Mraz 2009-06-15 03:56:00 EDT
What's broken when you install cronie, crontabs and anacron?
Comment 8 Maciej Żenczykowski 2009-06-15 10:06:28 EDT
$ for i in /etc/cron.*; do echo "$i: `rpm -q --whatprovides $i`"; done

/etc/cron.d: cronie-1.2-7.fc11.x86_64
/etc/cron.deny: cronie-1.2-7.fc11.x86_64

/etc/cron.daily: crontabs-1.10-29.fc11.noarch
/etc/cron.hourly: crontabs-1.10-29.fc11.noarch
/etc/cron.monthly: crontabs-1.10-29.fc11.noarch
/etc/cron.weekly: crontabs-1.10-29.fc11.noarch

So all the directories are provided by cronie and/or crontabs.  Yet they don't work without anacron installed.

If anacron is the one that runs cron.daily/hourly/monthly/weekly, then it should own those directories.
Comment 9 Maciej Żenczykowski 2009-06-15 10:13:15 EDT
IMHO, either those directories (/etc/cron.daily/hourly/weekly/monthly) should be moved to the anacron package, or crontabs should require anacron, or even just be rolled into anacron (considering how tiny it would end up being).  Alternatively crontabs should require some meta-package provided either by anacron, or by an alternate package which would run the stuff.

It's just illogical for the directory structure to be owned by something and yet not functional.

I believe it is possible to install a minimal fedora 11 system with cronie/crontabs, but without anacron, and even if that's not true [and I had manually uninstalled anacron] it shouldn't break with anacron not installed.

[I'll reopen the bug just to make sure there's some response ;-)]
Comment 10 Terje Røsten 2009-06-15 12:53:10 EDT
 At least let cronie have a req. on anacron. 

And inform your users!

The new /etc/crontabs have exactly no information about this change.
The manpages in cronie don't have a word about anacron.
crontabs package has no doc at all.

anacron has:

It's part of triple - cronie, anacron
and crontabs, which care about execution of jobs also with often
reboots or hibernation.

My systems has uptimes in years, why do I need anacron to run /etc/cron.daily/* then? (Where my yum update scripts is proposed to run every night, no I don't login into 100 boxen and run some PackageKit applet every night.)

crond is critical part of a Linux system, please be more careful.
Comment 11 Fedora Update System 2009-06-18 04:45:23 EDT
crontabs-1.10-30.fc11 has been submitted as an update for Fedora 11.
http://admin.fedoraproject.org/updates/crontabs-1.10-30.fc11
Comment 12 Fedora Update System 2009-06-19 09:33:50 EDT
crontabs-1.10-30.fc11 has been pushed to the Fedora 11 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update crontabs'.  You can provide feedback for this update here: http://admin.fedoraproject.org/updates/F11/FEDORA-2009-6688
Comment 13 Maciej Żenczykowski 2009-06-19 18:01:19 EDT
Here's the content of the new package:
# rpm -q crontabs
crontabs-1.10-30.fc11.noarch
# rpm -Vv crontabs
.........    /etc/cron.daily
.........    /etc/cron.hourly
.........    /etc/cron.monthly
.........    /etc/cron.weekly
.........  c /etc/crontab
.........    /usr/bin/run-parts
.........  d /usr/share/man/man4/crontabs.4.gz

Here's the content of (the new) man crontab, for those that don't want to go to the trouble of updating their package:

CRONTABS(4)                 Crontabs users’ Manual                 CRONTABS(4)

NAME
       crontabs - configuration and scripts for running periodical jobs

SYNOPSIS
       run-parts <directory>

DESCRIPTION
       Crontabs  is  historical  name for run-parts script and system crontab.
       Run-parts runs all executables in the specified directory.  The  execu-
       tion of files can be allowed or denied by creating file jobs.allow
        or  jobs.deny  which  worked similar as other allow/deny config files.
       The file must be created in the specified directory.

       Historically the crontab file contained configuration which called run-
       parts  on  files in cron.{daily,weekly,monthly} directories. These jobs
       are now run indirectly through anacron  to  prevent  conflicts  between
       cron  and  anacron.  That means the anacron package has to be installed
       if the jobs in these  directories  should  be  running.  Refer  to  the
       anacron(8) how to limit the time of day of the job execution.

EXAMPLE
       /etc/cron.daily/jobs.deny  could  contain  for  example 0logwatch which
       forbid execution of this script.

SEE ALSO
       anacron(8), crontab(5).

Marcela Mašláňová                 2009-06-16                       CRONTABS(4)
Comment 14 Maciej Żenczykowski 2009-06-19 18:08:45 EDT
*************************
***** Current state *****
*************************

# rpm -q --whatprovides /etc/cron.d/0hourly
anacron-2.3-75.fc11.x86_64

# cat /etc/cron.d/0hourly 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/
01 * * * * root run-parts /etc/cron.hourly

# rpm -q --whatprovides /etc/crontab
crontabs-1.10-30.fc11.noarch

# cat /etc/crontab 
SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  command to be executed



*************************
***** My suggestion *****
*************************

Delete the /etc/cron.d/0hourly file (remove it from the anacron package).
Make the following (or something like it) the new content of /etc/crontab (in crontabs):

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root
HOME=/

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  *  command to be executed

# run-parts
01 * * * * root run-parts /etc/cron.hourly
# The following are commented out because they normally get run via anacron
# Please uncomment if you are not installing anacron
#02 4 * * * root run-parts /etc/cron.daily
#22 4 * * 0 root run-parts /etc/cron.weekly
#42 4 1 * * root run-parts /etc/cron.monthly

(at the very least please add the commented lines so people don't have to go searching for what to add in there)
Comment 15 Tom Horsley 2009-06-27 07:38:51 EDT
Great :-(. cronie now has a dependency on anacron, so since I eradicated
anacron from my system to prevent the nonsense complained about above, I can
no longer get updates to cronie without anacron being dragged back in.
Comment 16 Maciej Żenczykowski 2009-06-28 00:05:52 EDT
# rpm -q --whatprovides /etc/cron.d/0hourly /etc/cron.hourly/0anacron 
anacron-2.3-75.fc11.x86_64
anacron-2.3-75.fc11.x86_64

Just delete (or better, comment out the contents of) those two files, and add the above-mentioned lines to /etc/crontab.
Comment 17 Fedora Update System 2009-08-12 16:55:47 EDT
crontabs-1.10-30.fc11 has been pushed to the Fedora 11 stable repository.  If problems still persist, please make note of it in this bug report.
Comment 18 Mark Hagger 2009-08-13 04:39:56 EDT
I guess this is going to bite many many many people out there when they miss the "/etc/crontabs created as /etc/crontabs.rpmnew" during a routine update and then start wondering why their hourly/daily/weekly/monthly jobs have started running twice.  Cunning change.
Comment 19 Tomas Mraz 2009-08-13 04:58:11 EDT
This was not introduce during a routine update - this change was introduced in F11 release already. This update just adds some documentation and missing dependency.

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