Bug 1757726 - logrotate no longer runs by default after installation
Summary: logrotate no longer runs by default after installation
Keywords:
Status: CLOSED CANTFIX
Alias: None
Product: Fedora
Classification: Fedora
Component: logrotate
Version: 30
Hardware: All
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Kamil Dudka
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-10-02 09:49 UTC by Ian Donaldson
Modified: 2020-01-06 13:35 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-01-06 13:35:52 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ian Donaldson 2019-10-02 09:49:18 UTC
Description of problem:

If you install logrotate you find that it doesn't run by default anymore

Version-Release number of selected component (if applicable):

logrotate-3.15.1-1.fc30.x86_64


How reproducible:

100%

Steps to Reproduce:
1. dnf install logrotate
2. come back 24H later
3. note no logs rotated; /var/lib/logrotate is empty

Actual results:

nothing happens

Expected results:

log files rotated

Additional info:

Prior to fc30, when you installed logrotate it created an entry in /etc/cron.daily which caused it to run from then on.

The fc30 package doesn't create this cron entry; it installs a systemd
timer instead but doesn't activate it by default.

/usr/lib/systemd/system/logrotate.service
/usr/lib/systemd/system/logrotate.timer

This requires you to do this after installing logrotate:

systemctl enable logrotate.timer
systemctl start logrotate.timer

Whilst this is an easy workaround, its not backwards compatible with 
prior package behavior, where installation also causes activation,
although arguably other packages tend to not auto enable daemons at systemd
upon install.

I've had to update all my kickstart scripts for this, and also run
around to all fc30 systems I installed months ago and retrospectively
enable logrotate.  (only noticed lack of rotation today when a system
started to run out of disk space)

Systems that were distro-sync upgraded from fc29 to fc30 did however 
end up with logrotate running ok; presumably the upgrade script
did the enabling as part of the upgrade.

Comment 1 Kamil Dudka 2019-10-02 10:23:04 UTC
(In reply to Ian Donaldson from comment #0)
> Prior to fc30, when you installed logrotate it created an entry in
> /etc/cron.daily which caused it to run from then on.

Only if you had any cron daemon configured.

> The fc30 package doesn't create this cron entry; it installs a systemd
> timer instead but doesn't activate it by default.
> 
> /usr/lib/systemd/system/logrotate.service
> /usr/lib/systemd/system/logrotate.timer

Yes, this is expected.

> This requires you to do this after installing logrotate:
> 
> systemctl enable logrotate.timer
> systemctl start logrotate.timer

There is no easy solution to this.  If we enabled logrotate.timer in vendor preset, logrotate would be run unexpectedly on installations where it did not run originally (where cron was not configured).

> Systems that were distro-sync upgraded from fc29 to fc30 did however 
> end up with logrotate running ok; presumably the upgrade script
> did the enabling as part of the upgrade.

Only if you had any cron daemon configured:

https://src.fedoraproject.org/rpms/logrotate/blob/07f59cae/f/logrotate.spec#_93

Comment 2 Ian Donaldson 2019-10-02 11:57:41 UTC
Sure; forgive me I have never come across a *ix system without cron installed; its pretty fundamental; but
I guess there are systems that are setup that way.

Comment 3 Kamil Dudka 2019-10-02 12:13:20 UTC
The related Fedora documentation does not seem to assume cron is always installed:

https://docs.fedoraproject.org/en-US/fedora/f30/system-administrators-guide/monitoring-and-automation/Automating_System_Tasks/

Comment 4 Kamil Dudka 2020-01-06 13:35:52 UTC
It is unclear how this could be improved without introducing any unwanted side-effects.  Closing...


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