FS#36341 - [samba] Add "After=network.target" in the .service file dof systemd

Attached to Project: Arch Linux
Opened by Eric Wang (enihcam) - Wednesday, 31 July 2013, 08:05 GMT
Last edited by Tobias Powalowski (tpowa) - Friday, 02 August 2013, 12:32 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Tobias Powalowski (tpowa)
Architecture All
Severity High
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

The samba daemon, when started as a service at boot with systemd, usually refuses connections from remote clients. The service starts accepting connections if restarted after boot time with

# systemctl restart smbd.service

This is probably due to the fact that the service starts before the network is properly set up, resulting in the impossibility to open port 9091 for external connections.

This is confirmed by the fact that adding the [Unit] configuration option:
After=network.target
solves the issue.
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Friday, 02 August 2013, 12:32 GMT
Reason for closing:  Not a bug
Comment by Leonid Isaev (lisaev) - Wednesday, 31 July 2013, 20:20 GMT
This is smbd.service from SVN:
------------------------------
[Unit]
Description=Samba SMB/CIFS server
After=network.target nmbd.service winbindd.service

[Service]
Type=forking
PIDFile=/var/run/smbd.pid
ExecStart=/usr/bin/smbd -D
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=multi-user.target
------------------------------
So, what exactly is the problem? For the record, I am currently using samba 3.6.13 and 4.0.7 without any issues.

Also, port 9091 usually has nothing to do with samba. IIRC this is a default port for transmission torent client. Samba and related programs need 139/tcp, 445/tcp, 137/udp and 138/udp.
Comment by Eric Wang (enihcam) - Thursday, 01 August 2013, 01:43 GMT
Sorry I copy&paste the description from a trasmission-cli bug having the same problem, and forgot to change 9091 to 139/445/137/138.
Comment by Radek Podgorny (rpodgorny) - Thursday, 01 August 2013, 13:47 GMT
...i've had such issues, too. the problem was not in samba's dependencies, but in network.target not waiting for the network to come up. i've solved it by depending on networkmanager-online (or something like that - just search) instead of just plain networkmanager.

this may be a different case of course!
Comment by Leonid Isaev (lisaev) - Thursday, 01 August 2013, 16:08 GMT
Eric, my point is not the wrong port number. Please look at my previous post. There is "After=network.target" entry in smbd.service, and always has been... I have no idea why you say otherwise.
Comment by Eric Wang (enihcam) - Friday, 02 August 2013, 00:16 GMT
Oh ok, but why smbd does not wait the network up. I use netctl.
Comment by Leonid Isaev (lisaev) - Friday, 02 August 2013, 01:23 GMT
I don't know. Because I don't know how to precisely define "network up". One thing you might try is to add "BindsTo=sys-subsystem-net-devices-<name>.device" and "After=sys-subsystem-net-devices-<name>.device"to your smbd.service ([Unit] section), assuming that <name> is the interface samba should listen on (mentioned in smb.conf). However, I'd first check your smb.conf as I think it is somehow misconfigured.

In any case, this bugreport seems to be null. If you need further help, please use the forum where you can explain your problem in detail.

Loading...