Samba NMB Deamon sometimes fails to activate

I use Samba for one task only, to transfer files from my Manjaro laptop to an old Windows 7 machine in my workshop that drives the CNC machines.

My configuration is described in this topic, the last post: Trying to set up a shared public folder with Samba ("Windows cannot access //COMPUTERNAME")

Sometimes (rather unpredictably, at least to my pattern recognizing abilities), but often enough to be an inconvenience, this workshop machine fails to see my laptop listed in the workgroup, as if it was not powered on.

Manually running sudo systemctl enable --now smb nmb typically fixes the issue, so this is more of a minor inconvenience than a real problem.

However, last time this happened (20 minutes ago), instead of running the above command I tried systemctl --failed just to see what's going on:

  UNIT        LOAD   ACTIVE SUB    DESCRIPTION
● nmb.service loaded failed failed Samba NMB Daemon

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

1 loaded units listed.

Of course, after running sudo systemctl enable --now nmb the problem was fixed (at least temporarily) and systemctl --failed returned the usual "0 loaded units listed".

Is there a more permanent fix for this? Like I said, it's not a major issue, but an inconvenience. I don't even know how to reproduce the problem, sometimes it works, sometimes it doesn't.

Powersaving?

Wifi powered off when it happens?

Hmm... Possibly. I'll try to put my laptop to sleep and see if the issue appears again.

It's not a wifi issue, wifi is working fine when this happens (I am connected to the router and I have internet access).

try checking the log in a terminal

journalctl -f -u nmb.service -o cat -p info --no-pager --no-full

I tried putting my laptop to sleep, there was no issue. I can't reproduce it now (I guess I shouldn't complain that everything works :grin:).

Here is the recent part of the log:

log
[2019/10/09 19:48:25.316758,  0] ../../source3/nmbd/nmbd_subnetdb.c:253(create_subnets)
nmb.service: Start operation timed out. Terminating.
audit: type=1130 audit(1570643392.772:43): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
nmb.service: Main process exited, code=killed, status=15/TERM
nmb.service: Failed with result 'timeout'.
  daemon_status: daemon 'nmbd' : No local IPv4 non-loopback interfaces available, waiting for interface ...
[2019/10/10 06:42:42.397893,  0] ../../source3/nmbd/nmbd_subnetdb.c:253(create_subnets)
nmb.service: Start operation timed out. Terminating.
nmb.service: Main process exited, code=killed, status=15/TERM
nmb.service: Failed with result 'timeout'.
SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
audit: type=1130 audit(1570682649.376:46): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'
kresimir : TTY=pts/1 ; PWD=/home/kresimir ; USER=root ; COMMAND=/usr/bin/systemctl enable --now smb nmb
audit: type=1130 audit(1570694843.897:69): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
  daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
  daemon_status: daemon 'nmbd' : No local IPv4 non-loopback interfaces available, waiting for interface ...
[2019/10/10 10:42:47.324114,  0] ../../source3/nmbd/nmbd_subnetdb.c:253(create_subnets)
  daemon_ready: daemon 'nmbd' finished starting up and ready to serve connections
SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
audit: type=1130 audit(1570697017.326:55): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=nmb comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'

From the log it appears the nmb daemon times out due to missing network.

That is probably why you have to start the service manually.

sudo systemctl start nmb

For services that requires an active network to start you could try enabling the NetworkManager-wait-online.service - assuming you are using Network Manager.

sudo systemctl enable --now NetworkManager-wait-online

I just looked at systemctl -a | grep NetwokManager and it seems that it is already loaded and active:

  NetworkManager-wait-online.service                                    loaded    active     exited    Network Manager Wait Online
  NetworkManager.service                                                loaded    active     running   Network Manager

So sudo systemctl enable --now NetworkManager-wait-online does nothing.

I guess I'll just re-enable it manually when/if it fails again. It's not a big deal. I was just wondering if there is something obvious I'm missing.

Forum kindly sponsored by