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
Don't do that.
Ubuntu 20.04 ships with Python 3.8. Everything in Ubuntu 20.04 is targeting Python 3.8.
This is part of the contract; Ubuntu will maintain and backport (security) fixes to Python 3.8; if you have stuff that runs on Python 3.8, it will continue to run on Python 3.8 for the lifetime of 20.04.
I'm surprised only OpenVPN broke. I would expect a lot of system tools to stop working, such as
apt
.In addition,
python
should always be Python2 if installed. Python3 should bepython3
. On a 20.04 system, you should havepython3
pointing topython3.8
, so runupdate-alternatives --config python3
. For stuff that needs 3.11, make it runpython3.11
.