I am running Ubuntu 9.10 and 10.04 on MediaTemple (ve) servers.

On both of them, the anacron setup is broken, ... and they have been broken since I first installed Ubuntu. It has only come to my attention recently, when I realize my log files were not rotating.

I am hoping someone who has anacron working can help diagnose the problem and suggest a fix.

Here is /etc/cron.d/anacron ... This part works correctly: Every morning at 7:30am, cron executes this command to start up anacron.

# /etc/cron.d/anacron: crontab entries for the anacron package


30 7    * * *   root    test -x /etc/init.d/anacron && /etc/init.d/anacron start >/dev/null

The problem is that /etc/init.d/anacron start fails:

# /etc/init.d/anacron start >/dev/null
start: Unknown job: anacron

Notice that /etc/init.d/anacron is a symbolic link to /lib/init/upstart-job:

# ls -l /etc/init.d/anacron
lrwxrwxrwx 1 root root 21 Jan 12  2010 /etc/init.d/anacron -> /lib/init/upstart-job

Now I am stumped. Anyone have any suggestions how to fix this?

Take a look in /var/log and see if your log files are being rotated (as opposed to growing indefinitely). If they are being rotated, then you probably have a working anacron, so please check your setup and let me know how it differs from mine.

Thanks in advance, ...


Upstart actually uses config files in /etc/init for each service, not /etc/init.d. I assume the /etc/init.d links are there to preserve compatibility with sysvinit. Here's the upstart getting started guide which explains this.

I don't have an ubuntu system so I can't check the contents of /etc/init/anacron.conf, but I suspect from gooling it might just be exec anacron -s. Check in /etc/init.removed/ and see if there is an anacron.conf there that was removed by some upgrade process. You might be able to reinstall anacron to fix this as well.

| improve this answer | |
  • Thanks, this was helpful. I would up-vote your answer, but I need reputation 15 for that. If you up-vote my question, maybe I can up-vote your answer :-) – David Jones Jan 23 '11 at 22:09
  • I found a version of "anacron.conf" in /etc/init.removed, so I moved it back into /etc/init/ – David Jones Jan 23 '11 at 22:13
  • If my answer worked, please accept it. You can do that with any amount of reputation, separate from upvoting it. – Phil Hollenback Jan 23 '11 at 22:15

Ubuntu 10.04 /etc/cron.d/anacron:

# /etc/cron.d/anacron: crontab entries for the anacron package


#30 7    * * *   root   test -x /etc/init.d/anacron && /usr/sbin/invoke-rc.d anacron start >/dev/null
30 7    * * *   root    start -q anacron || :

/etc/init.d/anacron start:

# /etc/init.d/anacron start
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service anacron start

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the start(8) utility, e.g. start anacron

# ls -al /etc/init.d/anacron 
lrwxrwxrwx 1 root root 21 2011-01-10 19:05 /etc/init.d/anacron -> /lib/init/upstart-job
anacron start/running, process 5446

/etc/cron.daily/logrotate can be started without anacron, when /usr/sbin/anacron not existed(/etc/crontab):

25 6    * * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6    * * 7   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6    1 * *   root    test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
| improve this answer | |
  • The source of my trouble was a missing /etc/init/anacron.conf, which I was able to recover from /etc/init.removed/anacron.conf – David Jones Jan 23 '11 at 22:25
  • After restoring /etc/init/anacron.conf the command "/etc/init.d/anacron start" works, ... though it does suggest using "start anacron" instead. But both seem to work. – David Jones Jan 23 '11 at 22:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.