← Back to team overview

enterprise-support team mailing list archive

[Bug 1883489] [NEW] Logrotate failed to start in LUbuntu 20.04

 

You have been subscribed to a public bug:

After fresh installation of LUbuntu 20.04, when I switched off Plymouth,
failure of logrotate appeared on the screen during boot.

(PIDs are replaced by ***)
:~$ systemctl status logrotate
● logrotate.service - Rotate log files
     Loaded: loaded (/lib/systemd/system/logrotate.service; static; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2020-06-15 07:56:59 EEST; 32s ago
TriggeredBy: ● logrotate.timer
       Docs: man:logrotate(8)
             man:logrotate.conf(5)
    Process: *** ExecStart=/usr/sbin/logrotate /etc/logrotate.conf (code=exited, status=1/FAILURE)
   Main PID: *** (code=exited, status=1/FAILURE)

Jun 15 07:56:55 ******** systemd[***]: Starting Rotate log files...
Jun 15 07:56:59 ******** logrotate[***]: error: error running shared postrotate script for '/var/log/mysql.log /var/log/mysql/*log '
Jun 15 07:56:59 ******** systemd[***]: logrotate.service: Main process exited, code=exited, status=1/FAILURE
Jun 15 07:56:59 ******** systemd[***]: logrotate.service: Failed with result 'exit-code'.
Jun 15 07:56:59 ******** systemd[***]: Failed to start Rotate log files.

I compared /etc/logrotate.d/samba with the information at https://salsa.debian.org/samba-team/samba/commit/bed29aba47558252eacfe9453d23cc1ab29770aa
Two different lines have been found:

In /etc/logrotate.d/samba:

line 6: [ ! -x /usr/bin/smbcontrol ] || [ ! -f /run/samba/smbd.pid ] ||
/usr/bin/smbcontrol smbd reload-config

line 18: [ ! -x /usr/bin/smbcontrol ] || [ ! -f /run/samba/nmbd.pid ] ||
/usr/bin/smbcontrol nmbd reload-config

at https://...

line 6: [ ! -x /usr/bin/smbcontrol ] || [ ! -f /var/run/samba/nmbd.pid ]
|| /usr/bin/smbcontrol nmbd reload-config

line 18: [ ! -x /usr/bin/smbcontrol ] || [ ! -f /var/run/samba/nmbd.pid
] || /usr/bin/smbcontrol nmbd reload-config

There is a same difference: in LUbuntu 20.04 .pid files are searched in
/run/samba/, but at https://... they are searched in /var/run/samba/.
After boot, both are present and have the same PIDs.

:~$ cat /var/run/samba/nmbd.pid
abcd
:~$ cat /run/samba/nmbd.pid
abcd
:~$ cat /var/run/samba/smbd.pid
efgh
:~$ cat /run/samba/smbd.pid
efgh

(digits are replaced by letters for security reasons)

Changing the folders according to https://... and reboot solve the
problem:

:~$ systemctl status logrotate
● 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)

After that, I tried to revert the changes and reboot. The bug cannot be
reproduced anymore.

Additional information:

:~$ lsb_release -rd
Description:    Ubuntu 20.04 LTS
Release:        20.04
:~$ apt-cache policy logrotate
logrotate:
  Installed: 3.14.0-4ubuntu3
  Candidate: 3.14.0-4ubuntu3
  Version Table:
 *** 3.14.0-4ubuntu3 500
        500 http://archive.ubuntu.com/ubuntu focal/main amd64 Packages
        100 /var/lib/dpkg/status

Finally, the solution for me is:

sudo <installed text editor> /etc/logrotate.d/samba

Replace the following line (for me, line 6)

[ ! -x /usr/bin/smbcontrol ] || [ ! -f /run/samba/smbd.pid ] ||
/usr/bin/smbcontrol smbd reload-config

by

[ ! -x /usr/bin/smbcontrol ] || [ ! -f /var/run/samba/nmbd.pid ] ||
/usr/bin/smbcontrol nmbd reload-config

and the following line (for me, line 18)

[ ! -x /usr/bin/smbcontrol ] || [ ! -f /run/samba/nmbd.pid ] ||
/usr/bin/smbcontrol nmbd reload-config

by

[ ! -x /usr/bin/smbcontrol ] || [ ! -f /var/run/samba/nmbd.pid ] ||
/usr/bin/smbcontrol nmbd reload-config

Save and reboot.

But there are two question.
Is it necessary to check both .pid files (both are present after boot), if yes, what operator should be used, || or && ?

Is it necessary to correct line 32: "elif [ -f /run/samba/samba.pid ];
then"? I did not correct it.

Because of a short time after installation, it is not tested, are the
log files rotated or not.

ProblemType: Bug
DistroRelease: Ubuntu 20.04
Package: logrotate 3.14.0-4ubuntu3
Uname: Linux 5.6.0-18.1-liquorix-amd64 x86_64
ApportVersion: 2.20.11-0ubuntu27.2
Architecture: amd64
CasperMD5CheckResult: skip
CurrentDesktop: LXQt
Date: Mon Jun 15 08:43:08 2020
InstallationDate: Installed on 2020-05-30 (15 days ago)
InstallationMedia: Lubuntu 20.04 LTS "Focal Fossa" - Release amd64 (20200423)
SourcePackage: logrotate
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: samba (Ubuntu)
     Importance: Undecided
         Status: Confirmed


** Tags: amd64 apport-bug focal logrotate patch
-- 
Logrotate failed to start in LUbuntu 20.04
https://bugs.launchpad.net/bugs/1883489
You received this bug notification because you are a member of Ubuntu Server/Client Support Team, which is subscribed to samba in Ubuntu.