I want to automatically connect to wifi and an openvpn connection on startup and resume. I am able to connect to my wifi network automatically on startup. I am also able to select and connect to my VPN manually after logging in.

I selected Automatically connect to this VPN when using this connection for my wifi connection in the Network Connections settings menu (I ran nm-connection-editor to open it).

When I start up, I see the icons on the top right of the taskbar repeatedly toggle the Wifi and Openvpn icons, followed by error messages stating that it failed to establish a connection.

I'm running Ubuntu 18.04 on an HP ENVY x360.

Network device info:

       description: Wireless interface
       product: Wireless 7265
       vendor: Intel Corporation
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: wlo1
       version: 61
       serial: 7c:b0:c2:f8:8d:29
       width: 64 bits
       clock: 33MHz
       capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=iwlwifi driverversion=4.15.0-46-generic firmware=29.1044073957.0 ip= latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:156 memory:df100000-df101fff
       description: Ethernet interface
       physical id: 2
       logical name: docker0
       serial: 02:42:b1:a1:76:c3
       capabilities: ethernet physical
       configuration: broadcast=yes driver=bridge driverversion=2.3 firmware=N/A ip= link=no multicast=yes

The actual steps depend on how OpenVPN was installed, but if it was installed via the package manager (vs built manually or tarball), there should be a startup script already available. If your (single) config file is in /etc/openvpn/, it should be used to start your OpenVPN daemon (background process).


  1. https://openvpn.net/community-resources/how-to/#configuring-openvpn-to-run-automatically-on-system-startup
  2. in the past, I recall the extension had to be .conf on linux, and .opvn on windows? (going off memory, I've used several OS's w/ OpenVPN)
  3. add only a single config file to that directory, because by default (it's configurable), openvpn is going to start all config files located there: see /etc/default/openvpn & /etc/init.d/openvpn
  4. This also assumes the authentication info is supplied in the ovpn config file.

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.