Score:1

diagnosing networking issues in ubuntu

mx flag

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:

  1. 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.
  2. Plus -I believe- a supplicant like wpa_supplicant
  3. 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.

Score:1
mx flag

Using a different service should solve the issue.

Try running sudo systemctl enable systemd-networkd and sudo systemctl start systemd-networkd.

Note: You may have to disable NetworkManager by running sudo systemctl disable NetworkManager.

Another thing to try is sudo systemctl restart NetworkManager or sudo systemctl restart systemd-networkd (if you do not want to use NetworkManager)

For more information, view this page.

Minsky avatar
mx flag
hi, it connects but same problem. Including logs
Jeff avatar
mx flag
I added a little bit of information. I hope it is more helpful (suggested to restart network services)
Minsky avatar
mx flag
with your help, and after some trials, Igot it working. Iwill update the post, and accept your answer. If yo think it is a good information, please include it in your post for other beginners
Jeff avatar
mx flag
@Minsky Thank you
Minsky avatar
mx flag
I can't believe it is not crashing, such a relief. I've added some details in the OP. Thanks to you.
Jeff avatar
mx flag
You are very welcome.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.