Why not using one of those proposed solutions?
For clarifying the issue, you should first decide what exactly you want… Ain’t we all?
If you can accept your shares are mounted some time after you boot and not immediately to the 1st possible second, you may create a timer/service units pair to mount them a specified time after boot.
This is the difficult way, unless you are familiar with systemd units. Nevertheless, if you choose this way, you have to learn about systemd units, and this is really worth for the future.
The easy way is to disable the wait-online service, despite @dalto questions it
Maybe another easy way is to modify the existing service Exec=
value, adding a parameter.
sudo systemctl edit systemd-networkd-wait-online.service
Write this in the editor at the top:
[Service]
ExecStart=
ExecStart=/usr/lib/systemd/systemd-networkd-wait-online --any
Then run systemctl daemon-reload
or reboot.
For understanding the problem, you might want to read relevant man pages of those service units and upstream docs.
In short, the wait-online service waits for every network connection to complete, before succeeding. --any
tells it to wait for only one connection.
It is a known issue and systemd gurus suggest that admins (Linux users, in our terms) should fix their connections/services, not disable wait-online, but they will not get angry if we do (my wording…).
https://systemd.io/NETWORK_ONLINE/
man systemd-networkd-wait-online
man NetworkManager-wait-online.service # the same issue for NM, man and service
systemctl cat NetworkManager-wait-online.service # they wrote info inside the service
Creating a service, as described in Samba might not be a bad idea, but the easy way is as above.