On Tue, Jun 20, 2017 at 10:00:14AM +0200, g...@posteurs.com wrote: > The problem is that systemd does not wait for DHCP addresses to be > obtained. > Being new to systemd I could not succeed in finding the right parameters > and dependencies in order to have the mounts wait till we have an IP > address. > I tried remote-fs.target, network-online.target, and other hacks with no > success.
I can't help with CIFS mounts from fstab specifically, but I did learn a thing or two about network-online.target in Debian due to a similar issue with nfs-kernel-server. network-online.target only cares about interfaces that are listed as "auto" in /etc/network/interfaces. Not allow-hotplug. It has to be auto. Once you mark your interfaces as auto instead of allow-hotplug, then you can create a dependency on network-online.target and have it actually work. I did so for the nfs-kernel-server package, which uses a systemd service named nfs-server with an alias of nfs-kernel-server... and yes, it took me a while to figure *that* mess out too. Lesson #2: never try to create a drop-in override for an *alias* name of a service. You must determine the actual non-alias name first. $ systemctl status nfs-server * nfs-server.service - NFS server and services Loaded: loaded (/lib/systemd/system/nfs-server.service; enabled; vendor prese Drop-In: /etc/systemd/system/nfs-server.service.d `-waitlonger.conf Active: active (exited) since Mon 2017-06-19 08:22:36 EDT; 23h ago Process: 522 ExecStart=/usr/sbin/rpc.nfsd $RPCNFSDARGS (code=exited, status=0/ Process: 519 ExecStartPre=/usr/sbin/exportfs -r (code=exited, status=0/SUCCESS Main PID: 522 (code=exited, status=0/SUCCESS) Tasks: 0 (limit: 4915) CGroup: /system.slice/nfs-server.service $ cat /etc/systemd/system/nfs-server.service.d/waitlonger.conf [Unit] Wants= network-online.target After= network-online.target See <https://bugs.debian.org/860264> for more details.