Solution: Network-Manager without GUI.
I tried half a dozen tutorials using
But they all did not work for me. Probably because they did not describe at all what they were doing. So I always ran into a point where it did not work and there was no error message nor any way to find out the source of the problem.
Finally I simply tried installing the default network-manager. Which happens to be the gnome-network-manager but without the GUI components (->
So in short, the solution is:
sudo apt install --no-install-recommends network-manager
nmcli connection add ifname wlan0 type wifi ssid MySSID
nmcli connection edit wifi-wlan0
While editing the config file you have to set WPA-PSK and the plain text password:
nmcli> goto wifi
nmcli 802-11-wireless> set mode infrastructure
nmcli 802-11-wireless> back
nmcli> goto wifi-sec
nmcli 802-11-wireless-security> set key-mgmt wpa-psk
nmcli 802-11-wireless-security> set psk your-plain-text-password
nmcli 802-11-wireless-security> save
nmcli 802-11-wireless-security> quit
After that reboot and enjoy! The network-manager will take care of everything!
If it complains about permission, the recommended way seems to be to modify/overwrite the policykit rules from
/usr/share/polkit-1/actions/org.freedesktop.NetworkManager.policy. I gave up on that and used
sudo instead. If anybody knows a clean way to do it, tell us please!
Here is a very good guide, but it's in german: https://wiki.ubuntuusers.de/NetworkManager/NetworkManager_ohne_GUI/