Bug#752376: Bug#758034: apticron: ok to Depend on cron-daemon rather than cron?

Lorenzo lory.fulgi at infinito.it
Mon Sep 1 15:55:09 BST 2014


On 08/31/2014 03:58 PM, Alexandre Detiste wrote:
>>> I'm not a fan of systemd-cron(*); I was going to ask to switch the
>>> dependency from cron to cron-daemon, but that wouldn't be feasible because
>>> systemd-cron is a __broken__ replacement for cron (until bug 752376 is
>>> fixed), so I proposed running apticron in cron.daily to work around that
>>> issue.
>>>
>>> Since it's systemd-cron's fault:
>>> - the "clean" solution would be to depend on cron-daemon with a note
>>> (changelog, "Breaks:", whatever) that systemd-cron needs to be fixed
>
> Hi,
>
> systemd-cron is indeed now a broken replacement for cron
> and should be replaced by something that combines the functionality
> of systemd-cron that provides /etc/cron.[hourly|daily|weekly|monthly]/
> & systemd-crontab-generator (not yet packaged) that processes /etc/cron.d/ (Debian packages' crontabs)
> and /var/spool/cron/crontabs/* (user crontabs ).
>
> Then, the file /etc/crontab would then not contains theses standard "boilerplate" lines anymore
>> 17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
>> 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 )
> and will be empty by default.
Uh? I'm not sure I understand you here - would it be only with 
systemd-cron, or is systemd itself taking over anacron?
If I'm using another cron implementation, I will still need those lines, 
right?

>
> This also need systemd >  212 for the "Persistent=true" feature.
> and 214 has just arrived last week in experimental
> so there is still hope that it goes in Jessie.
>
> I don't think this fits the needs of both current upstreams,
> so I'll come with my own proposal.
>
> This would provide both cron-daemon & virtual package anacron .
>
> (It seems basically impossible to makes a cron based on systemd co-exist with anacron.)
>
> Upstream repositories:
> https://github.com/dbent/systemd-cron
> https://github.com/kstep/systemd-crontab-generator
>
>
Yep, it was in the original bug report - my fault, I only thought of 
CC'ing you later.
Imho systemd-cron should stop providing cron-daemon until "sudo apt-get 
install systemd-cron" results in a system with the crontab generator 
installed and working, but I'm probably biased against systemd :)



Btw, I was thinking that there's another possible solution to this bug: 
since /etc/cron.d/apticron runs every hour at some "urandom" minute, and 
checks a timestamp file to make sure it's not running more than once per 
day, couldn't it just run from /etc/cron.hourly?
That should work even under systemd-cron, and it could __possibly__ be 
combined with a couple of additions to the --cron option:
- sleep a random amount of time, up to an hour (since cron.hourly runs 
at a fixed minute every hor)
- flock(1) a file in /var/lock, to make sure there can never be two 
instances running (I don't remember when debian switched to /run/lock, 
so/var/lock should be safer)

Criticism/better solutions welcome!



More information about the Pkg-systemd-maintainers mailing list