2

tl;dr

How can I get a systemd unit to depend on a network service coming from another host?

Question

My samba service on sambaserver failed to start, because that host started up faster than dns2.ipa.example.com.

[root@sambaserver|/root]# systemctl status smb -l
● smb.service - Samba SMB Daemon
   Loaded: loaded (/usr/lib/systemd/system/smb.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2017-10-03 22:27:35 EDT; 2 days ago
  Process: 1752 ExecStart=/usr/sbin/smbd $SMBDOPTIONS (code=exited, status=1/FAILURE)
 Main PID: 1752 (code=exited, status=1/FAILURE)
   Status: "Starting process..."

Oct 03 22:27:35 sambaserver.ipa.example.com smbd[1752]:   failed to bind to server ldaps://dns1.ipa.example.com ldaps://dns2.ipa.example.com with dn="[Anonymous bind]" Error: Local error
Oct 03 22:27:35 sambaserver.ipa.example.com smbd[1752]:           (unknown)
Oct 03 22:27:35 sambaserver.ipa.example.com smbd[1752]: [2017/10/03 22:27:35.669369,  0, pid=1752] ipa_sam.c:4507(pdb_init_ipasam)
Oct 03 22:27:35 sambaserver.ipa.example.com smbd[1752]:   Failed to get base DN.
Oct 03 22:27:35 sambaserver.ipa.example.com smbd[1752]: [2017/10/03 22:27:35.669405,  0, pid=1752] ../source3/passdb/pdb_interface.c:180(make_pdb_method_name)
Oct 03 22:27:35 sambaserver.ipa.example.com smbd[1752]:   pdb backend ipasam:ldaps://dns1.ipa.example.com ldaps://dns2.ipa.example.com did not correctly init (error was NT_STATUS_UNSUCCESSFUL)
Oct 03 22:27:35 sambaserver.ipa.example.com systemd[1]: smb.service: main process exited, code=exited, status=1/FAILURE
Oct 03 22:27:35 sambaserver.ipa.example.com systemd[1]: Failed to start Samba SMB Daemon.
Oct 03 22:27:35 sambaserver.ipa.example.com systemd[1]: Unit smb.service entered failed state.
Oct 03 22:27:35 sambaserver.ipa.example.com systemd[1]: smb.service failed.

The devices are physical, and old, so working with these specific hosts, is there a way I can make the system unit smb.service wait for the network service of ldaps://dns2.ipa.example.com?

I suppose I could try writing a wrapper script and drop it in the ExecStartPre string, but that doesn't seem to be as clean as it could be.

How can I get my systemd unit file to have as a dependency a service (or systemd unit) from another host on the network?

1 Answer 1

1

No, you can't do that cleanly. instead Increase "ldap connection timeout =" timeout in smb.conf so samba takes a longer time to fail if the connection cannot be made.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .