[Pkg-samba-maint] Bug#902149: samba: logrotate script should account for services not running

Andreas Hasenack andreas at canonical.com
Fri Jun 22 19:29:23 BST 2018


Package: samba
Version: 2:4.8.2+dfsg-2
Severity: normal

Dear Maintainer,

The logrotate script shipped in /etc/logrotate.d/samba should take
into account the possibility that the services might not be running:

root at sid-samba-48:~# ps fxaw
  PID TTY      STAT   TIME COMMAND
  105 ?        Ss     0:00 bash
 5307 ?        R+     0:00  \_ ps fxaw
    1 ?        Ss     0:00 /sbin/init
   36 ?        Ss     0:00 /lib/systemd/systemd-journald
   72 ?        Ss     0:00 /lib/systemd/systemd-logind
   73 ?        Ss     0:00 /usr/bin/dbus-daemon --system
--address=systemd: --nofork --nopidfile --systemd-activation
--syslog-only
   98 ?        Ss     0:00 /sbin/dhclient -4 -v -pf
/run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases -I -df
/var/lib/dhcp/dhclient6.eth0.leases eth0
  104 console  Ss+    0:00 /sbin/agetty -o -p -- \u --noclear
--keep-baud console 115200,38400,9600 linux
 3691 ?        Ss     0:00 /usr/sbin/cron -f
 4049 ?        Ss     0:00 /usr/sbin/exim4 -bd -q30m
 4432 ?        Ss     0:00 /usr/sbin/smbd --foreground --no-process-group
 4434 ?        S      0:00  \_ /usr/sbin/smbd --foreground --no-process-group
 4435 ?        S      0:00  \_ /usr/sbin/smbd --foreground --no-process-group
 4437 ?        S      0:00  \_ /usr/sbin/smbd --foreground --no-process-group
 4471 ?        Ss     0:00 /usr/sbin/nmbd --foreground --no-process-group
root at sid-samba-48:~# systemctl stop smbd nmbd
root at sid-samba-48:~# logrotate -f /etc/logrotate.d/samba
Can't find pid for destination 'smbd'
error: error running non-shared postrotate script for
/var/log/samba/log.smbd of '/var/log/samba/log.smbd '
Can't find pid for destination 'nmbd'
error: error running non-shared postrotate script for
/var/log/samba/log.nmbd of '/var/log/samba/log.nmbd '
root at sid-samba-48:~# echo $?
1


Suggested simple fix:
--- a/debian/samba.logrotate
+++ b/debian/samba.logrotate
@@ -3,7 +3,7 @@
        missingok
        rotate 7
        postrotate
-               [ ! -x /usr/bin/smbcontrol ] || /usr/bin/smbcontrol
smbd reload-config
+               [ ! -x /usr/bin/smbcontrol ] || [ ! -f
/var/run/samba/smbd.pid ] || /usr/bin/smbcontrol smbd reload-config
        endscript
        compress
        delaycompress
@@ -15,7 +15,7 @@
        missingok
        rotate 7
        postrotate
-               [ ! -x /usr/bin/smbcontrol ] || /usr/bin/smbcontrol
nmbd reload-config
+               [ ! -x /usr/bin/smbcontrol ] || [ ! -f
/var/run/samba/nmbd.pid ] || /usr/bin/smbcontrol nmbd reload-config
        endscript
        compress
        delaycompress



More information about the Pkg-samba-maint mailing list