Package: openvpn
Version: 2.3.4-5+deb8
I am doing this in /etc/network/interfaces:
auto wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
openvpn client
which will bring me up the systemd [email protected] service on
boot.
I want to mount an nfs export on boot which is only reachable over vpn.
since nameserver resolution is not working before vpn is up, the
mounting fails if started too early.
I know I can use /etc/fstab to dynamically create a mount unit for
systemd, but in order to investigate my problem I created no fstab
entry but instead created this one manually:
root@m2:/etc/systemd/system# cat home.mount
[Unit]
[email protected]
[Mount]
What=nfs.my.lan:/home
Where=/home
Type=nfs
Options=nolock,nosuid,nodev,nfsvers=3
[Install]
[email protected]
This makes sure that the mounting takes place after the vpn is really
up. Then I systemctl enable home.mount
After that I reboot and investigate journalctl afterwards (only the
interesting entries are shown here):
Mär 08 15:11:35 m2 systemd[1]: Starting OpenVPN connection to client...
Mär 08 15:11:36 m2 systemd[1]: Started OpenVPN connection to client.
Mär 08 15:11:36 m2 systemd[1]: Mounting /home...
Mär 08 15:11:36 m2 systemd[1]: Failed to mount /home.
Mär 08 15:11:50 m2 ovpn-client[678]: Initialization Sequence Completed
As you see, the [email protected] is in started state before
openvpn is reporting initialization sequence completed. for this
reason /home is mounted too early and fails.
Is it somehow possible to write
the /lib/systemd/system/[email protected] in a way that it reports
started only after initialization sequence is really completed?
(maybe openvpn can somehow write a temporary file when really finished
which systemd then tries to load to say yes we are really started, but
that one is just an idea...)
this bug report might be related to #681961.
cya
erik