Web lists-archives.com

Re: Setting up samba (2:4.5.12+dfsg-2+deb9u4) ... Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service is masked.




On 12/4/2018 6:00 AM, David Christensen wrote:
> On 12/2/18 11:39 PM, john doe wrote:
>> On 12/2/2018 9:27 PM, David Christensen wrote:
>>> debian-user:
>>>
>>> I have a Debian 9 machine with Samba:
>>>
>>> 2018-12-02 12:14:24 dpchrist@dipsy ~
>>> $ cat /etc/debian_version
>>> 9.6
>>>
>>> 2018-12-02 12:14:29 dpchrist@dipsy ~
>>> $ uname -a
>>> Linux dipsy 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64
>>> GNU/Linux
>>>
>>>
>>> I updated and upgraded it today:
>>>
>>> 2018-12-02 11:55:44 root@dipsy ~
>>> # apt-get update
> ...
> 
>>> Setting up samba (2:4.5.12+dfsg-2+deb9u4) ...
>>> Failed to preset unit: Unit file /etc/systemd/system/samba-ad-dc.service
>>> is masked.
>>> /usr/bin/deb-systemd-helper: error: systemctl preset failed on
>>> samba-ad-dc.service: No such file or director...
> 
>>> I don't know what the second line means, but suspect systemd is
>>> complaining (?).  I assume the third line is a consequence of the
>>> second.
> ...
> 
>>> Then I rebooted and looked for Samba:
>>>
>>> 2018-12-02 12:04:07 root@dipsy ~
>>> # service samba status
>>> * samba.service
>>>     Loaded: masked (/dev/null; bad)
>>>     Active: inactive (dead)
> ...
> 
>> If you don't use a DC(nmbd.service) you should check the status of
>> 'smbd' and not 'samba'.
>>
>> $ systemctl status smbd
> 
> 2018-12-03 20:48:52 root@dipsy ~
> # service smbd status
> * smbd.service - Samba SMB Daemon
>    Loaded: loaded (/lib/systemd/system/smbd.service; enabled; vendor
> preset: enabled)
>    Active: active (running) since Mon 2018-12-03 12:01:03 PST; 8h ago
>      Docs: man:smbd(8)
>            man:samba(7)
>            man:smb.conf(5)
>  Main PID: 901 (smbd)
>    Status: "smbd: ready to serve connections..."
>     Tasks: 8 (limit: 4915)
>    CGroup: /system.slice/smbd.service
>            |- 901 /usr/sbin/smbd
>            |- 902 /usr/sbin/smbd
>            |- 903 /usr/sbin/smbd
>            |- 907 /usr/sbin/smbd
>            |-2199 /usr/sbin/smbd
>            |-2529 /usr/sbin/smbd
>            |-2538 /usr/sbin/smbd
>            `-3150 /usr/sbin/smbd
> 
> Dec 03 15:25:00 dipsy smbd[2530]: pam_unix(samba:session): session
> opened for user dpchrist by (uid=0)
> Dec 03 15:25:28 dipsy smbd[2530]: pam_unix(samba:session): session
> closed for user dpchrist
> Dec 03 15:28:53 dipsy smbd[2536]: pam_unix(samba:session): session
> opened for user dpchrist by (uid=0)
> Dec 03 15:29:03 dipsy smbd[2537]: pam_unix(samba:session): session
> closed for user nobody
> Dec 03 15:29:10 dipsy smbd[2536]: pam_unix(samba:session): session
> closed for user dpchrist
> Dec 03 15:29:10 dipsy smbd[2538]: pam_unix(samba:session): session
> opened for user dpchrist by (uid=0)
> Dec 03 15:29:10 dipsy smbd[2539]: pam_unix(samba:session): session
> opened for user dpchrist by (uid=0)
> Dec 03 15:29:34 dipsy smbd[2539]: pam_unix(samba:session): session
> closed for user dpchrist
> Dec 03 17:25:03 dipsy smbd[2860]: pam_unix(samba:session): session
> closed for user nobody
> Dec 03 18:47:24 dipsy smbd[3150]: pam_unix(samba:session): session
> opened for user dpchrist by (uid=0)
> 
> 
> Yes, that looks better.
> 
> 
>> If you still want to use samba.service you could try:
>>
>> $ cd /lib/systemd/system && ln -sf smbd.service samba.service
>>
>> I don't know if the above command has side effects though.
> 
> It would be nice if the package name and service name matched, but
> "service smbd status" works and I don't know systemd, so I will leave it
> alone.
> 

It is the safest approach, but you should familiorize yourself with
Systemd! :)

> 
> On 12/2/18 11:49 PM, john doe wrote:
>> Correction, 'ad-dc' is controled by the 'samba-ad-dc.service' and not
>> by the nmbd.service.
> 
> Ok.
> 
> 
> But what do the error messages mean?
> 

You can use samba in two ways:
 - Active directory domain controller (1)
 - Samba daemons and related services (smbd,nmbd,winbind) (2)


You either use one or the other.
Debian provides both possibilities that is why 'samba-ad-dc' is also
included but masked (see (3) for what "mask"ed means).

If you have a "small domain" and want to use the DC as a file server you
will still need winbind (not recommended by the samba team) (1).

>     Failed to preset unit: Unit file
> /etc/systemd/system/samba-ad-dc.service is masked.
>     /usr/bin/deb-systemd-helper: error: systemctl preset failed on
> samba-ad-dc.service: No such file or director
> 

The perl script 'deb-systemd-helper' (4) is responsible for the error
because the 'samba-ad-dc.service' is masked, but as far as I can tell,
everything is working properly though.

> 
> Should I file a bug report against the samba package?
> 

What I would do is to get in touch with the script
"author"/maintainer(4) to confirm whether it is a bug or if the error
message could be improved.


1)
https://wiki.samba.org/index.php/Setting_up_Samba_as_an_Active_Directory_Domain_Controller
2)  https://wiki.samba.org/index.php/Setting_up_Samba_as_a_Standalone_Server
3)  https://www.freedesktop.org/software/systemd/man/systemctl.html
4)
https://manpages.debian.org/stretch/init-system-helpers/deb-systemd-helper.1p.en.html


Note that this e-mail is folded by my mailer.

-- 
John Doe