0

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]192.168.1.2:1194: 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 (192.168.1.2), 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?

3
  • how do you start your service? /etc/rc.local or services?
    – Gotschi
    Nov 8, 2015 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, 2015 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. Apr 14, 2016 at 9:26

2 Answers 2

2

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.

3
  • Explain to the original poster what this command does...
    – tlhIngan
    Oct 11, 2016 at 0:01
  • Pretty straight forward, but done.
    – Mobalized
    Oct 11, 2016 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. Jan 15, 2021 at 12:10
-2

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 and acknowledge you have read our privacy policy.

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