systemd generator fails with more than one config

Bug #1962231 reported by Jim Browne
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openvpn (Ubuntu)
New
Undecided
Unassigned

Bug Description

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 /<email address hidden>
+ for CONFIG in `cd $CONFIG_DIR; ls *.conf 2> /dev/null`
+ NAME=network-two
+ ln -s /lib/systemd/system/openvpn@.service /<email address hidden>
+ 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 /<email address hidden>
ln: failed to create symbolic link '/<email address hidden>': File exists

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.