anacron does not execute cron.daily on start or restart

Bug #1666875 reported by adin
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
anacron (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I have an Ubuntu 16.10, setup with a cron.daily script. If I run the script manually and with run-parts it works. Also, if I left the computer on, then the script is run correctly.

However, if I turn off the computer and turn it on after the set anacron executing time (by default 7:30) then the cron.daily is never executed.

System info:

$ lsb_release -rd
Description: Ubuntu 16.10
Release: 16.10

$ apt-cache policy anacron
anacron:
  Installed: 2.3-23
  Candidate: 2.3-23
  Version table:
 *** 2.3-23 500
        500 http://br.archive.ubuntu.com/ubuntu yakkety/main amd64 Packages
        100 /var/lib/dpkg/status

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in anacron (Ubuntu):
status: New → Confirmed
Revision history for this message
Cliff Carson (ccarson1) wrote :

Believe this is occurring on my 18.10 system running anacron 2.3-24.

Revision history for this message
Cliff Carson (ccarson1) wrote :

Don't fully understand the interaction between systemd-anacron-cron but in my system at boot systemd starts multi-user.target-wants/anacron.service calling anacron -dsq which should kick off a job to rotate the logs. This doesn't get started because of the ConditionACPower=true in the anacron.service file. Since always start my laptop on battery the condition is never met. Unsure of what event/process is supposed call anacron.service when the power cable is plugged or after it is plugged other than a reboot. Going to remove this condition from the anacron.service file.

Revision history for this message
Cliff Carson (ccarson1) wrote :

Removing the ConditionACPower didn't help. Still believe that systemd starting the anacron job is the only way to get logrotate to run. If the anacron.service runs the only thing it appears to do is to run 0anacron which runs anacron -u. This only sets the date in /var/spool/anacron/cron.daily to the current date. systemd will start anacron after the first boot of the day and the system has AC power. Rebooting the system after the first boot fail to have systemd start anacron. Don't yet understand that. Going to run logrotate manually for now.

Revision history for this message
mk (mk.pmb) wrote :

The original systemd service file may be restored on system update. Rather, make an override file /etc/systemd/system/anacron.service.d/on-ac.conf with

> [Unit]
> ConditionACPower=no

to make systemd always start anacron. However that doesn't help if anacron will then just flinch, so ensure in /etc/default/anacron:

> ANACRON_RUN_ON_BATTERY_POWER=yes

Hope it helps!

Revision history for this message
mk (mk.pmb) wrote :

Sorry for my misleading earlier post. Both parts were wrong.
1. ConditionACPower=no means to run on battery only; to ignore AC, it must be empty.
2. The ANACRON_RUN_ON_BATTERY_POWER flag has no effect when anacron is launched via systemd.

So in conclusion, it was mere coincidence that my approach had seemed to solve the problem.

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

Other bug subscribers

Remote bug watches

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