You are not logged in.

#1 2012-08-19 00:07:47

Kaurin
Member
From: Ireland
Registered: 2011-12-11
Posts: 66

[SOLVED] nmbd fails via systemd on boot, crippling samba

Title says it all.

I have smbd.service and winbindd.service running, but nmbd.service fails on each boot.

When i do the following:

# stopping currently active services
systemctl stop smbd.service
systemctl stop winbindd.service

# start nmbd first
systemctl start nmbd.service

# start the other two
systemctl start smbd.service
systemctl start winbindd.service

then everything works

Has anyone else had this issue, and what is the best way to get this to work on boot?


Edit: Samba works fine as stated, and it also worked fine via sysvinit

Last edited by Kaurin (2012-08-19 11:00:22)

Offline

#2 2012-08-19 11:00:10

Kaurin
Member
From: Ireland
Registered: 2011-12-11
Posts: 66

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

Kind people on #archlinux helped me troubleshoot.

Here are the steps:

# systemctl status nmbd.service
nmbd.service - Samba NetBIOS name server
	  Loaded: loaded (/usr/lib/systemd/system/nmbd.service; enabled)
	  Active: failed (Result: exit-code) since Sun, 19 Aug 2012 14:35:07 +0200; 1min 8s ago
	 Process: 324 ExecStart=/usr/sbin/nmbd -F (code=exited, status=1/FAILURE)
	  CGroup: name=systemd:/system/nmbd.service


# systemctl status winbindd.service
winbindd.service - Samba Winbind daemon
	  Loaded: loaded (/usr/lib/systemd/system/winbindd.service; enabled)
	  Active: active (running) since Sun, 19 Aug 2012 14:35:02 +0200; 2min 52s ago
	Main PID: 331 (winbindd)
	  CGroup: name=systemd:/system/winbindd.service
		  ├ 331 /usr/sbin/winbindd -F
		  └ 366 /usr/sbin/winbindd -F


# systemctl status smbd.service
smbd.service - Samba SMB/CIFS server
	  Loaded: loaded (/usr/lib/systemd/system/smbd.service; enabled)
	  Active: active (running) since Sun, 19 Aug 2012 14:35:02 +0200; 3min 15s ago
	Main PID: 330 (smbd)
	  CGroup: name=systemd:/system/smbd.service
		  ├ 330 /usr/sbin/smbd -F
		  └ 365 /usr/sbin/smbd -F


# cat /var/log/everything.log | grep -i nmbd
Aug 12 20:25:20 localhost nmbd[962]: [2012/08/12 20:25:20.022259,  0] nmbd/nmbd.c:66(terminate)
Aug 12 20:25:20 localhost nmbd[962]:   Got SIGTERM: going down...


# cat /var/log/samba/log.nmbd
[2012/08/19 14:35:05,  0] nmbd/nmbd.c:861(main)
  nmbd version 3.6.7 started.
  Copyright Andrew Tridgell and the Samba Team 1992-2011
[2012/08/19 14:35:06,  0] nmbd/nmbd.c:889(main)
  standard input is not a socket, assuming -D option
[2012/08/19 14:35:06,  0] lib/util_sock.c:667(open_socket_in)
  bind failed on port 137 socket_addr = 192.168.1.2.
  Error = Cannot assign requested address
[2012/08/19 14:35:06,  0] nmbd/nmbd_subnetdb.c:113(make_subnet)
  nmbd_subnetdb:make_subnet()
    Failed to open nmb socket on interface 192.168.1.2 for port 137.  Error was Cannot assign requested address
[2012/08/19 14:35:06,  0] nmbd/nmbd.c:975(main)
  ERROR: Failed when creating subnet lists. Exiting.

We can see that nmbd exits because it can't bind to an interface. I use NetworkManager and have samba set up so it binds to that particular interface.

I fixed the problem by adding  After=network.target in the [Unit] section of /usr/lib/systemd/system/nmbd.service

I have also submitted a feature request on the arch bugtracker https://bugs.archlinux.org/task/31192

Last edited by Kaurin (2012-08-19 12:30:23)

Offline

#3 2012-08-19 12:18:13

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

Doesn't those .service files belong to respective packages? I'm pretty new to systemd.
What if a new package is updated with a modified/incompatible .service file? will you be forced to edit that file again?

...That's not nice, doesn't systemd provide a way to override the service start order other than hacking the package files?

Last edited by kokoko3k (2012-08-19 12:18:32)


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#4 2012-08-19 12:31:31

Kaurin
Member
From: Ireland
Registered: 2011-12-11
Posts: 66

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

This particular .service file was created by the samba package maintainer. Samba upstream does not have those files bundled. 

Hopefully, that will change.

Offline

#5 2012-08-19 14:33:48

kokoko3k
Member
Registered: 2008-11-14
Posts: 2,390

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

but even if samba upstream decides to ship a .service file, i doubt your issue will be solved without manual intervention to that file...


Help me to improve ssh-rdp !
Retroarch User? Try my koko-aio shader !

Offline

#6 2012-08-19 15:05:17

ZekeSulastin
Member
Registered: 2010-09-20
Posts: 266

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

My guess would be that ensuring nmbd is only brought up after the network will become a part of any standard service wink

Also, if you plan on editing a provided service file (or making your own!), the proper method is to copy it to/make it in /etc/systemd/system/ - services and such in /etc/... take precedence over those in /usr/... and are not touched by pacman.  This is also where systemctl {en,dis}able makes its symlinks.

To see what config files in /usr are currently being overriden by files in /etc, you can use the command $ systemd-delta.  It produces an output like the following (I copied over adb.service as a demo):

 └$ systemd-delta
[REDIRECTED]   /etc/systemd/system/default.target → /usr/lib/systemd/system/default.target
[OVERRIDDEN] /etc/systemd/system/adb.service → /usr/lib/systemd/system/adb.service

Files /usr/lib/systemd/system/adb.service and /etc/systemd/system/adb.service are identical


2 overridden configuration files found.

If you roll your own services or modifications, systemd-delta is a good thing to get familiar with smile

Last edited by ZekeSulastin (2012-08-19 15:08:08)

Offline

#7 2012-08-19 17:03:42

Kaurin
Member
From: Ireland
Registered: 2011-12-11
Posts: 66

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

I'm kind of new to systemd. These things are nice to know!


Thank you!

# systemd-delta 
[OVERRIDDEN] /etc/systemd/system/nmbd.service → /usr/lib/systemd/system/nmbd.ser

--- /usr/lib/systemd/system/nmbd.service        2012-08-07 11:12:32.000000000 +0
+++ /etc/systemd/system/nmbd.service    2012-08-19 19:10:19.576070075 +0200
@@ -1,5 +1,6 @@
 [Unit]
 Description=Samba NetBIOS name server
+After=network.target
 
 [Service]
 ExecStart=/usr/sbin/nmbd -F

[OVERRIDDEN] /etc/modprobe.d/nvidia.conf → /usr/lib/modprobe.d/nvidia.conf

Files /usr/lib/modprobe.d/nvidia.conf and /etc/modprobe.d/nvidia.conf are identi


2 overridden configuration files found.

Last edited by Kaurin (2012-08-19 17:11:30)

Offline

#8 2012-10-30 07:14:27

MisterAnderson
Member
Registered: 2011-09-04
Posts: 285

Re: [SOLVED] nmbd fails via systemd on boot, crippling samba

My nmdb.service is failing to load even with the modification. In the journal it appears to fail, then networkmanager sets up the interfaces so it doesn't appear to be waiting even with the option.
EDIT: I'll start a new thread on this.

Last edited by MisterAnderson (2012-11-01 11:09:30)


D:

Offline

Board footer

Powered by FluxBB