[PATCH] Fix samba daemon startup with systemd

Andreas Schneider asn at samba.org
Tue Dec 12 11:49:05 UTC 2017


On Tuesday, 12 December 2017 11:28:25 CET Andrew Bartlett via samba-technical 
wrote:
> On Tue, 2017-12-12 at 08:39 +0100, Andreas Schneider via samba-
> 
> technical wrote:
> > Hi,
> > 
> > we need network interfaces to be up before starting samba service.
> > 
> > 
> > Please review and push if OK.
> 
> G'Day,
> 
> Systemd trolling aside, this looks reasonable, but I've not had reason
> to understand systemd enough to review it.  What I will note is that
> debian is carrying this (attached) patch for nmbd.

Yes, we need to wait in nmbd too!
 
> Also there is this patch in our github repo:
> https://github.com/samba-team/samba/pull/70

I think this one is wrong. Waiting for the network interface being up is the 
correct thing to do.

Updated patch attached.


The idea is to have a correct location of systemd files. In Fedora we use 
those files and modify them using 'sed' during installation.
We could create a python script for installing them which does some kind of /
searc/replace/


	Andreas

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org
-------------- next part --------------
>From 99353a06b811ca67d75fee5ebcdd744afffa46cd Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn at samba.org>
Date: Tue, 12 Dec 2017 08:36:57 +0100
Subject: [PATCH] systemd: Only start samba and nmbd when network interfaces
 are up

For samba and nmbd we need to wait till a network interface is up or
they wont be operational.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13184

Signed-off-by: Andreas Schneider <asn at samba.org>
---
 packaging/systemd/nmb.service   | 3 ++-
 packaging/systemd/samba.service | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/packaging/systemd/nmb.service b/packaging/systemd/nmb.service
index 71c93d6088b..6231118abe8 100644
--- a/packaging/systemd/nmb.service
+++ b/packaging/systemd/nmb.service
@@ -1,6 +1,7 @@
 [Unit]
 Description=Samba NMB Daemon
-After=syslog.target network.target
+Wants=network-online.target
+After=syslog.target network.target network-online.target
 
 [Service]
 Type=notify
diff --git a/packaging/systemd/samba.service b/packaging/systemd/samba.service
index 1b64c3b779d..79b22a0da7a 100644
--- a/packaging/systemd/samba.service
+++ b/packaging/systemd/samba.service
@@ -1,6 +1,7 @@
 [Unit]
 Description=Samba AD Daemon
-After=syslog.target network.target
+Wants=network-online.target
+After=syslog.target network.target network-online.target
 
 [Service]
 Type=notify
-- 
2.15.1



More information about the samba-technical mailing list