Whenever I reboot my RPi, the openvpn service fails to start. The relevant line from the log says: [...] TCP/UDP: Socket bind failed on local address [AF_INET] Cannot assign requested address (Full log here)

When I start the service manually (with openvpn /etc/openvpn/ovpnserver.conf) it starts properly though.

My RPi is properly setup with a static IP (, so I'm guessing that the IP isn't properly configured when it tries to start the openvpn service on start-up. Is there a way to check/fix this?

  • how do you start your service? /etc/rc.local or services? – Gotschi Nov 8 '15 at 8:57
  • I looked around /etc/init.d and found a script called openvpn with these contents. I'm not terribly familiar with linux so I'm not sure if I can find it elsewhere. I saw no mention of it in rc.local. – ricekab Nov 9 '15 at 0:48
  • if you are using Raspbian you can use raspi-config to wait for the network to be up before continuing to boot. – Steve Robillard Apr 14 '16 at 9:26

Add this to sudo crontab -e: @reboot sleep 20; /etc/init.d/openvpn start

...this is a delayed restart of openvpn when the pi starts.

  • Explain to the original poster what this command does... – tlhIngan Oct 11 '16 at 0:01
  • Pretty straight forward, but done. – Mobalized Oct 11 '16 at 15:18
  • Having tried all sorts of different After= and Wants= in the SystemD unit file for OpenVPN without fixing the problem, this was the solution that worked. Of course you should also disable the OpenVPN unit with systemctl disable openvpn, so it doesn't try starting it twice. – Ola Tuvesson Jan 15 at 12:10

Comment out the line with local in your openvpnserver.conf file and it will probably work after a reboot.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.