Failed to start Rotate log files on boot

Hi!

I need help to fix that:

sudo systemctl status logrotate.service

● logrotate.service - Rotate log files
Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-03-20 10:05:39 CET; 22min ago
TriggeredBy: ● logrotate.timer
Docs: man:logrotate(8)
man:logrotate.conf(5)
Process: 2013 ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
Main PID: 2013 (code=exited, status=1/FAILURE)

Mär 20 10:05:39 user systemd[1]: Starting Rotate log files...
Mär 20 10:05:39 user logrotate[2013]: error: error renaming temp state file /var/lib/logrotate/status.tmp
Mär 20 10:05:39 user systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Mär 20 10:05:39 user systemd[1]: logrotate.service: Failed with result 'exit-code'.
Mär 20 10:05:39 user systemd[1]: Failed to start Rotate log files.

How can I fix that error?

> logrotate[2013]: error: error renaming temp state file /var/lib/logrotate/status.tmp

logrotate --version

logrotate 3.14.0

Default mail command:       /usr/bin/mail
Default compress command:   /bin/gzip
Default uncompress command: /bin/gunzip
Default compress extension: .gz
Default state file path:    /var/lib/logrotate/status
ACL support:                yes
SELinux support:            yes

What do you have for the following commands?

ls -ald /var/lib/logrotate
ls -al /var/lib/logrotate/

sudo touch /var/lib/logrotate/test
sudo rm -v /var/lib/logrotate/test

ls -ald /var/lib/logrotate

drwxr-xr-x 2 root root 0 Mär 20 10:56 /var/lib/logrotate

ls -al /var/lib/logrotate/

total 4
drwxr-xr-x 2 root root 0 Mär 20 10:56 .
drwxr-xr-x 65 root root 4096 Nov 29 17:30

sudo touch /var/lib/logrotate/test
sudo rm -v /var/lib/logrotate/test

removed '/var/lib/logrotate/test'

My logrotate.conf: (/etc/logrotate.conf)

weekly
su root adm
rotate 1
create
compress
include /etc/logrotate.d

maybee wrong permission "su root adm"?

Did a test: (before test, permission on /var/lib/logrotate was: root:adm)
Changed the folder /var/lib/logrotate

to root:root

rebooted.

then:

sudo systemctl status logrotate.service

● logrotate.service - Rotate log files
Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
Active: inactive (dead)
TriggeredBy: ● logrotate.timer
Docs: man:logrotate(8)
man:logrotate.conf(5)

sudo systemctl list-units --state=failed

UNIT LOAD ACTIVE SUB DESCRIPTION
0 loaded units listed.

Seems to be working now or?

My 20.10 system has root root.

So you have fixed it :slight_smile:

ok :slight_smile: great :slight_smile:

what about?

My logrotate.conf: (/etc/logrotate.conf)

weekly
su root adm
rotate 1
create
compress
include /etc/logrotate.d

Permission setting in the logrotate.conf "su root adm" is correct?

Yes, as the full configuration file /etc/logrotate.conf has the following comment for this line:

# use the adm group by default, since this is the owning group
# of /var/log/syslog.
su root adm

ok, thanks for your help :slight_smile: @ Norbert_X