please explain this systemd service files question

Alexander Bokovoy ab at
Wed Oct 17 08:45:05 UTC 2018

On ke, 17 loka 2018, L.P.H. van Belle via samba-technical wrote:
> Hai, 
> After days of searching why on a debian install samba and winbind fails, i did find this. 
> in this folder :  SOURCE/packaging/systemd/
> i notice the systemd service files with the following. 
> for examplel this file : contains. 
> [Unit]
> Description=Samba SMB Daemon
> Documentation=man:smbd(8) man:samba(7) man:smb.conf(5)
> nmb.service winbind.service
> [Service]
> Type=notify
> NotifyAccess=all
> LimitNOFILE=16384
> EnvironmentFile=- at SYSCONFDIR@/sysconfig/samba
> ExecStart=@SBINDIR@/smbd --foreground --no-process-group $SMBDOPTIONS
> ExecReload=/bin/kill -HUP $MAINPID
> LimitCORE=infinity
> @systemd_smb_extra@
> [Install]
> Now my question what is @systemd_smb_extra@ and why is it there. 
> Due to that, the service files on debian are modifies and this part is added: 
> ExecStartPre=/bin/systemctl try-stop winbind.service
> ExecStartPost=/bin/systemctl try-start winbind.service
> Restart=on-failure
> RestartSec=30s
> resulting at the install :
> Process: 2065 ExecStartPre=/bin/systemctl try-stop smbd.service (code=exited, status=1/FAILURE) 
> because it does not understand try-stop ( or try-start ) 
> The commands there :  systemctl try-stop  and systemctl try-start 
> does not exist, so can someone explain this for me? 
Look at packaging/wscript:
                  help=("Extra directives added to the smb service file."
                        +" Can be given multiple times."),
                  action="append", dest="systemd_smb_extra", default=[])

They default to empty list.

The need to turn them to templates came from 

commit 080d590de1ff9f8ebc55aeffaea8d41991466549
Author: Aurelien Aptel <aaptel at>
Date:   Thu Dec 14 16:47:49 2017 +0100

    packaging: add configure option to preprocess and install systemd files

    Turn the systemd service files under packaging into template (.in) files
    with @VAR@ substitutions and add configure options to install and tweak

    Signed-off-by: Aurelien Aptel <aaptel at>
    Reviewed-by: Andrew Bartlett <abartlet at>
    Reviewed-by: Garming Sam <garming at>

I cannot find any references to 'try-stop/try-start' in systemd
upstream code so looks like try-start/try-stop were Debian-specific.

/ Alexander Bokovoy

More information about the samba-technical mailing list