Hi, I have a question about samba 4 with systemd. I've followed the "Managing the Samba AD DC Service Using Systemd" and I've created /etc/systemd/system/samba-ad-dc.service file with the following content: [Unit] Description=Samba Active Directory Domain Controller After=network.target remote-fs.target nss-lookup.target [Service] Type=forking ExecStart=/usr/local/samba/sbin/samba -D PIDFile=/usr/local/samba/var/run/samba.pid ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target I've created a mask to smbd, nmbd and winbind and I've disabled them following this command: # systemctl mask smbd nmbd winbind # systemctl disable smbd nmbd winbind. But, when I've use systemctl stop samba-ad-dc to stop samba, the status shown is "failed" with code=exited and status=127. Is it normal behavior? [root at king ~]# systemctl stop samba-ad-dc [root at king ~]# systemctl status samba-ad-dc ● samba-ad-dc.service - Samba Active Directory Domain Controller Loaded: loaded (/etc/systemd/system/samba-ad-dc.service; disabled; vendor preset: disabled) Active: failed (Result: exit-code) since Thu 2019-04-25 17:05:26 -03; 10min ago Process: 4937 ExecStart=/usr/local/samba/sbin/samba -D (code=exited, status=0/SUCCESS) Main PID: 4938 (code=exited, status=127) Apr 25 17:05:19 king smbd[4944]: daemon_ready: daemon 'smbd' finished starting up and ready to serve connections Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.918759, 0] ../../source3/winbindd/winbindd_cache.c:3165(initialize_win...d_cache) Apr 25 17:05:19 king winbindd[4954]: initialize_winbindd_cache: clearing cache and re-creating with version number 2 Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.939054, 0] ../../lib/util/become_daemon.c:136(daemon_ready) Apr 25 17:05:19 king winbindd[4954]: daemon_ready: daemon 'winbindd' finished starting up and ready to serve connections Apr 25 17:05:25 king systemd[1]: Stopping Samba Active Directory Domain Controller... Apr 25 17:05:25 king systemd[1]: samba-ad-dc.service: main process exited, code=exited, status=127/n/a Apr 25 17:05:26 king systemd[1]: Stopped Samba Active Directory Domain Controller. Apr 25 17:05:26 king systemd[1]: Unit samba-ad-dc.service entered failed state. Apr 25 17:05:26 king systemd[1]: samba-ad-dc.service failed. Hint: Some lines were ellipsized, use -l to show in full. ( https://wiki.samba.org/index.php/Managing_the_Samba_AD_DC_Service_Using_Systemd ) -- Igor Sousa
Hai Igor, No, that not normal, and this is and old bug in the start/stop. Entered after samba started to use preforking i believe. See the Unit setup below. Note, i added bind9.service here, because i use bind and i want bind to start before samba-ad. Just keep it there, if you change you samba to samba+bind_dlz, then you services are starting in the correct order. This part: # systemctl mask smbd nmbd winbind # systemctl disable smbd nmbd winbind That should be fine, but if there are left overs from a packages install, you might notice that. Then check also if samba.service exist, if so, remove it, not used anymore. smbd nmbd winbind samba-ad As you see i've added bind9.service also to After, that is, if you want/are useing bind9_dlz with samba Than bind needs to start before samba, just keep it there it wont hurt anything. So for you i suggest this systemd setup. If you can verify it, i'll make some changes in the wiki. #/etc/systemd/system/samba-ad-dc.service [Unit] Description=Samba AD Daemon Wants=network-online.target After=network.target network-online.target bind9.service [Service] Type=notify NotifyAccess=all ExecStart=/usr/local/samba/sbin/samba -D PIDFile=/usr/local/samba/var/run/samba.pid ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target After the change systemctl daemon-reload systemctl stop samba-ad-dc systemctl start samba-ad-dc Greetz, Louis> -----Oorspronkelijk bericht----- > Van: samba [mailto:samba-bounces at lists.samba.org] Namens Igor > Sousa via samba > Verzonden: donderdag 25 april 2019 23:32 > Aan: samba at lists.samba.org > Onderwerp: [Samba] Managing samba ad dc with systemd > > Hi, > > I have a question about samba 4 with systemd. I've followed > the "Managing > the Samba AD DC Service Using Systemd" and I've created > /etc/systemd/system/samba-ad-dc.service file with the > following content: > > [Unit] > Description=Samba Active Directory Domain Controller > After=network.target remote-fs.target nss-lookup.target > > [Service] > Type=forking > ExecStart=/usr/local/samba/sbin/samba -D > PIDFile=/usr/local/samba/var/run/samba.pid > ExecReload=/bin/kill -HUP $MAINPID > > [Install] > WantedBy=multi-user.target > > > I've created a mask to smbd, nmbd and winbind and I've disabled them > following this command: # systemctl mask smbd nmbd winbind # systemctl > disable smbd nmbd winbind. But, when I've use systemctl stop > samba-ad-dc to > stop samba, the status shown is "failed" with code=exited and > status=127. > > Is it normal behavior? > > [root at king ~]# systemctl stop samba-ad-dc > [root at king ~]# systemctl status samba-ad-dc > ??? samba-ad-dc.service - Samba Active Directory Domain Controller > Loaded: loaded (/etc/systemd/system/samba-ad-dc.service; disabled; > vendor preset: disabled) > Active: failed (Result: exit-code) since Thu 2019-04-25 > 17:05:26 -03; > 10min ago > Process: 4937 ExecStart=/usr/local/samba/sbin/samba -D (code=exited, > status=0/SUCCESS) > Main PID: 4938 (code=exited, status=127) > > Apr 25 17:05:19 king smbd[4944]: daemon_ready: daemon > 'smbd' finished > starting up and ready to serve connections > Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.918759, 0] > ../../source3/winbindd/winbindd_cache.c:3165(initialize_win...d_cache) > Apr 25 17:05:19 king winbindd[4954]: > initialize_winbindd_cache: clearing > cache and re-creating with version number 2 > Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.939054, 0] > ../../lib/util/become_daemon.c:136(daemon_ready) > Apr 25 17:05:19 king winbindd[4954]: daemon_ready: daemon 'winbindd' > finished starting up and ready to serve connections > Apr 25 17:05:25 king systemd[1]: Stopping Samba Active > Directory Domain > Controller... > Apr 25 17:05:25 king systemd[1]: samba-ad-dc.service: main > process exited, > code=exited, status=127/n/a > Apr 25 17:05:26 king systemd[1]: Stopped Samba Active Directory Domain > Controller. > Apr 25 17:05:26 king systemd[1]: Unit samba-ad-dc.service > entered failed > state. > Apr 25 17:05:26 king systemd[1]: samba-ad-dc.service failed. > Hint: Some lines were ellipsized, use -l to show in full. > > > ( > https://wiki.samba.org/index.php/Managing_the_Samba_AD_DC_Serv > ice_Using_Systemd > ) > > -- > Igor Sousa > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba > >
Hi Louis, I've modify my /etc/systemd/system/samba-ad-dc file following your advice, I only changed bind9.service to named.service (I've run samba on CentOS 7 with Bind9_DLZ). I've checked again if there are others smbd, nmbd, winbindd an samba services on systemd, but they there aren't. The samba-ad-dc service still to fail when I've tried stop it. I've installed samba 4.10.2 from source on a fresh host that never see any samba/smbd/nmbd/winbind packages. [root at king ~]# systemctl list-unit-files samba* UNIT FILE STATE samba-ad-dc.service enabled 1 unit files listed. [root at king ~]# systemctl list-unit-files winbind* UNIT FILE STATE winbind.service masked 1 unit files listed. [root at king ~]# systemctl list-unit-files smbd* UNIT FILE STATE smbd.service masked 1 unit files listed. [root at king ~]# systemctl list-unit-files nmbd* UNIT FILE STATE nmbd.service masked 1 unit files listed. [root at king ~]# systemctl stop samba-ad-dc [root at king ~]# systemctl status samba-ad-dc ● samba-ad-dc.service - Samba Active Directory Domain Controller Loaded: loaded (/etc/systemd/system/samba-ad-dc.service; enabled; vendor preset: disabled) Active: failed (Result: exit-code) since Fri 2019-04-26 10:55:01 -03; 4min 23s ago Process: 13056 ExecStart=/usr/local/samba/sbin/samba -D (code=exited, status=127) Main PID: 13056 (code=exited, status=127) Status: "smbd: ready to serve connections..." Apr 26 10:54:58 king winbindd[13072]: initialize_winbindd_cache: clearing cache and re-creating with version number 2 Apr 26 10:54:58 king winbindd[13072]: [2019/04/26 10:54:58.403541, 0] ../../lib/util/become_daemon.c:136(daemon_ready) Apr 26 10:54:58 king winbindd[13072]: daemon_ready: daemon 'winbindd' finished starting up and ready to serve connections Apr 26 10:54:58 king smbd[13070]: [2019/04/26 10:54:58.428867, 0] ../../lib/util/become_daemon.c:136(daemon_ready) Apr 26 10:54:58 king smbd[13070]: daemon_ready: daemon 'smbd' finished starting up and ready to serve connections Apr 26 10:55:01 king systemd[1]: Stopping Samba Active Directory Domain Controller... Apr 26 10:55:01 king systemd[1]: samba-ad-dc.service: main process exited, code=exited, status=127/n/a Apr 26 10:55:01 king systemd[1]: Stopped Samba Active Directory Domain Controller. Apr 26 10:55:01 king systemd[1]: Unit samba-ad-dc.service entere -- Igor Sousa Em sex, 26 de abr de 2019 às 04:20, L.P.H. van Belle via samba < samba at lists.samba.org> escreveu:> Hai Igor, > > No, that not normal, and this is and old bug in the start/stop. > Entered after samba started to use preforking i believe. > > See the Unit setup below. > Note, i added bind9.service here, because i use bind and i want bind to > start before samba-ad. > Just keep it there, if you change you samba to samba+bind_dlz, then you > services are starting in the correct order. > > This part: > # systemctl mask smbd nmbd winbind > # systemctl disable smbd nmbd winbind > > That should be fine, but if there are left overs from a packages install, > you might notice that. > Then check also if samba.service exist, if so, remove it, not used > anymore. > > smbd nmbd winbind samba-ad > > As you see i've added bind9.service also to After, that is, if you > want/are useing bind9_dlz with samba > Than bind needs to start before samba, just keep it there it wont hurt > anything. > > So for you i suggest this systemd setup. > If you can verify it, i'll make some changes in the wiki. > > > #/etc/systemd/system/samba-ad-dc.service > [Unit] > Description=Samba AD Daemon > Wants=network-online.target > After=network.target network-online.target bind9.service > > [Service] > Type=notify > NotifyAccess=all > ExecStart=/usr/local/samba/sbin/samba -D > PIDFile=/usr/local/samba/var/run/samba.pid > ExecReload=/bin/kill -HUP $MAINPID > > [Install] > WantedBy=multi-user.target > > After the change > > systemctl daemon-reload > systemctl stop samba-ad-dc > systemctl start samba-ad-dc > > > Greetz, > > Louis > > > -----Oorspronkelijk bericht----- > > Van: samba [mailto:samba-bounces at lists.samba.org] Namens Igor > > Sousa via samba > > Verzonden: donderdag 25 april 2019 23:32 > > Aan: samba at lists.samba.org > > Onderwerp: [Samba] Managing samba ad dc with systemd > > > > Hi, > > > > I have a question about samba 4 with systemd. I've followed > > the "Managing > > the Samba AD DC Service Using Systemd" and I've created > > /etc/systemd/system/samba-ad-dc.service file with the > > following content: > > > > [Unit] > > Description=Samba Active Directory Domain Controller > > After=network.target remote-fs.target nss-lookup.target > > > > [Service] > > Type=forking > > ExecStart=/usr/local/samba/sbin/samba -D > > PIDFile=/usr/local/samba/var/run/samba.pid > > ExecReload=/bin/kill -HUP $MAINPID > > > > [Install] > > WantedBy=multi-user.target > > > > > > I've created a mask to smbd, nmbd and winbind and I've disabled them > > following this command: # systemctl mask smbd nmbd winbind # systemctl > > disable smbd nmbd winbind. But, when I've use systemctl stop > > samba-ad-dc to > > stop samba, the status shown is "failed" with code=exited and > > status=127. > > > > Is it normal behavior? > > > > [root at king ~]# systemctl stop samba-ad-dc > > [root at king ~]# systemctl status samba-ad-dc > > ??? samba-ad-dc.service - Samba Active Directory Domain Controller > > Loaded: loaded (/etc/systemd/system/samba-ad-dc.service; disabled; > > vendor preset: disabled) > > Active: failed (Result: exit-code) since Thu 2019-04-25 > > 17:05:26 -03; > > 10min ago > > Process: 4937 ExecStart=/usr/local/samba/sbin/samba -D (code=exited, > > status=0/SUCCESS) > > Main PID: 4938 (code=exited, status=127) > > > > Apr 25 17:05:19 king smbd[4944]: daemon_ready: daemon > > 'smbd' finished > > starting up and ready to serve connections > > Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.918759, 0] > > ../../source3/winbindd/winbindd_cache.c:3165(initialize_win...d_cache) > > Apr 25 17:05:19 king winbindd[4954]: > > initialize_winbindd_cache: clearing > > cache and re-creating with version number 2 > > Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.939054, 0] > > ../../lib/util/become_daemon.c:136(daemon_ready) > > Apr 25 17:05:19 king winbindd[4954]: daemon_ready: daemon 'winbindd' > > finished starting up and ready to serve connections > > Apr 25 17:05:25 king systemd[1]: Stopping Samba Active > > Directory Domain > > Controller... > > Apr 25 17:05:25 king systemd[1]: samba-ad-dc.service: main > > process exited, > > code=exited, status=127/n/a > > Apr 25 17:05:26 king systemd[1]: Stopped Samba Active Directory Domain > > Controller. > > Apr 25 17:05:26 king systemd[1]: Unit samba-ad-dc.service > > entered failed > > state. > > Apr 25 17:05:26 king systemd[1]: samba-ad-dc.service failed. > > Hint: Some lines were ellipsized, use -l to show in full. > > > > > > ( > > https://wiki.samba.org/index.php/Managing_the_Samba_AD_DC_Serv > > ice_Using_Systemd > > ) > > > > -- > > Igor Sousa > > -- > > To unsubscribe from this list go to the following URL and read the > > instructions: https://lists.samba.org/mailman/options/samba > > > > > > > -- > To unsubscribe from this list go to the following URL and read the > instructions: https://lists.samba.org/mailman/options/samba >
stop samba, verify its all stopped. ? change this linen : ExecStart=/usr/local/samba/sbin/samba -D to ExecStart=/usr/local/samba/sbin/samba --foreground --no-process-group ? systemctl daemon-reload systemctl start samba-ad-dc wait 10 sec. and stop it, ? is it now good? ? if not post : samba -b output. ? ? Greetz, ? Louis ? Van: Igor Sousa [mailto:igorvolt at gmail.com] Verzonden: vrijdag 26 april 2019 16:02 Aan: L.P.H. van Belle CC: samba at lists.samba.org Onderwerp: Re: [Samba] Managing samba ad dc with systemd Hi Louis, I've modify my /etc/systemd/system/samba-ad-dc file following your advice, I only changed bind9.service to named.service (I've run samba on CentOS 7 with Bind9_DLZ). I've checked again if there are others smbd, nmbd, winbindd an samba services on systemd, but they there aren't. The samba-ad-dc service still to fail when I've tried stop it. I've installed samba 4.10.2 from source on a fresh host that never see any samba/smbd/nmbd/winbind packages. [root at king ~]# systemctl list-unit-files samba* UNIT FILE? ? ? ? ? ?STATE?? samba-ad-dc.service enabled 1 unit files listed. [root at king ~]# systemctl list-unit-files winbind* UNIT FILE? ? ? ?STATE? winbind.service masked 1 unit files listed. [root at king ~]# systemctl list-unit-files smbd* UNIT FILE? ? STATE? smbd.service masked 1 unit files listed. [root at king ~]# systemctl list-unit-files nmbd* UNIT FILE? ? STATE? nmbd.service masked 1 unit files listed. [root at king ~]# systemctl stop samba-ad-dc [root at king ~]# systemctl status samba-ad-dc samba-ad-dc.service - Samba Active Directory Domain Controller ? ?Loaded: loaded (/etc/systemd/system/samba-ad-dc.service; enabled; vendor preset: disabled) ? ?Active: failed (Result: exit-code) since Fri 2019-04-26 10:55:01 -03; 4min 23s ago ? Process: 13056 ExecStart=/usr/local/samba/sbin/samba -D (code=exited, status=127) ?Main PID: 13056 (code=exited, status=127) ? ?Status: "smbd: ready to serve connections..." Apr 26 10:54:58 king winbindd[13072]:? ?initialize_winbindd_cache: clearing cache and re-creating with version number 2 Apr 26 10:54:58 king winbindd[13072]: [2019/04/26 10:54:58.403541,? 0] ../../lib/util/become_daemon.c:136(daemon_ready) Apr 26 10:54:58 king winbindd[13072]:? ?daemon_ready: daemon 'winbindd' finished starting up and ready to serve connections Apr 26 10:54:58 king smbd[13070]: [2019/04/26 10:54:58.428867,? 0] ../../lib/util/become_daemon.c:136(daemon_ready) Apr 26 10:54:58 king smbd[13070]:? ?daemon_ready: daemon 'smbd' finished starting up and ready to serve connections Apr 26 10:55:01 king systemd[1]: Stopping Samba Active Directory Domain Controller... Apr 26 10:55:01 king systemd[1]: samba-ad-dc.service: main process exited, code=exited, status=127/n/a Apr 26 10:55:01 king systemd[1]: Stopped Samba Active Directory Domain Controller. Apr 26 10:55:01 king systemd[1]: Unit samba-ad-dc.service entere -- Igor Sousa Em sex, 26 de abr de 2019 às 04:20, L.P.H. van Belle via samba <samba at lists.samba.org> escreveu: Hai Igor, No, that not normal, and this is and old bug in the start/stop. Entered after samba started to use preforking i believe. See the Unit setup below. Note, i added bind9.service here, because i use bind and i want bind to start before samba-ad. Just keep it there, if you change you samba to samba+bind_dlz, then you services are starting in the correct order. This part: # systemctl mask smbd nmbd winbind # systemctl disable smbd nmbd winbind That should be fine, but if there are left overs from a packages install, you might notice that. Then check also if samba.service exist, if so, remove it, not used anymore. smbd nmbd winbind samba-ad As you see i've added bind9.service also to After, that is, if you want/are useing bind9_dlz with samba Than bind needs to start before samba, just keep it there it wont hurt anything. So for you i suggest this systemd setup. If you can verify it, i'll make some changes in the wiki. #/etc/systemd/system/samba-ad-dc.service [Unit] Description=Samba AD Daemon Wants=network-online.target After=network.target network-online.target bind9.service [Service] Type=notify NotifyAccess=all ExecStart=/usr/local/samba/sbin/samba -D PIDFile=/usr/local/samba/var/run/samba.pid ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=multi-user.target After the change systemctl daemon-reload systemctl stop samba-ad-dc systemctl start samba-ad-dc Greetz, Louis> -----Oorspronkelijk bericht----- > Van: samba [mailto:samba-bounces at lists.samba.org] Namens Igor > Sousa via samba > Verzonden: donderdag 25 april 2019 23:32 > Aan: samba at lists.samba.org > Onderwerp: [Samba] Managing samba ad dc with systemd > > Hi, > > I have a question about samba 4 with systemd. I've followed > the "Managing > the Samba AD DC Service Using Systemd" and I've created > /etc/systemd/system/samba-ad-dc.service file with the > following content: > > [Unit] > Description=Samba Active Directory Domain Controller > After=network.target remote-fs.target nss-lookup.target > > [Service] > Type=forking > ExecStart=/usr/local/samba/sbin/samba -D > PIDFile=/usr/local/samba/var/run/samba.pid > ExecReload=/bin/kill -HUP $MAINPID > > [Install] > WantedBy=multi-user.target > > > I've created a mask to smbd, nmbd and winbind and I've disabled them > following this command: # systemctl mask smbd nmbd winbind # systemctl > disable smbd nmbd winbind. But, when I've use systemctl stop > samba-ad-dc to > stop samba, the status shown is "failed" with code=exited and > status=127. > > Is it normal behavior? > > [root at king ~]# systemctl stop samba-ad-dc > [root at king ~]# systemctl status samba-ad-dc > ??? samba-ad-dc.service - Samba Active Directory Domain Controller >? ? Loaded: loaded (/etc/systemd/system/samba-ad-dc.service; disabled; > vendor preset: disabled) >? ? Active: failed (Result: exit-code) since Thu 2019-04-25 > 17:05:26 -03; > 10min ago >? ?Process: 4937 ExecStart=/usr/local/samba/sbin/samba -D (code=exited, > status=0/SUCCESS) >? Main PID: 4938 (code=exited, status=127) > > Apr 25 17:05:19 king smbd[4944]:? ?daemon_ready: daemon > 'smbd' finished > starting up and ready to serve connections > Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.918759,? 0] > ../../source3/winbindd/winbindd_cache.c:3165(initialize_win...d_cache) > Apr 25 17:05:19 king winbindd[4954]:? ? > initialize_winbindd_cache: clearing > cache and re-creating with version number 2 > Apr 25 17:05:19 king winbindd[4954]: [2019/04/25 17:05:19.939054,? 0] > ../../lib/util/become_daemon.c:136(daemon_ready) > Apr 25 17:05:19 king winbindd[4954]:? ?daemon_ready: daemon 'winbindd' > finished starting up and ready to serve connections > Apr 25 17:05:25 king systemd[1]: Stopping Samba Active > Directory Domain > Controller... > Apr 25 17:05:25 king systemd[1]: samba-ad-dc.service: main > process exited, > code=exited, status=127/n/a > Apr 25 17:05:26 king systemd[1]: Stopped Samba Active Directory Domain > Controller. > Apr 25 17:05:26 king systemd[1]: Unit samba-ad-dc.service > entered failed > state. > Apr 25 17:05:26 king systemd[1]: samba-ad-dc.service failed. > Hint: Some lines were ellipsized, use -l to show in full. > > > ( > https://wiki.samba.org/index.php/Managing_the_Samba_AD_DC_Serv > ice_Using_Systemd > ) > > -- > Igor Sousa > -- > To unsubscribe from this list go to the following URL and read the > instructions:? https://lists.samba.org/mailman/options/samba > >-- To unsubscribe from this list go to the following URL and read the instructions:? https://lists.samba.org/mailman/options/samba