Openvpn3 stopped working after I upgraded my Ubuntu 20.04 laptop from python3.8 to python 3.11
I get this error:
openvpn3-systemd[9972]: ModuleNotFoundError: No module named '_dbus_bindings'
I found that import dbus
works fine with python3.8 but does not work with python3.11
I tried to make openvpn3 work by changing the default system python back to 3.8 using
sudo update-alternatives --config python
And I also verified that when I use python in the command line, it finds dbus,
python -c 'import dbus'
Restarting the service still fails with the same error.
I edited the file /usr/libexec/openvpn3-linux/openvpn3-systemd
so it prints the python version before trying to import dbus using these 2 lines at the top of the file:
import sys
print ('openvpn3-python-version-used: ' + sys.version)
And I see it is using python3.11
How can I change the service file /lib/systemd/system/[email protected]
to force it to use the older python3.8 version?
Current service file:
[Unit]
Description=OpenVPN 3 Linux - VPN session for %I
After=dbus.service network-online.target
Wants=dbus.service network-online.target
Documentation=man:openvpn3-linux(7)
Documentation=man:openvpn3-systemd(7)
[Service]
Type=notify
PrivateTmp=true
ProtectSystem=true
ProtectHome=true
Environment="PYTHONUNBUFFERED=on"
ExecStart=/usr/libexec/openvpn3-linux/openvpn3-systemd --start %i
ExecReload=/usr/libexec/openvpn3-linux/openvpn3-systemd --restart %i
ExecStop=/usr/libexec/openvpn3-linux/openvpn3-systemd --stop %i
[Install]
WantedBy=multi-user.target