None of the solutions above worked for me.
I did some investigation on @αғsнιη solution with autoconnect
and found out that you can use secondaries
instead. See here https://manpages.debian.org/testing/network-manager/nm-settings.5.en.html. Also this page says that you can't use autoconnect
with VPN profiles.
What I did:
List all existing connections:
sudo \ls -l /etc/NetworkManager/system-connections/
Open a file of the corresponding VPN connection (my-VPN
in my case):
sudo gedit /etc/NetworkManager/system-connections/my-VPN
Then copy uuid
. It should look like this 5a9bde6f-54ge-4h41-8754-f1a2977fa564
.
Open your Wi-fi connection file:
sudo gedit /etc/NetworkManager/system-connections/My-Wi-Fi
And add secondaries
property with copied uuid
.
It should look like this:
[connection]
id=My-Wi-Fi
uuid=1ab56231-9401-48c7-82de-a9ffghtyeac4
type=wifi
interface-name=wlo1
permissions=
secondaries=5a9bde6f-54ge-4h41-8754-f1a2977fa564;
timestamp=1649182910
[wifi]
...
After that restart NetworkManager or your computer:
systemctl restart NetworkManager