logrotate.service fails because it starts before winbind.service

Bug #1953719 reported by R. Diez
14
This bug affects 3 people
Affects Status Importance Assigned to Milestone
logrotate (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

I have started to play with Prometheus on my Ubuntu 20.04.3. You can configure Prometheus to alert you when a systemd service fails, and in this way I noticed a problem with the logrotate.service immediately after booting the system.

I looked with Cockpit, and Cockpit was reporting logrotate.service as "Failed to start". This is the log for logrotate.service :

----8<----8<----8<----
Dez 09 08:00:56 rdiez3 systemd[1]: Starting Rotate log files...
Dez 09 08:00:58 rdiez3 logrotate[1760]: Can't find pid for destination 'winbindd'
Dez 09 08:00:58 rdiez3 logrotate[1069]: error: error running non-shared postrotate script for /var/log/samba/log.winbindd of '/var/log/samba/log.winbindd '
Dez 09 08:00:58 rdiez3 systemd[1]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Dez 09 08:00:58 rdiez3 systemd[1]: logrotate.service: Failed with result 'exit-code'.
Dez 09 08:00:58 rdiez3 systemd[1]: Failed to start Rotate log files.
----8<----8<----8<----

I then looked at winbind.service , which was fine:

----8<----8<----8<----
Dez 09 08:01:01 rdiez3 systemd[1]: Starting Samba Winbind Daemon...
Dez 09 08:01:01 rdiez3 systemd[1]: Started Samba Winbind Daemon.
----8<----8<----8<----

But I noticed that winbind.service started after logrotate.service . I wonder whether this is a service dependency issue.

I am using this PC only during normal working hours, and logrotate.timer is set to run at midnight, when the computer will never be turned on.

The worry is that this problem could effectively cause the complete log rotation to stop working.

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in logrotate (Ubuntu):
status: New → Confirmed
Revision history for this message
Harvald (harvald) wrote :

Command: /usr/bin/smbcontrol winbindd reload-config
return value 1 if there is no winbind process.

I believe solution maybe to change in /etc/logrotate.d/winbind
from

        postrotate
                if [ -x /usr/bin/smbcontrol ]; then
                        /usr/bin/smbcontrol winbindd reload-config
                elif [ -f /run/samba/winbindd.pid ]; then
                        kill -HUP `cat /run/samba/winbindd.pid`
                fi
        endscript

to

        postrotate
                if [ -f /run/samba/winbindd.pid ]; then
                        if [ -x /usr/bin/smbcontrol ]; then
                                /usr/bin/smbcontrol winbindd reload-config
                        else
                                kill -HUP `cat /run/samba/winbindd.pid`
                        fi
                fi
        endscript

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.