[Bug 810736] Re: logrotate script needs to notify all samba processes when logs are rotated

Andreas Hasenack andreas at canonical.com
Thu Aug 10 20:05:36 UTC 2017


I just saw this bug while merging Debian's latest samba into ubuntu,
because it had this changelog snippet:

  * Fix logrotate for /var/log/samba/log.samba to send SIGHUP to all processes
    of the service (systemd only)

The logrotate script now uses smbcontrol <smbd|nmbd> reload-config (not
"all", which isn't listed as a valid destination in the current
smbcontrol help output [v4.6.5]), but I still see the problem happening.
This is after a forced logrotate:

root at artful-samba-merge:/var/log/samba# fuser log*
/var/log/samba/log.:  8841
/var/log/samba/log.nmbd:  7177
/var/log/samba/log.nmbd.1:  8841
/var/log/samba/log.smbd:  7132  7140
/var/log/samba/log.smbd.1:  7133  7134  8841
/var/log/samba/log.wb-ARTFUL-SAMBA-MERGE:  6997  8841
/var/log/samba/log.wb-BUILTIN:  7138  8841
/var/log/samba/log.winbindd:  6996  8841
/var/log/samba/log.winbindd-idmap:  7137  8841

root at artful-samba-merge:/var/log/samba# smbcontrol smbd reload-config

root at artful-samba-merge:/var/log/samba# fuser log*
/var/log/samba/log.:  8841
/var/log/samba/log.nmbd:  7177
/var/log/samba/log.nmbd.1:  8841
/var/log/samba/log.smbd:  7132  7140
/var/log/samba/log.smbd.1:  7133  7134  8841
/var/log/samba/log.wb-ARTFUL-SAMBA-MERGE:  6997  8841
/var/log/samba/log.wb-BUILTIN:  7138  8841
/var/log/samba/log.winbindd:  6996  8841
/var/log/samba/log.winbindd-idmap:  7137  8841


The rotated log files are still kept open by smbd processes. I'll add the server-next tag to this bug to take a look at this in more detail soon.

** Tags added: server-next

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to samba in Ubuntu.
https://bugs.launchpad.net/bugs/810736

Title:
  logrotate script needs to notify all samba processes when logs are
  rotated

Status in samba package in Ubuntu:
  Confirmed

Bug description:
  After the log rotation, logrotate needs to notify all samba processes
  to release their open file descriptors on the log files.

  The current logrotate configuration file does not do so and only notify the process that has it's PID stored /var/run/samba/.
  This is wrong as other child will keep logging to the "deleted" files and may use all the disk space. Those "deleted" files are not showing in ls output but they are still consuming space in the file system.

  I think the right solution to this bug would be to have logrotate to
  call "smbcontrol all reload-config". This solution was proposed by
  Andrew Bartlett, a Samba developer, in this email
  http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=160076#25. The
  smbcontrol utility will notify all related daemons (smbd, nmbd and
  winbindd) and their child processes to re-open a new log file.

  I have confirmed that this problem affects Samba from Lucid to Natty
  at least.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/samba/+bug/810736/+subscriptions



More information about the foundations-bugs mailing list