Logrotate failed to start in LUbuntu 20.04
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mysql-8.0 (Ubuntu) |
Expired
|
Undecided
|
Unassigned |
Bug Description
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/
Active: failed (Result: exit-code) since Mon 2020-06-15 07:56:59 EEST; 32s ago
TriggeredBy: ● logrotate.timer
Docs: man:logrotate(8)
Process: *** ExecStart=
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.
Two different lines have been found:
In /etc/logrotate.
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/
line 18: [ ! -x /usr/bin/smbcontrol ] || [ ! -f /var/run/
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/
abcd
:~$ cat /run/samba/nmbd.pid
abcd
:~$ cat /var/run/
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/
Active: inactive (dead)
TriggeredBy: ● logrotate.timer
Docs: man:logrotate(8)
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://
100 /var/lib/
Finally, the solution for me is:
sudo <installed text editor> /etc/logrotate.
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/
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/
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/
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.
ApportVersion: 2.20.11-0ubuntu27.2
Architecture: amd64
CasperMD5CheckR
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: | logrotate (Ubuntu) → samba (Ubuntu) |
affects: | samba (Ubuntu) → mysql-8.0 (Ubuntu) |
Nice writing down of the problem. Solution is also provided. Details are also provided for the bug fixer.