When systemd launches samba service, the configuration we have in samba.service expects that the main process (/usr/sbin/samba) would use sd_notify() to report back its status. However, we only use sd_notify() when running become_daemon(). As a result, samba process never reports back its status and the status updates from other daemons (smbd, winbindd, etc) are not accepted as we now have implied NotifyAccess=main since commit d1740fb3d5a72cb49e30b330bb0b01e7ef3e09cc Author: Marcos Mello <marcosfrm@gmail.com> Date: Fri May 8 07:44:51 2020 -0300 Drop NotifyAccess=all from systemd units The implicit NotifyAccess=main is enough since Samba daemons do not fork()/exit() anymore under systemd. Signed-off-by: Marcos Mello <marcosfrm@gmail.com> Reviewed-by: Andreas Schneider <asn@samba.org> Reviewed-by: Alexander Bokovoy <ab@samba.org> This leads to a timeout and killing samba process by systemd. Situation is reproducible in Fedora 33, for example. I think we should change source4/smbd/server.c:binary_smbd_main() from if (opt_daemon) { DBG_NOTICE("Becoming a daemon.\n"); become_daemon(opt_fork, opt_no_process_group, false); } .... if (opt_daemon) { daemon_ready("samba"); } to the code that still reports its status to the systemd: if (opt_daemon) { DBG_NOTICE("Becoming a daemon.\n"); become_daemon(opt_fork, opt_no_process_group, false); } else { daemon_status("samba", "Starting process..."); } .... daemon_ready("samba"); This would give a behavior expected by systemd from such services.
Fix is included into https://gitlab.com/samba-team/samba/-/merge_requests/1643
I think we also need to fix this for smbd, nmbd, and winbindd because they also do not report their status when running in foreground under systemd.
Sounds good to me. Can you update the MR with those extra fixes and I'll review !
I did already. Please see the MR
Oh sorry. I'll take a look Monday ! Feel free to assign to me for review.
Hmmm. I think we only need patch #2 of that set for systemd fixes. The first patch looks part of a separate bug to me. However, Andreas has already reviewed patch #1 so I'll push with his review for patch #1, and both of our reviews for patch #2.
Yes, both are required for working Samba on newer Linux distributions.
This bug was referenced in samba master: 3e27dc4847bd35ca8914be087d5a8ca096510399
Created attachment 16311 [details] patch for v4.13 branch
Karolin, please apply the patch to 4.13. Thanks!
Pushed to autobuild-v4-13-test.
This bug was referenced in samba v4-13-test: c4938561a97e55efd624694ea55ef7c1a46a350a
Closing out bug report. Thanks!
This bug was referenced in samba v4-13-stable (Release samba-4.13.2): c4938561a97e55efd624694ea55ef7c1a46a350a