Logrotate service fails

Hi,

has anyone also encountered the problem, that the logrotate service fails because it doesn’t have permission for /var/log/boot.log?

➜  log systemctl status logrotate
× logrotate.service - Rotate log files
     Loaded: loaded (/usr/lib/systemd/system/logrotate.service; static)
    Drop-In: /usr/lib/systemd/system/service.d
             └─10-timeout-abort.conf
     Active: failed (Result: exit-code) since Mon 2025-05-26 16:05:41 CEST; 3min 40s ago
 Invocation: <is this id sensitive?>
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
    Process: 1162142 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
   Main PID: 1162142 (code=exited, status=1/FAILURE)
   Mem peak: 3.4M
        CPU: 29ms

Mai 26 16:05:41 <system-name> systemd[1]: Starting logrotate.service - Rotate log files...
Mai 26 16:05:41 <system-name> logrotate[1162142]: error: stat of /var/log/boot.log failed: Keine Berechtigung
Mai 26 16:05:41 <system-name> systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Mai 26 16:05:41 <system-name> systemd[1]: logrotate.service: Failed with result 'exit-code'.
Mai 26 16:05:41 <system-name> systemd[1]: Failed to start logrotate.service - Rotate log files.

I think this is down to selinux. I am seeing messages from setroubleshoot containing logrotate but I always set selinux mode to permissive.

This is not just a Ublue or Fedora thing. In my experience there are way too many things that are package in a distro that don’t work properly because of selinux.

Anyway, rant over, set it to permissive in /etc/selinux/config and move on with life!

You can check the permissions using ls -Z:

❯ ls -Z /var/log/boot.log
system_u:object_r:var_t:s0  /var/log/boot.log

If it isn’t right, you can restore the correct SELinux permissions using the restorecon command:

sudo restorecon -v /var/log/boot.log

ref

1 Like

I didn’t realize but I am having the same problem.

Thanks, @JohnAtl - your suggestion produced the following results:

$ sudo restorecon -v /var/log/boot.log
[sudo] password prompt for klmcw:
Relabeled /var/log/boot.log from system_u:object_r:var_t:s0 to system_u:object_r:plymouthd_var_log_t:s0

After systemctl restart logrotate.service all is green.

Thanks!

3 Likes

Ha! I just checked and I have the same problem.

✦ ❯ ls -Z /var/log/boot.log
system_u:object_r:var_t:s0  /var/log/boot.log

~ via 🐍 v3.13.3 on ☁️  john@company
✦ ❯ sudo restorecon -v /var/log/boot.log
[sudo] password for john: 
Relabeled /var/log/boot.log from system_u:object_r:var_t:s0 to system_u:object_r:plymouthd_var_log_t:s0

Opened an issue.

1 Like

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