nmbd starts fine with no interfaces, but doesn't notify systemd that it started

Bug #1731502 reported by jesse garner on 2017-11-10
52
This bug affects 6 people
Affects Status Importance Assigned to Milestone
samba
Unknown
Unknown
samba (Ubuntu)
Medium
Unassigned

Bug Description

nmbd seems to start fine when there are no non-loopback interfaces up, and will loop indefinitely:

        /* We only count IPv4, non-loopback interfaces here. */
        while (iface_count_v4_nl() == 0) {
            sleep(5);
            load_interfaces();
        }

It can happen that during boot there is really no interface available, because, for example, it's a desktop connected via wifi and the wireless connection is only established after the user logs in.

nmbd will happily start up and wait for an interface, but systemd is expecting a notification because the Type is set to notify:
$ cat packaging/systemd/nmb.service
[Unit]
Description=Samba NMB Daemon
After=syslog.target network.target

[Service]
Type=notify
(...)

So after about 1m30s without a notification from nmbd, systemd will just kill it:

Oct 30 14:25:51 artful-samba-init systemd[1]: nmbd.service: Supervising process 171 which is not our child. We'll most likely not notice when it exits.
...
Oct 30 14:27:21 artful-samba-init systemd[1]: nmbd.service: Start operation timed out. Terminating.
Oct 30 14:27:21 artful-samba-init systemd[1]: nmbd.service: Killing process 171 (nmbd) with signal SIGKILL.
Oct 30 14:27:21 artful-samba-init systemd[1]: nmbd.service: Killing process 171 (nmbd) with signal SIGKILL.
Oct 30 14:27:21 artful-samba-init systemd[1]: Failed to start Samba NMB Daemon.
Oct 30 14:27:21 artful-samba-init systemd[1]: nmbd.service: Unit entered failed state.
Oct 30 14:27:21 artful-samba-init systemd[1]: nmbd.service: Failed with result 'timeout'.

--- Original description ---

ProblemType: Package
DistroRelease: Ubuntu Kylin 17.10
Package: samba 2:4.6.7+dfsg-1ubuntu3 [origin: Ubuntu]
ProcVersionSignature: Ubuntu 4.13.0-17.20-lowlatency 4.13.8
Uname: Linux 4.13.0-17-lowlatency x86_64
ApportVersion: 2.20.7-0ubuntu3.2
Architecture: amd64
Date: Fri Nov 10 09:51:44 2017
ErrorMessage: subprocess installed post-installation script returned error exit status 1
InstallationDate: Installed on 2017-10-19 (22 days ago)
InstallationMedia: Ubuntu-Studio 17.04 "Zesty Zapus" - Release amd64 (20170412)
Python3Details: /usr/bin/python3.6, Python 3.6.3, python3-minimal, 3.6.3-0ubuntu2
PythonDetails: /usr/bin/python2.7, Python 2.7.14, python-minimal, 2.7.14-2ubuntu1
RelatedPackageVersions:
 nautilus 1:3.26.0-0ubuntu1
 gvfs 1.34.1-1ubuntu1
SambaClientRegression: No
SourcePackage: samba
Title: package samba 2:4.6.7+dfsg-1ubuntu3 [origin: Ubuntu] failed to install/upgrade: subprocess installed post-installation script returned error exit status 1
UpgradeStatus: No upgrade log present (probably fresh install)

jesse garner (jgarner420) wrote :

Thanks for taking the time to report this bug and helping to make Ubuntu better. We appreciate the difficulties you are facing, but this appears to be a "regular" (non-security) bug. I have unmarked it as a security issue since this bug does not show evidence of allowing attackers to cross privilege boundaries nor directly cause loss of data/privacy. Please feel free to report any other bugs you may find.

information type: Private Security → Public
tags: removed: need-duplicate-check

Thanks for filing this bug in Ubuntu.

Job for nmbd.service failed because a timeout was exceeded.
See "systemctl status nmbd.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nmbd, action "start" failed.
● nmbd.service - Samba NMB Daemon
   Loaded: loaded (/lib/systemd/system/nmbd.service; enabled; vendor preset: enabled)
   Active: failed (Result: timeout) since Fri 2017-11-10 09:51:44 CST; 32ms ago
     Docs: man:nmbd(8)
           man:samba(7)
           man:smb.conf(5)
 Main PID: 8674
   Status: "nmbd: No local IPv4 non-loopback interfaces available, waiting for interface ..."

What happened is that systemd gave up waiting for nmbd to notify it that it started up fully. In this case, nmbd didn't make that notification because there was no networking available.

While nmbd can and will just wait forever, systemd is expecting a notification and if one doesn't arrive in 90s it will decide the service failed to start.

I believe in your case this is happening because you only get networking after you login on your system, probably via wifi.

I filed this bug upstream in samba about this problem: https://bugzilla.samba.org/show_bug.cgi?id=13111

I will use this Ubuntu bug to track this issue.

summary: - package samba 2:4.6.7+dfsg-1ubuntu3 [origin: Ubuntu] failed to
- install/upgrade: subprocess installed post-installation script returned
- error exit status 1
+ nmbd starts fine with no interfaces, but doesn't notify systemd that it
+ started
Changed in samba (Ubuntu):
status: New → Triaged
importance: Undecided → Low
description: updated
Changed in samba (Ubuntu):
importance: Low → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

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