Just backported 4.4.5 from debian sid to jessie. samba.service is masked there. If running as an fileserver the services are started via smbd.service,nmbd.service, winbind.service. There is an samba-ad-dc script which is masked by default. To get the ad-dc up and running with systemd one has to unmask samba-ad-dc.service and mask smbd.service,nmbd.service, winbind.service. This is the samba-ad-dc.service script: [Unit] Description=Samba AD Daemon Documentation=man:samba(8) man:samba(7) man:smb.conf(5) After=network.target [Service] Type=notify NotifyAccess=all PIDFile=/run/samba.pid LimitNOFILE=16384 EnvironmentFile=-/etc/default/samba ExecStart=/usr/sbin/samba $SAMBAOPTIONS ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target Am 12.07.2016 um 20:53 schrieb Sonic:> On Tue, Jul 12, 2016 at 10:09 AM, Sonic <sonicsmith at gmail.com> wrote: >> Mine use Type=forking, I had some issues with Type=notify > Further testing seems to verify that either type works for starting > nmbd and smbd, but I need forking for starting samba (AD) as samba > dies shortly after starting it with notify. > > From some systemd info: > "If set to forking, it is expected that the process configured with > ExecStart= will call fork() as part of its start-up. The parent > process is expected to exit when start-up is complete and all > communication channels are set up. The child continues to run as the > main daemon process. This is the behavior of traditional UNIX > daemons." > I'm guessing that indeed the samba binary calls fork() as part of its > start-up. Can this be verified? And how about the smbd and nmbd > binaries, do they call fork() during stat-up? > > Chris >
On 12/07/16 20:25, Achim Gottinger wrote:> Just backported 4.4.5 from debian sid to jessie. samba.service is > masked there. If running as an fileserver the services are started via > smbd.service,nmbd.service, winbind.service. > There is an samba-ad-dc script which is masked by default. > To get the ad-dc up and running with systemd one has to unmask > samba-ad-dc.service and mask smbd.service,nmbd.service, winbind.service. > > This is the samba-ad-dc.service script: > > [Unit] > > Description=Samba AD Daemon > > Documentation=man:samba(8) man:samba(7) man:smb.conf(5) > > After=network.target > > [Service] > > Type=notify > > NotifyAccess=all > > PIDFile=/run/samba.pid > > LimitNOFILE=16384 > > EnvironmentFile=-/etc/default/samba > > ExecStart=/usr/sbin/samba $SAMBAOPTIONS > > ExecReload=/bin/kill -HUP $MAINPID > > [Install] > > WantedBy=multi-user.target > >that is basically what init scripts do, i.e if fileserver start the nmbd, smbd and winbindd binaries, if AD DC just start the samba binary, but is this what Sonic is doing ? Rowland
On Tue, Jul 12, 2016 at 3:25 PM, Achim Gottinger <achim at ag-web.biz> wrote:> This is the samba-ad-dc.service script:Pretty similar to my samba.service script: ==================================[Unit] Description=Samba AD server After=network.target [Service] Type=forking PIDFile=/usr/local/samba/var/run/samba.pid LimitNOFILE=16384 ExecStart=/usr/local/samba/sbin/samba ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target ================================== However the substitution below fails for me. -Type=forking +Type=notify +NotifyAccess=all I'm compiling samba-master from source. Would like to know what your EnvironmentFile contains, maybe that's needed for Type=notify. Chris
Am 12.07.2016 um 21:35 schrieb Rowland penny:> On 12/07/16 20:25, Achim Gottinger wrote: >> Just backported 4.4.5 from debian sid to jessie. samba.service is >> masked there. If running as an fileserver the services are started >> via smbd.service,nmbd.service, winbind.service. >> There is an samba-ad-dc script which is masked by default. >> To get the ad-dc up and running with systemd one has to unmask >> samba-ad-dc.service and mask smbd.service,nmbd.service, winbind.service. >> >> This is the samba-ad-dc.service script: >> >> [Unit] >> >> Description=Samba AD Daemon >> >> Documentation=man:samba(8) man:samba(7) man:smb.conf(5) >> >> After=network.target >> >> [Service] >> >> Type=notify >> >> NotifyAccess=all >> >> PIDFile=/run/samba.pid >> >> LimitNOFILE=16384 >> >> EnvironmentFile=-/etc/default/samba >> >> ExecStart=/usr/sbin/samba $SAMBAOPTIONS >> >> ExecReload=/bin/kill -HUP $MAINPID >> >> [Install] >> >> WantedBy=multi-user.target >> >> > > that is basically what init scripts do, i.e if fileserver start the > nmbd, smbd and winbindd binaries, if AD DC just start the samba > binary, but is this what Sonic is doing ? > > Rowland > >He mentioned using systemctl start samba. I can not run this here becuase it is masked an no samba.service file exists in the backport. This is intentional on debian see here. https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=769714 With LSB init scripts the samba script started smbd,nmbd and samba-ad-dc scripts. These checked smb.conf for the addc role and decided themselfes if they must start or not. Updating debian from backported 4.4.3 to backported 4.4.5 was abit messy (thank you systemd). Had to comment out the server role line on my addc's and stop samba. After the update i had to reenable to server role line and mask unmask services as described earlier. These are the other service files from 4.4.5+dfsg-2 smbd.service [Unit] Description=Samba SMB Daemon Documentation=man:smbd(8) man:samba(7) man:smb.conf(5) After=network.target nmb.service winbind.service [Service] Type=notify NotifyAccess=all PIDFile=/run/smbd.pid LimitNOFILE=16384 EnvironmentFile=-/etc/default/samba ExecStart=/usr/sbin/smbd $SMBDOPTIONS ExecReload=/bin/kill -HUP $MAINPID LimitCORE=infinity [Install] WantedBy=multi-user.target nmbd.service [Unit] Description=Samba NMB Daemon Documentation=man:nmbd(8) man:samba(7) man:smb.conf(5) After=network.target [Service] Type=notify NotifyAccess=all PIDFile=/run/nmbd.pid EnvironmentFile=-/etc/default/samba ExecStart=/usr/sbin/nmbd $NMBDOPTIONS ExecReload=/bin/kill -HUP $MAINPID LimitCORE=infinity [Install] WantedBy=multi-user.target winbind.service [Unit] Description=Samba Winbind Daemon Documentation=man:winbindd(8) man:samba(7) man:smb.conf(5) After=network.target nmb.service [Service] Type=notify NotifyAccess=all PIDFile=/run/winbindd.pid EnvironmentFile=-/etc/default/samba ExecStart=/usr/sbin/winbindd "$WINBINDOPTIONS" ExecReload=/bin/kill -HUP $MAINPID LimitCORE=infinity [Install] WantedBy=multi-user.target
On Tue, Jul 12, 2016 at 3:35 PM, Rowland penny <rpenny at samba.org> wrote:> if AD DC just start the samba binary, but is this what Sonic is doing ?Indeed it is what I'm doing, I recently posted my samba.service file in this thread. Chris
I have no /etc/default/samba file. If you run an ad-dc use samba-ad-dc.service, if not use the smbd, nmbd and winbind service files and not the samba.service. Am 12.07.2016 um 22:01 schrieb Sonic:> On Tue, Jul 12, 2016 at 3:25 PM, Achim Gottinger <achim at ag-web.biz> wrote: >> This is the samba-ad-dc.service script: > Pretty similar to my samba.service script: > ==================================> [Unit] > Description=Samba AD server > After=network.target > > [Service] > Type=forking > PIDFile=/usr/local/samba/var/run/samba.pid > LimitNOFILE=16384 > ExecStart=/usr/local/samba/sbin/samba > ExecReload=/bin/kill -HUP $MAINPID > > [Install] > WantedBy=multi-user.target > ==================================> > However the substitution below fails for me. > -Type=forking > +Type=notify > +NotifyAccess=all > > I'm compiling samba-master from source. > > Would like to know what your EnvironmentFile contains, maybe that's > needed for Type=notify. > > Chris
Does your PIDFile exist? systemd should use that if defined and exiting. https://lists.freedesktop.org/archives/systemd-devel/2013-February/009201.html Am 12.07.2016 um 22:01 schrieb Sonic:> On Tue, Jul 12, 2016 at 3:25 PM, Achim Gottinger <achim at ag-web.biz> wrote: >> This is the samba-ad-dc.service script: > Pretty similar to my samba.service script: > ==================================> [Unit] > Description=Samba AD server > After=network.target > > [Service] > Type=forking > PIDFile=/usr/local/samba/var/run/samba.pid > LimitNOFILE=16384 > ExecStart=/usr/local/samba/sbin/samba > ExecReload=/bin/kill -HUP $MAINPID > > [Install] > WantedBy=multi-user.target > ==================================> > However the substitution below fails for me. > -Type=forking > +Type=notify > +NotifyAccess=all > > I'm compiling samba-master from source. > > Would like to know what your EnvironmentFile contains, maybe that's > needed for Type=notify. > > Chris