Public bug reported:

The systemd generator for openvpn (filesystem: /lib/systemd/system-
generators/openvpn-generator; git: openvpn/debian/openvpn-generator)
does not seem to work correctly with multiple configurations.

When run a second time the symlinks exist and the generator fails on the
first config and does not make it through the loop of all configs.  This
means if a config is added later and glob sorts after the first config
it will never be linked.  I believe the ln -s invocation should be ln
-sf


root@host:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.4 LTS
Release:        20.04
Codename:       focal

dir=/tmp/tmp.JmcFdf9b6s

# First run succeeds:

root@host:~# SYSTEMD_LOG_LEVEL=debug sh -x 
/lib/systemd/system-generators/openvpn-generator "$dir" "$dir" "$dir"
+ set -eu
+ GENDIR=/tmp/tmp.JmcFdf9b6s
+ WANTDIR=/tmp/tmp.JmcFdf9b6s/openvpn.service.wants
+ SERVICEFILE=/lib/systemd/system/openvpn@.service
+ AUTOSTART=all
+ CONFIG_DIR=/etc/openvpn
+ mkdir -p /tmp/tmp.JmcFdf9b6s/openvpn.service.wants
+ test -e /etc/default/openvpn
+ . /etc/default/openvpn
++ OPTARGS=
++ OMIT_SENDSIGS=0
++ AUTOSTART=all
+ test xall = xnone
+ test xall = xall -o -z all
++ cd /etc/openvpn
++ ls network-one.conf network-two.conf
+ for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`
+ NAME=network-one
+ ln -s /lib/systemd/system/openvpn@.service 
/tmp/tmp.JmcFdf9b6s/openvpn.service.wants/openvpn@network-one.service
+ for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`
+ NAME=network-two
+ ln -s /lib/systemd/system/openvpn@.service 
/tmp/tmp.JmcFdf9b6s/openvpn.service.wants/openvpn@network-two.service
+ exit 0

# Second run fails:

root@host:~# SYSTEMD_LOG_LEVEL=debug sh -x 
/lib/systemd/system-generators/openvpn-generator "$dir" "$dir" "$dir"
+ set -eu
+ GENDIR=/tmp/tmp.JmcFdf9b6s
+ WANTDIR=/tmp/tmp.JmcFdf9b6s/openvpn.service.wants
+ SERVICEFILE=/lib/systemd/system/openvpn@.service
+ AUTOSTART=all
+ CONFIG_DIR=/etc/openvpn
+ mkdir -p /tmp/tmp.JmcFdf9b6s/openvpn.service.wants
+ test -e /etc/default/openvpn
+ . /etc/default/openvpn
++ OPTARGS=
++ OMIT_SENDSIGS=0
++ AUTOSTART=all
+ test xall = xnone
+ test xall = xall -o -z all
++ cd /etc/openvpn
++ ls network-one.conf network-two.conf
+ for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`
+ NAME=network-one
+ ln -s /lib/systemd/system/openvpn@.service 
/tmp/tmp.JmcFdf9b6s/openvpn.service.wants/openvpn@network-one.service
ln: failed to create symbolic link 
'/tmp/tmp.JmcFdf9b6s/openvpn.service.wants/openvpn@network-one.service': File 
exists

** Affects: openvpn (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1962231

Title:
  systemd generator fails with more than one config

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/openvpn/+bug/1962231/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to