[Pkg-samba-maint] Bug#882482: samba: says "Failed to preset unit" and deb-systemd-helper error on installation)

Julian Gilbey jdg at debian.org
Thu Nov 23 15:03:47 UTC 2017


reopen 882482
tags 882482 +patch
thanks

(See explanation for reopening below.)

> > I have no idea why /etc/systemd/system/samba-ad-dc.service symlinks to
> > /dev/null; I have no recollection of doing this myself.
> 
> This is on purpose. The service is masked on installation when not needed.
> 
> See https://anonscm.debian.org/cgit/pkg-samba/samba.git/tree/debian/samba.postinst#n38
> 
> I'm closing this bug.

Hi Mathieu,

That makes sense, thanks!

I'm reopening this bug report, because I believe that the warning
should appear during every postinst, not only the first time that the
symlink is set up.  (I would have seen this warning only once,
somewhat over a year ago?)  So modifying the postinst snippet to read
something like the following would be an improvement.  (I've added an
elif clause, and changed -service to .service in the messages.)

If you disagree with this assessment, please feel free to close this
report again, but I do think this postinst would be friendlier!

if [ "$SERVER_ROLE" != "active directory domain controller" ] \
	&& ( echo "$SERVER_SERVICES" | grep -qv '\(^\|, \)smb\(,\|$\)' ) \
	&& ( echo "$DCERPC_ENDPOINT_SERVERS" | grep -qv '\(^\|, \)remote\(,\|$\)' ) \
	&& ( echo "$DCERPC_ENDPOINT_SERVERS" | grep -qv '\(^\|, \)mapiproxy\(,\|$\)' ) \
; then
    if [ ! -e /etc/systemd/system/samba-ad-dc.service ]; then
        mkdir -p /etc/systemd/system
        echo "Samba is not being run as an AD Domain Controller, masking samba-ad-dc.service."
        echo "Please ignore the following error about deb-systemd-helper not finding samba-ad-dc.service."
        ln -s /dev/null /etc/systemd/system/samba-ad-dc.service
        # In case this system is running systemd, we make systemd reload the unit files
        # to pick up changes.
        if [ -d /run/systemd/system ] ; then
            systemctl --system daemon-reload >/dev/null || true
        fi
    elif [ -h /etc/systemd/system/samba-ad-dc.service ] \
	&& [ "`realpath /etc/systemd/system/samba-ad-dc.service`" = /dev/null ] ; then
        echo "Samba is not being run as an AD Domain Controller."
        echo "Please ignore the following error about deb-systemd-helper not finding samba-ad-dc.service."
    fi
fi



Best wishes,

   Julian



More information about the Pkg-samba-maint mailing list