Logrotate.timer does not start

It seems that in the development branch, the directory /var/lib/logrotate is missing, which prevents the logrotate timer to start:

● logrotate.service - Rotate log files
     Loaded: loaded (/lib/systemd/system/logrotate.service; static)
     Active: failed (Result: exit-code) since Wed 2021-03-03 08:05:35 CET; 59s ago
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
    Process: 56976 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=3)
   Main PID: 56976 (code=exited, status=3)
        CPU: 29ms

Mar 03 08:05:35 nevermind systemd[1]: Starting Rotate log files...
Mar 03 08:05:35 nevermind logrotate[56976]: error: error creating stub state file /var/lib/logrotate/status: No such file or directory
Mar 03 08:05:35 nevermind systemd[1]: logrotate.service: Main process exited, code=exited, status=3/NOTIMPLEMENTED
Mar 03 08:05:35 nevermind systemd[1]: logrotate.service: Failed with result 'exit-code'.
Mar 03 08:05:35 nevermind systemd[1]: Failed to start Rotate log files.

To fix it, you manually need to create the directory mentioned:

sudo mkdir /var/lib/lograte

Result:

● logrotate.service - Rotate log files
     Loaded: loaded (/lib/systemd/system/logrotate.service; static)
     Active: inactive (dead) since Wed 2021-03-03 08:06:39 CET; 5s ago
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
    Process: 57049 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=0/SUCCESS)
   Main PID: 57049 (code=exited, status=0/SUCCESS)
        CPU: 44ms

Mar 03 08:06:39 nevermind systemd[1]: Starting Rotate log files...
Mar 03 08:06:39 nevermind systemd[1]: logrotate.service: Succeeded.
Mar 03 08:06:39 nevermind systemd[1]: Finished Rotate log files.

Thanks for pointing this out!

logrotate and rsyslog were added as a side effect of us syncing our distro to be much closer to Debian to reduce maintenance. (they were not present in eos3.9 and earlier)
Even though they are present now we don’t actually want them running by default, so I have now adjusted our systemd vendor preset to disable them accordingly - we instead let systemd/journald handle logging for the system.

If you have specific needs for logrotate then you should file this bug upstream and/or with Debian, most services are learning to work with an empty /var these days, that’s how ostree works.

Hello Daniel, thanks for the fix - personally i don’t need logrotate, i am more than happy with journald’s rotation mechanism - just saw the logrotate unit when running systemctl list-units --failed

Why not just remove the rsyslog and logrotate packages from however it’s being built?

There are a few packages that depend on them in Debian, but none that appear installed.

Those packages are “Priority: important” in Debian. As far as I understand it, apt installs them in our image build (& on all normal Debian systems) whether you like it or not , along with other Prio important packages that we probably do want.

We used to fork those two packages to change the priority. We are aggressively pruning our collection of forked packages though, in order to cut down the maintenance overhead, and moving in the direction of Endless being a Debian derivative (or something like that) rather than being its own separate distro. The thinking is that the upside of reducing the maintenance here is larger than the downside of having a couple of redundant packages kicking around but not causing any trouble.

Let me know if you can see a better way of handling this!

In Ubuntu we used https://wiki.ubuntu.com/Germinate which has an option to exclude packages. This generates your list of specific packages to include in the image, etc.

If still using debootstrap directly I’d expect –exclude=rsyslog,logrotate to do the trick.

In both cases, it will let you break things badly if the package is actually needed…

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.