The officially official Devuan Forum!

You are not logged in.

#1 2017-03-24 23:51:48

GNUser
Member
Registered: 2017-03-16
Posts: 443  

[SOLVED] anacron hangs on battery power

I'm creating this post in the hope that it helps others with this problem, as it took me a long time to solve.

I installed anacron on my Devuan Jessie laptop. I want anacron to run regardless of whether my laptop is plugged in to AC power or running on battery. I dutifully edited /etc/default/anacron with my favorite text editor and changed "ANACRON_RUN_ON_BATTERY_POWER=no" to "ANACRON_RUN_ON_BATTERY_POWER=yes".

If I'm on battery and boot my laptop or resume from suspend, anacron starts as expected and fools you into thinking that all is well:

bruno@devuan:~$ sudo grep anacron /var/log/syslog
Mar 24 13:32:12 bruno anacron[1596]: Will run job `cron.daily' in 5 min.
Mar 24 13:32:12 bruno anacron[1596]: Will run job `cron.weekly' in 10 min.
Mar 24 13:32:12 bruno anacron[1596]: Will run job `cron.monthly' in 15 min.
Mar 24 13:32:12 bruno anacron[1596]: Jobs will be executed sequentially

THE PROBLEM
The problem is that if I'm on battery power, anacron never actually runs any jobs--it says that it will (as you can see in syslog), but it just hangs indefinitely and never actually does anything. Here's another look at the syslog, hours later:

bruno@devuan:~$ sudo grep anacron /var/log/syslog
Mar 24 13:32:12 bruno anacron[1596]: Will run job `cron.daily' in 5 min.
Mar 24 13:32:12 bruno anacron[1596]: Will run job `cron.weekly' in 10 min.
Mar 24 13:32:12 bruno anacron[1596]: Will run job `cron.monthly' in 15 min.
Mar 24 13:32:12 bruno anacron[1596]: Jobs will be executed sequentially

Looking at the timestamps in /var/spool/anacron confirms that no jobs were run.

THE SOLUTION
Such "silent errors" are so tough to solve! I tried everything under the sun and eventually got this idea from somewhere:

$ sudo chmod a-x /usr/lib/pm-utils/power.d/anacron

BINGO! Once that wicked script is no longer executable, anacron runs its jobs when it says it will--even on battery power. Here's what syslog shows 16 minutes after a reboot while running on battery:

bruno@devuan:~$ sudo grep anacron /var/log/syslog
Mar 24 18:32:12 bruno anacron[1596]: Will run job `cron.daily' in 5 min.
Mar 24 18:32:12 bruno anacron[1596]: Will run job `cron.weekly' in 10 min.
Mar 24 18:32:12 bruno anacron[1596]: Will run job `cron.monthly' in 15 min.
Mar 24 18:32:12 bruno anacron[1596]: Jobs will be executed sequentially
Mar 24 18:37:12 bruno anacron[1596]: Job `cron.daily' started
Mar 24 18:37:12 bruno anacron[2716]: Updated timestamp for job `cron.daily' to 2017-03-24
Mar 24 18:37:15 bruno anacron[1596]: Job `cron.daily' terminated
Mar 24 18:42:12 bruno anacron[1596]: Job `cron.weekly' started
Mar 24 18:42:12 bruno anacron[2895]: Updated timestamp for job `cron.weekly' to 2017-03-24
Mar 24 18:42:12 bruno anacron[1596]: Job `cron.weekly' terminated
Mar 24 18:47:12 bruno anacron[1596]: Job `cron.monthly' started
Mar 24 18:47:12 bruno anacron[2980]: Updated timestamp for job `cron.monthly' to 2017-03-24
Mar 24 18:47:12 bruno anacron[1596]: Job `cron.monthly' terminated
Mar 24 18:47:12 bruno anacron[1596]: Normal exit (3 jobs run)

Last edited by GNUser (2017-03-27 16:05:58)

Offline

Board footer