[Samba] Option configure

Achim Gottinger achim at ag-web.biz
Tue Jul 12 21:58:26 UTC 2016



Am 12.07.2016 um 23:21 schrieb Reindl Harald:
>
>
> Am 12.07.2016 um 22:55 schrieb Achim Gottinger:
>> Funny current debian service files use a wrong PIDFile path (should be
>> /var/run/amba/samba.pid).
>>
>> If I use Type=forking and an wrong PIDFile systemctl start samba must be
>> CTRL-C'ed.
>>
>> Type=notify works with or without an proper PIDFile.
>
> well, after 5 years of production with systemd all that pidfile stuff 
> is the root of all evil - get rid of it until you have a very godd 
> reason and most problems will go away
>
> systemd is damned good in monitor process states and pidfiles where a 
> dirty workaround for init-systems with no clue about anything
>
> that goes so far that i start mysqld without mysqld_safe, Type=simple 
> and "--pid-file=/dev/null" to get rid of all sort of troubles when 
> idiotic processes don't create and remove their pid files at the 
> current point in time
>
Thank you for the comment, so i removed the pidfile line from the 
service file.

With type=forking it shows (8591 is the pid in /var/run/samba/samba.pid)

systemctl status samba-ad-dc
● samba-ad-dc.service - Samba AD Daemon
    Loaded: loaded (/lib/systemd/system/samba-ad-dc.service; enabled)
    Active: active (running) since Tue 2016-07-12 23:46:19 CEST; 2s ago
      Docs: man:samba(8)
            man:samba(7)
            man:smb.conf(5)
   Process: 8590 ExecStart=/usr/sbin/samba $SAMBAOPTIONS (code=exited, 
status=0/SUCCESS)
  Main PID: 8591 (samba)
    Status: "winbindd: ready to serve connections..."
    CGroup: /system.slice/samba-ad-dc.service
            ├─8591 /usr/sbin/samba
            ├─8592 /usr/sbin/samba
            ├─8593 /usr/sbin/samba
            ├─8594 /usr/sbin/samba
            ├─8595 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8596 /usr/sbin/samba
            ├─8597 /usr/sbin/samba
            ├─8598 /usr/sbin/samba
            ├─8599 /usr/sbin/samba
            ├─8600 /usr/sbin/samba
            ├─8601 /usr/sbin/samba
            ├─8602 /usr/sbin/samba
            ├─8603 /usr/sbin/winbindd -D --option=server role 
check:inhibit=yes --foreground
            ├─8604 /usr/sbin/samba
            ├─8605 /usr/sbin/samba
            ├─8608 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8609 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8611 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            └─8613 /usr/sbin/winbindd -D --option=server role 
check:inhibit=yes --foreground

With

Type=notify
NotifyAccess=all

systemctl status samba-ad-dc
● samba-ad-dc.service - Samba AD Daemon
    Loaded: loaded (/lib/systemd/system/samba-ad-dc.service; enabled)
    Active: active (running) since Tue 2016-07-12 23:48:50 CEST; 2s ago
      Docs: man:samba(8)
            man:samba(7)
            man:smb.conf(5)
  Main PID: 8749 (samba)
    Status: "winbindd: ready to serve connections..."
    CGroup: /system.slice/samba-ad-dc.service
            ├─8749 /usr/sbin/samba
            ├─8750 /usr/sbin/samba
            ├─8751 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8752 /usr/sbin/samba
            ├─8753 /usr/sbin/samba
            ├─8754 /usr/sbin/samba
            ├─8755 /usr/sbin/samba
            ├─8756 /usr/sbin/samba
            ├─8757 /usr/sbin/samba
            ├─8758 /usr/sbin/samba
            ├─8759 /usr/sbin/samba
            ├─8760 /usr/sbin/samba
            ├─8761 /usr/sbin/winbindd -D --option=server role 
check:inhibit=yes --foreground
            ├─8762 /usr/sbin/samba
            ├─8763 /usr/sbin/samba
            ├─8766 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8767 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8769 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            └─8771 /usr/sbin/winbindd -D --option=server role 
check:inhibit=yes --foreground

Here it does not mention the inital process pid. Both options work 
without killing the processes.

If i remove NotifyAccess=all

systemctl status samba-ad-dc
● samba-ad-dc.service - Samba AD Daemon
    Loaded: loaded (/lib/systemd/system/samba-ad-dc.service; enabled)
    Active: active (running) since Tue 2016-07-12 23:50:50 CEST; 16s ago
      Docs: man:samba(8)
            man:samba(7)
            man:smb.conf(5)
  Main PID: 8875 (samba)
    Status: "samba: ready to serve connections..."
    CGroup: /system.slice/samba-ad-dc.service
            ├─8875 /usr/sbin/samba
            ├─8876 /usr/sbin/samba
            ├─8877 /usr/sbin/samba
            ├─8878 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8879 /usr/sbin/samba
            ├─8880 /usr/sbin/samba
            ├─8881 /usr/sbin/samba
            ├─8882 /usr/sbin/samba
            ├─8883 /usr/sbin/samba
            ├─8884 /usr/sbin/samba
            ├─8885 /usr/sbin/samba
            ├─8886 /usr/sbin/samba
            ├─8887 /usr/sbin/winbindd -D --option=server role 
check:inhibit=yes --foreground
            ├─8888 /usr/sbin/samba
            ├─8889 /usr/sbin/samba
            ├─8892 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8893 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            ├─8895 /usr/sbin/smbd -D --option=server role 
check:inhibit=yes --foreground
            └─8897 /usr/sbin/winbindd -D --option=server role 
check:inhibit=yes --foreground

Jul 12 23:50:50 dc3 samba[8875]: [2016/07/12 23:50:50.042455,  0] 
../lib/util/become_daemon.c:124(daemon_ready)
Jul 12 23:50:50 dc3 samba[8875]: STATUS=daemon 'samba' finished starting 
up and ready to serve connections
Jul 12 23:50:50 dc3 winbindd[8887]: [2016/07/12 23:50:50.173942,  0] 
../source3/winbindd/winbindd_cache.c:3245(initialize_winbindd_cache)
Jul 12 23:50:50 dc3 winbindd[8887]: initialize_winbindd_cache: clearing 
cache and re-creating with version number 2
Jul 12 23:50:50 dc3 smbd[8878]: [2016/07/12 23:50:50.470873,  0] 
../lib/util/become_daemon.c:124(daemon_ready)
Jul 12 23:50:50 dc3 systemd[1]: samba-ad-dc.service: Got notification 
message from PID 8878, but reception only permitted for main PID 8875
Jul 12 23:50:50 dc3 smbd[8878]: STATUS=daemon 'smbd' finished starting 
up and ready to serve connections
Jul 12 23:50:50 dc3 winbindd[8887]: [2016/07/12 23:50:50.682114,  0] 
../lib/util/become_daemon.c:124(daemon_ready)
Jul 12 23:50:50 dc3 systemd[1]: samba-ad-dc.service: Got notification 
message from PID 8887, but reception only permitted for main PID 8875
Jul 12 23:50:50 dc3 winbindd[8887]: STATUS=daemon 'winbindd' finished 
starting up and ready to serve connections

There are two warnings about messages for smbd and winbindd pids, 
otherwise it's working.

Type=simple does not work

● samba-ad-dc.service - Samba AD Daemon
    Loaded: loaded (/lib/systemd/system/samba-ad-dc.service; enabled)
    Active: deactivating (stop-sigterm) since Tue 2016-07-12 23:53:49 
CEST; 11s ago
      Docs: man:samba(8)
            man:samba(7)
            man:smb.conf(5)
   Process: 9047 ExecStart=/usr/sbin/samba $SAMBAOPTIONS (code=exited, 
status=0/SUCCESS)
  Main PID: 9047 (code=exited, status=0/SUCCESS)
    CGroup: /system.slice/samba-ad-dc.service
            └─9049 /usr/sbin/samba

Jul 12 23:53:49 dc3 systemd[1]: Starting Samba AD Daemon...
Jul 12 23:53:49 dc3 systemd[1]: Started Samba AD Daemon.
Jul 12 23:53:49 dc3 samba[9047]: [2016/07/12 23:53:49.141341,  0] 
../source4/smbd/server.c:373(binary_smbd_main)
Jul 12 23:53:49 dc3 samba[9047]: samba version 4.4.5-Debian started.

There is one samba process running and systemctl stop samba does not end 
that process. "kill 9049" does the job. The file 
/var/run/samba/samba.pid shows an previous used pid.
So I'll use

Type=notify
NotifyAccess=all

and no PIDFile.
>> Am 12.07.2016 um 22:47 schrieb Sonic:
>>> On Tue, Jul 12, 2016 at 4:29 PM, Achim Gottinger <achim at ag-web.biz>
>>> wrote:
>>>> Does your PIDFile exist?
>>> Yes. Everything works properly as long as I use Type=forking
>
>
>



More information about the samba mailing list