Remove redundant openvpn config service from Systemd

5,888

Check the /etc/default/openvpn file to see if you've got it in the AUTOSTART section, eg. AUTOSTART="login". If not, the default is "all" in your openvpn path, eg. /etc/openvpn/. Any .conf file in that directory will trigger an attempt at starting that specifically named service. For example, /etc/openvpn/login.conf.

I just had this exact same problem happen to me with my upgrade to 18.04. All of a sudden it tried to start every .conf file in my openvpn directory as an openvpn tunnel.

If your auth-user-pass in your vpn config file just so happens to be pointing to login.config, you'll need to rename that to something like login.secret to keep this from happening. Or just name the AUTOSTART='myvpn' in /etc/default/openvpn to match your myvpn.conf for your vpn connection in /etc/openvpn/.

Share:
5,888
FES
Author by

FES

JavaScript, JavaScript Does whatever a JavaScript does Is it Java? No, it's a script! Look out! It's JavaScript.

Updated on September 18, 2022

Comments

  • FES
    FES over 1 year

    I used to have a config for openvpn. After upgrading to 18.04 it started behaving differently in relation to systemd, my syslog gets continuously spammed with connection attempts:

    ovpn-login[5191]: Options error: In [CMD-LINE]:1: Error opening configuration file: /etc/openvpn/login.conf
    ovpn-login[5191]: Use --help for more information.
    systemd[1]: [email protected]: Main process exited, code=exited, status=1/FAILURE
    systemd[1]: [email protected]: Failed with result 'exit-code'.
    

    The login.conf does not exist and should not exist - I want to clean this up and get rid of the entry so it stops trying to connect to a service that doesn't exist.

    I've tried systemctl kill [email protected], systemctl disable [email protected] both with systemctl daemon-reload afterwards to no avail.

    However, there is no file that matches [email protected] anywhere, it is templated from /lib/systemd/system/[email protected].

    Presumably I need to keep that file around should I want to add some VPN configs in the future. I did try removing it and doing systemctl daemon-reload as per an answer elsewhere on StackExchange, again, to no avail.

    How do I get rid of this spurious systemd configuration entry?


    Edit: even after apt purge openvpn and trying to remove all traces it still has:

    [email protected]: Failed to schedule restart job: Unit [email protected] not found.

    Where is it picking this up from?