Bug 1655153 - logrotate should use systemd timer unit instead of cron.daily
Summary: logrotate should use systemd timer unit instead of cron.daily
Alias: None
Product: Fedora
Classification: Fedora
Component: logrotate
Version: 28
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
Depends On:
TreeView+ depends on / blocked
Reported: 2018-11-30 19:04 UTC by Theodore Cowan
Modified: 2020-03-19 19:57 UTC (History)
8 users (show)

Fixed In Version: logrotate-3.15.0-1.fc30
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1177286
Last Closed: 2018-12-04 15:55:35 UTC
Type: Bug

Attachments (Terms of Use)

System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1502085 0 unspecified CLOSED logrotate permission denied under systemd with selinux 2021-02-22 00:41:40 UTC

Internal Links: 1502085

Description Theodore Cowan 2018-11-30 19:04:45 UTC
+++ This bug was initially created as a clone of Bug #1177286 +++

There is no need for logrotate to use cron.daily. The same can be accomplished with a systemd timer unit.

--- Additional comment from Jan Kaluža on 2015-07-23 03:12:45 EDT ---

That would be against Packaging Guidelines:

Packages which do not already depend or require systemd must not use timer units but instead depend and have requirement on crontabs, to avoid introducing unnecessary new dependencies on systemd directly.

Closing as WONTFIX.

--- Additional comment from Theodore Cowan on 2018-11-30 14:03:16 EST ---

It's time to re-evaluate this.  crond isn't even installed on cloud images of Fedora 28+ and systemd is ubiquitous.

logrotate should take on cronie as a dependency or user systemd-timer.

Comment 1 Theodore Cowan 2018-11-30 19:07:34 UTC

Debian/Ubuntu has reportedly already made this change.

Comment 2 Kamil Dudka 2018-12-02 20:43:11 UTC
There is currently a pull request under review to address this:


Comment 3 Kamil Dudka 2018-12-04 15:55:35 UTC
downstream commit:


Comment 4 Colin Walters 2020-01-31 15:43:34 UTC
As implemented today, this also means that logrotate isn't enabled on new installs; was that intentional?

Comment 6 Kamil Dudka 2020-01-31 16:13:44 UTC
Yes, it is a trade-off.  logrotate used to unconditionally install the cron hook but it took effect only when cron was actually installed and enabled.  We cannot use this logic with systemd any more because systemd is always installed.  So we made our best to preserve the behavior on updates but the timer is not enabled on fresh Fedora installations now.

Are you suggesting that we enable logrotate timer by default whenever logrotate is installed?

There can be Fedora installations that include logrotate but trigger it by other means (or do not trigger it at all).

In any case, the first chance when we can safely change this is Fedora 32 I am afraid.

Comment 7 Dusty Mabe 2020-03-17 15:14:20 UTC
So should we make the change for Fedora 32?

Comment 8 Kamil Dudka 2020-03-17 16:24:32 UTC
Which change?  Do you mean to enable the logrotate systemd timer by default on all Fedora installations that include the logrotate package?

Comment 9 Edgar Hoch 2020-03-17 21:21:51 UTC
Logrotate prevents /var (and possibly other partitions) from running out of space due to ever-growing log files. This is a problem for nearly any system, from desktops to notebooks and servers.

So, yes, I think it is a good idea to start it by default, because I think it fits for the average user. I was surprised that log files was so big and contains very old log on current Fedora version because I found logrotate installed and expected it to run regularly. I didn't know that it has changed and I have to enable it manually now.

I think systems with special needs have an administrator who can adjust or disable logrotate if necessary.

Comment 10 Dusty Mabe 2020-03-17 21:37:46 UTC
(In reply to Kamil Dudka from comment #8)
> Which change?  Do you mean to enable the logrotate systemd timer by default
> on all Fedora installations that include the logrotate package?

correct, that is what I meant.

Comment 12 Kamil Dudka 2020-03-19 19:57:02 UTC
logrotate should now be enabled by default in Fedora rawhide:


Note You need to log in before you can comment on or make changes to this bug.