anacron does not execute cron.daily jobs if system is suspended between 6 and 8 am

Bug #411796 reported by Mikko Rantalainen
This bug affects 4 people
Affects Status Importance Assigned to Milestone
anacron (Ubuntu)

Bug Description

Binary package hint: anacron

The cron.daily jobs are not executed daily (at least update-manager fails to find new updates) if system is suspended (sleeping) between 6 am and 8 am. According to /etc/crontab cron.daily jobs are executed at 06:25 and according to /etc/cron.d/anacron anacron is run daily at 07:30. As a result, daily jobs are not executed if system is suspended over that period of time.

An easy fix would be to change /etc/cron.d/anacron to execute every hour. Such a change should not cause excessive load because 23 or 24 times a day it would simply check the timestamps for the three jobs anacron is handling and exit immediately. Granted, it would do a bit more work than the absolute minimum but it would work for sure. A more advanced fix would execute anacron while returning from suspend or hibernation but that seems to be a bit fragile (see previous bugs where such setup has been broken). I'd suggest implementing both fixes if *automatic* regression testing cannot verify that suspend and hibernation works if the system is suspended during the problematic period.

$ lsb_release -rd
Description: Ubuntu 9.04
Release: 9.04

$ apt-cache policy anacron
  Installed: 2.3-13.1ubuntu6
  Candidate: 2.3-13.1ubuntu6
  Version table:
 *** 2.3-13.1ubuntu6 0
        500 jaunty/main Packages
        100 /var/lib/dpkg/status

See also / possibly related to:
bug 399863
bug 366119
bug 208792
bug 249220
bug 36816

The suspend is initiated from fast user switching applet (desktop top right by default).

(Why there're so many different suspend scripts? For example, why do not /etc/acpi/suspend.d and /usr/lib/pm-utils/sleep.d contain the same amount of scripts? How about a single location for scripts and simply replace existing locations with a single script (per existing directory) that runs the new scripts in correct location in correct order.)

Revision history for this message
Mikko Rantalainen (mira) wrote :

It just occurred to me that update-manager could fail after resume from suspend if network manager cannot get the network up immediately and update-manager skips looking for the updates if network is down at the moment it looks for daily update. Perhaps update-manager should be smarter to make sure that daily updates get complete daily there's daily connection to internet?

Changed in anacron (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
fx5 (packaging) wrote :

I can confirm this bug in 9.04. In fact there is a pm-handler in file /usr/lib/pm-utils/sleep.d/95anacron
but unfortunately it does not work correctly. I tried to find out why:

* Anacron is started correcty.
* It detects the TO-DO-JOBS
* It sets alarm(300), which is the time to wait for cron.daily
* Tries rt_sigsuspend()
* Gets ERESTARTNOHAND and terminates.

Maybe a kernel-bug? When I start the pm-utils-handly by myself, everything works.

strace of failed anacron-start:

time(NULL) = 1253183686
alarm(300) = 0
rt_sigprocmask(SIG_BLOCK, NULL, [USR1 ALRM CHLD], 8) = 0
rt_sigsuspend([]) = ? ERESTARTNOHAND (To be restarted)
--- SIGTERM (Terminated) @ 0 (0) ---

uname -r

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.