I've been fighting for quite a while with my wifi connection. Basically, the problem is that it disconnects, but doesn't reconnects automatically. Instead, an applet prompts me to reconnect, this happens every 10'.
My tries
I thought the problem would be Network Manager, so I connected using Networkd, but I couldn't just get it working just by starting the service, because the wifi card has to be configured somehow.
Network Manager uses wpa_supplicant in the backend, and I wonder if the problem would how NM is using wpa_supplicant, as they have different files for different drivers, for example:
$ ls /lib/systemd/system/wpa_\t
[email protected]
wpa_supplicant.service
I've also checked out that the NetworkManager services configuration file has a restart on failure.
I am not sure what to do or try and some help to diagnose and troubleshoot this will be very welcome.
Fix
The network managers seem not be easy to configure, at least they need:
- an interface (wireless or lan), a network name and a password. We may need to wake up the interface, and may end up "unmanaged" until we manage it.
- Plus -I believe- a supplicant like wpa_supplicant
- and services files to handle crashes, start at boot etc
I don't know the internals but what you can do with NM which is to configure ( 1. ) it using the nm-applet or nmcli (where we give the password for the network and select the network, for example). I don't see this client for networkd. For example networkctl just checks the connection. So it can't be done with networkd (there is no applet afaik).
The next way to config step 1. is a bit lower level config and is using netplan. This is a great program because writing config files is probably difficult. I found it quite easy, this is the config I wrote (YAML format):
# Let NetworkManager manage all devices on this system
# no, let networkd do it cuz NM troubles this pc
network:
version: 2
renderer: networkd
wifis:
wlp1s0:
dhcp4: true
access-points:
"Xg-wifi-Network":
password: "rh6haeXX"
You can also add DNS servers, etc. Here are neat examples.
Then use this commands:
systemctl stop NetworkManager.service
systemctl disable NetworkManager.service
sudo netplan generate && sudo netplan apply
systemctl enable systemd-networkd.service
systemctl start systemd-networkd.service
systemctl status systemd-networkd.service
And the output of the last command is:
● systemd-networkd.service - Network Service
Loaded: loaded (/lib/systemd/system/systemd-networkd.service; enabled; vendor preset: enabled)
Active: active (running) since Wed 2022-02-16 19:36:08 GMT; 15ms ago
TriggeredBy: ● systemd-networkd.socket
...
Feb 16 19:36:08 code systemd[1]: Starting Network Service...
Feb 16 19:36:08 code systemd-networkd[8000]: wlp1s0: Gained IPv6LL
Feb 16 19:36:08 code systemd-networkd[8000]: Enumeration completed
Feb 16 19:36:08 code systemd-networkd[8000]: wlp1s0: Connected WiFi access point: OBT For Small Biz_JMTA (d6:35:1d:7e:76:6>
Feb 16 19:36:08 code systemd[1]: Started Network Service.
Network Applets
Network manager comes with the neat nm-applet. I tried this one from @pltanton, for Awesome Window Manager. It is great.