/usr/bin/deb-systemd-helper: error: systemctl preset failed on samba-ad-dc.service: No such file or directory

Bug #1610361 reported by dino99
166
This bug affects 37 people
Affects Status Importance Assigned to Milestone
samba (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

This is an error seen with that version upgrade; so the apport questions can be ignored as this is an upgrade issue, not a using problem.

Unpacking samba (2:4.4.5+dfsg-2ubuntu3) over (2:4.4.5+dfsg-2ubuntu1) ...

....

Setting up samba (2:4.4.5+dfsg-2ubuntu3) ...
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 directory

note: the previous 4.4.5+dfsg-2ubuntu1 upgrade over 4.3.9+dfsg-0ubuntu1 was clean. These two upgrades has been made on the same session (no reboot); so this can be related if systemd expect some activation(s) not made by the previous upgrade.

ProblemType: Bug
DistroRelease: Ubuntu 16.10
Package: samba 2:4.4.5+dfsg-2ubuntu3
ProcVersionSignature: Ubuntu 4.7.0-0.3-generic 4.7.0
Uname: Linux 4.7.0-0-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.3-0ubuntu5
Architecture: amd64
CurrentDesktop: GNOME
Date: Fri Aug 5 19:30:09 2016
RelatedPackageVersions:
 nautilus 1:3.20.1-3ubuntu1~yakkety1
 gvfs 1.28.2-1ubuntu1
SambaClientRegression: Yes
SourcePackage: samba
UpgradeStatus: No upgrade log present (probably fresh install)

Revision history for this message
dino99 (9d9) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in samba (Ubuntu):
status: New → Confirmed
Revision history for this message
Ertan Günay (ergunay) wrote :

Hi
I've same problem
I need samba functions
But I couldn't start smbd service
So do you have a solution for that

Thanks
Ert

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

This is the change that masked the service:
samba (2:4.4.4+dfsg-2) unstable; urgency=medium
   * Mask samba-ad-dc.service unless needed (Closes: #828137)

So all the change isin the scope of the 4.3.9+dfsg-0ubuntu1 -> 4.4.5+dfsg-2ubuntu1 you mentioned before.

But one also has to consider: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=796789 which added the service to be in the same "update-window".

It should update all services fine as it takes care of e.g. to call "systemctl --system daemon-reload" after the changes.
And also the update you are currently doing 4.4.5+dfsg-2ubuntu1 -> 4.4.5+dfsg-2ubuntu3 didn't touch these services at all.

I'd assume that this is the first time the helpers kick in to clean up and mask it.
The postinst really makes sure it is not run :-)
It symlinks it to /dev/null and also masks it.
But if you have no system with a service like that the symlink is already enough and so the additional masking fails with the errors you report.

I recreated the issue and can state that the message itself is shown on a clean yakkety installing samba:
Created symlink /etc/systemd/system/multi-user.target.wants/nmbd.service → /lib/systemd/system/nmbd.service.
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 directory
Created symlink /etc/systemd/system/multi-user.target.wants/smbd.service → /lib/systemd/system/smbd.service.
Processing triggers for libc-bin (2.24-0ubuntu1) ...

It appears to me that this was just taken to make sure it is off by doing it two ways.
Probably for certain upgrade paths that have the file around not applicable to your case nor my fresh install.

But OTOH this is non fatal for me.
The install/upgrade is not aborting or anything.

Are you missing any functionality due to this?

Revision history for this message
Christian Ehrhardt  (paelzer) wrote :

@Ertan - this bug is not on "couldn't start smbd service"
If that is your issue please file a new bug providing more information on your case. you may find it helpful to read "How to report bugs effectively" http://www.chiark.greenend.org.uk/~sgtatham/bugs.html.

Changed in samba (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
dino99 (9d9) wrote :

@Christian

by curiosity, i've retested the reinstallation of the latest 4.4.5 yakkety 64 bits (with synaptic) and also get the error on reinstalling the package:

....
Setting up samba (2:4.4.5+dfsg-2ubuntu5) ...
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 directory

1) does that means something needs to be fixed with systemd ?
2) but there is no seen bad effect at using samba (does not means all is perfect)

Changed in samba (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Nish Aravamudan (nacc) wrote :

@dino99: as Christian mentioned, this is not a fatal error, these are warnings that one of the two ways that the package is using to ensure the specific service is masked id not succeed. Presumably the other one did. As your 2) points out (I believe), there is no ill-effect in the installation of the package itself and the service is (presumably) correctly masked.

@martin-suc: I'm unsure why you changed the status of this bug? As of right now after Christian's debugging, it is not clear if there is any issue here.

Changed in samba (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Marco Plaut (marcoplaut) wrote :

Yup, non fatal, never the less... it's a pain having to wait several seconds to see that error every time an "apt-get install" is issued.

Revision history for this message
Lastique (andysem) wrote :

I've changed this to Confirmed because it broke the upgrade from Yakkety to Zesty for me. The upgrade process stopped after the package updating step, with this message:

Upgrade complete

The upgrade has completed but there were errors during the upgrade
process.

It didn't offer to remove obsolete packages or reboot.

Changed in samba (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Lastique (andysem) wrote :

I'll add that apparently the upgrading process did not fully complete either because `apt-get dist-upgrade` still had lots of packages left to upgrade.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

I tried several combinations of fresh installs and upgrades. The "error" is always there, but doesn't translate to an exit status different than zero. In fact, debian and artful (synced from debian) now workaround the error by basically asking the admin to ignore it (https://anonscm.debian.org/cgit/pkg-samba/samba.git/commit/?id=61eaeba2a7a2df61b681b4ea545811569de421d0).

I then tried release upgrades:
- yakkety -> zesty
- xenial -> yakkety -> zesty

In both cases I used a working samba setup (tested with smbclient //SERVER/homes -U ubuntu%ubuntu), and it all went fine. There were no errors reported by do-release-upgrade or apt/dpkg, despite the deb-systemd-helper complaint being on the screen and logs. It just wasn't fatal.

In fact, all deb-systemd-helper calls in postinst have this "suffix": || true

I also tried with systems where I disabled updates and security and installed the version that came out in main, and then upgraded, and that also worked.

Either the package that had the problem is no longer available (could have been an upgrade that was superseeded), or I'm not hitting the exact same conditions for some reason. Maybe debhelper started adding the "|| true" to the end of deb-systemd-helper calls is what "fixed" this for now.

Therefore, I'm marking this bug as incomplete pending further details. If this still happens to any of you, do please chime in and let's get it fixed.

Changed in samba (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Urop (urop) wrote :

I just received the same error message upgrading from 2:4.5.8+dfsg-0ubuntu0.17.04.3 on Ubuntu 17.04:

Setting up samba (2:4.5.8+dfsg-0ubuntu0.17.04.4) ...
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 directory

To someone that isn't a "samba installation process expert", but who understands plain English, this message is very clear: The installer attempted to do something but it failed and as a result an error occurred. Thus, even if Samba appears superficially to be working, it may not be. It might have caused some subtle problem that will come back to bite later.

So, irrespective of exit status; if, as described above, this message does NOT actually indicate an error condition (because some other action intended to achieve the same thing succeeded), then the fact that it is displayed at all is a bug. For as long as it's there, people like me will keep spending time investigating and reporting it in places like this. It should be fixed so as not to waste everyone's time; even if that does just involve outputting a message like "About to try something as a fallback in case a previous step failed. A 'systemctl preset failed message' is expected so please ignore it." first.

In post #7 Nish mentions that the installer is attempting "two ways that the package is using to ensure the specific service is masked". What the installer should really be doing is testing whether each of these attempts succeeded and only outputting an error message if both fail (and probably also, only trying the second method if the first failed). Perhaps this is technically difficult or even impossible to achieve, I don't know, but it seems that ought to be the solution.

Revision history for this message
Andreas Hasenack (ahasenack) wrote :

> should be fixed so as not to waste everyone's time; even if that does just involve outputting a
> message like "About to try something as a fallback in case a previous step failed. A 'systemctl
> preset failed message' is expected so please ignore it." first.

That's exactly what was done in the most recent version:

        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."

I agree it's not optimal, and we should probably keep this bug open because of that. But it's definitely not a fatal error, and if something broke, the real error is elsewhere.

dino99 (9d9)
Changed in samba (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.