The *logrotate* utility now saves status to the `/var/lib/logrotate/` directory
Previously, the *logrotate* utility saved status to the `/var/lib/logrotate.status` file. Consequently, *logrotate* did not work on systems where `/var/lib` was a read-only file system. With this update, the status file has been moved to the new `/var/lib/logrotate/` directory, which can be mounted with write permissions. As a result, *logrotate* now works on systems where `/var/lib` is a read-only file system.
Description of problem:
Please see https://bugzilla.redhat.com/show_bug.cgi?id=625034 and
https://bugzilla.redhat.com/show_bug.cgi?id=1127415 for history.
Basically in 625034 the rewriting of the status file was was changed
from a simple open to and write to an open a temporary file, write,
and if all writes are successful, reanme to the real state file due
to problems caused when the root FS was full.
Then came 1127415 (opened against Fedora) because in fixing 625034,
we messed up running on a RO root FS system. Unfortunately, this
case was closed without being fixed because the Fedora version it
was filed against went EOL before the fix could get in, and it was
never changed to the next version.
The /etc/rwtab has:
in it, but you can't create /var/lib/logrotate.status.tmp (read only
FS), and even if you were to add:
to the rwtab, you wouldn't be able to rename that file to
/var/lib/logrotate.status once written. We need to change the default
status file from /var/lib/logrotate.status to /var/lib/logrotate/status
and then change this status file's entry in /etc/rwtab to:
so that logrotate can work with RO root FSes again.
Version-Release number of selected component (if applicable):
Whatever the latest RHEL7 version is.
Steps to Reproduce:
1. Install a proper RO root RHEL7 system.
2. Try running logrotate in the usual way.
3. Get some popcorn (optional).
4. Sit back and enjoy the show.
Logrotate fails with "error creating output file
/var/lib/logrotate.status.tmp: Read-only file system"
Logrotate should work. :-)
Please leave this BZ public so the customer can follow it. So far there
is no non-public information in it. Please keep it that way, or if non-public information must be put in, please just do so in a private comment.
This is already done in Fedora and could be backported to rhel7.
The package should own the directory in which logrotate.status is located:
# rpm -qf /var/lib/logrotate/
file /var/lib/logrotate is not owned by any package
# rpm -qf /var/lib/logrotate/logrotate.status
(In reply to Milos Malik from comment #7)
> The package should own the directory in which logrotate.status is located:
> # rpm -qf /var/lib/logrotate/
> file /var/lib/logrotate is not owned by any package
> # rpm -qf /var/lib/logrotate/logrotate.status
fixed in logrotate-3.9.2-4.fc25
*** Bug 1325458 has been marked as a duplicate of this bug. ***
*** Bug 1383655 has been marked as a duplicate of this bug. ***
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.
For information on the advisory, and where to find the updated
files, follow the link below.
If the solution does not work for you, open a new bug report.