1

Recently I switched from user-specific anacrontab ( using -t ) to the global-one. Now each day anacron drops me a message (email to root) that it failed to open the cron.daily folder:

Subject: Anacron job 'cron.daily' on myComputer
Message: run-parts: failed to open directory /etc/cron.daily: No such file or directory

The rsnapshot-jobs run normally, however the cron-related jobs dont. Here my anacrontab /etc/anacrontab

# /etc/anacrontab: configuration file for anacron
#
# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
HOME=/root
LOGNAME=root

# These replace cron's entries
# days to wait - delay in minutes - job-name - command to execute
1   5   cron.daily  run-parts --report /etc/cron.daily
7   10  cron.weekly run-parts --report /etc/cron.weekly
@monthly    15  cron.monthly    run-parts--report /etc/cron.monthly
1   5   rsnapshot.day   /usr/local/bin/doBackup.sh daily
7   30  rsnapshot.week  /usr/local/bin/doBackup.sh weekly

And here the output of ls -rtl /etc | grep cron to see the folder permissions:

-rw-r--r--  1 root root      722 Jul  3  2012 crontab
drwxr-xr-x  2 root root     4096 Sep 11  2015 cron.hourly
drwxr-xr-x  2 root root     4096 Sep 11  2015 cron.monthly
drwxr-xr-x  2 root root     4096 Sep 11  2015 cron.weekly
drwxr-xr-x  2 root root     4096 Jan 25 16:04 cron.daily
-rw-r--r--  1 root root      858 Mar 21 10:49 anacrontab
drwxr-xr-x  2 root root     4096 Mar 21 10:57 cron.d
drwxr-xr-x 10 root root     4096 Mar 21 10:57 cron-apt

( Not enough reputation to create tag 'anacron' )

Edit1:

Additional Information. If I copy the line which seems to produce the message and execute it as root, there is no problem ( I added -v to see some output, however it as well works without):

root@myComputer:/etc# run-parts -v /etc/cron.daily
run-parts: executing /etc/cron.daily/0anacron
run-parts: executing /etc/cron.daily/apt
run-parts: executing /etc/cron.daily/aptitude
run-parts: executing /etc/cron.daily/bsdmainutils
run-parts: executing /etc/cron.daily/cracklib-runtime
run-parts: executing /etc/cron.daily/dpkg
run-parts: executing /etc/cron.daily/exim4-base
run-parts: executing /etc/cron.daily/logrotate
run-parts: executing /etc/cron.daily/man-db
run-parts: executing /etc/cron.daily/mlocate
run-parts: executing /etc/cron.daily/passwd
run-parts: executing /etc/cron.daily/popularity-contest
root@myComputer:/etc#

Edit2:

Finally I know what caused anacron to act that wired. It's about the line-endings in the anacrontab:

sed -n l anacrontab
# /etc/anacrontab: configuration file for anacron\r$
...

A healthy anacrontab should not have the \r at the line-endings ( these are Carriage Returns ) .. actually I have no idea how they came there.

So this is a bug in anacron. Either anacron should completly refuse to execute such a malformated file, or it should just eat the Carriage Returns and work like expected. I filed the bug to the debian bugtracker. The current state of the bug can be checked here: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=821081

1 Answer 1

1
+50

Did you try to remove all jobs but cron.daily and test it with "anacron -T"? As I can see, your rsnapshot.day and cron.daily jobs run simultaneously with the same delay. May be this causes conflict with access rights.

10
  • anacron -T only complains about blank lines which are skipped, so the format seems to be fine. I will try to change the delay of the rsnapshot jobs in order to see if it matters.
    – Alex
    Mar 24, 2016 at 12:21
  • Does not matter, problem still persists
    – Alex
    Apr 4, 2016 at 8:37
  • Recently I also faced problems with anacron - it didn't run daily and weelky jobs at all, but run monthly jobs for unknown reasons. I completely removed anacron with apt-get purge anacron and installed it again. Then it started working properly. May be reinstalling will help you. Apr 4, 2016 at 12:36
  • Ok, done. I deleted /etc/anacrontab and purged the package ... I did not modify the new /etc/anacrontab so far ... I'll report back tomorrow, on the next cron.daily attempt :)
    – Alex
    Apr 4, 2016 at 13:40
  • YAY! Seems like it does the trick ! According to /var/log/cron.log some daily stuff was executed. ( No upgrades, so no mail to root) I will now add the rsnapshot-lines and re-check tomorrow if that as well works.
    – Alex
    Apr 5, 2016 at 11:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .