wifi network not working

On Manjaro 18 KDE after an initial period of regular functioning the wireless network stopped working. Everything works fine when connected via ethernet, but NetworkManager can't detect any wireless network.
I can post some more information.
iwconfig:

wlp0s20u3  IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   Tx-Power=20 dBm   
          Retry short limit:7   RTS thr=2347 B   Fragment thr:off
          Power Management:off
          
lo        no wireless extensions.

wlp3s0    IEEE 802.11  ESSID:off/any  
          Mode:Managed  Access Point: Not-Associated   
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Power Management:off
          
enp2s0    no wireless extensions.

inxi -Fxxxz:

System:
  Host: nicola-pc Kernel: 5.4.18-1-MANJARO x86_64 bits: 64 
  compiler: gcc v: 9.2.0 Desktop: KDE Plasma 5.17.5 tk: Qt 5.14.1 
  info: latte-dock wm: kwin_x11 dm: SDDM Distro: Manjaro Linux 
Machine:
  Type: Laptop System: ASUSTeK product: X555LJ v: 1.0 
  serial: <filter> 
  Mobo: ASUSTeK model: X555LJ v: 1.0 serial: <filter> 
  UEFI: American Megatrends v: X555LJ.204 date: 01/13/2015 
Battery:
  ID-1: BAT0 charge: 6.9 Wh condition: 23.4/37.3 Wh (63%) 
  volts: 7.5/7.5 model: ASUSTeK X555-50 type: Li-ion 
  serial: <filter> status: Charging cycles: 1824 
CPU:
  Topology: Dual Core model: Intel Core i7-5500U bits: 64 
  type: MT MCP arch: Broadwell rev: 4 L2 cache: 4096 KiB 
  flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx 
  bogomips: 19178 
  Speed: 1686 MHz min/max: 500/3000 MHz Core speeds (MHz): 1: 1686 
  2: 1706 3: 1867 4: 1678 
Graphics:
  Device-1: Intel HD Graphics 5500 vendor: ASUSTeK driver: i915 
  v: kernel bus ID: 00:02.0 chip ID: 8086:1616 
  Device-2: NVIDIA GK208BM [GeForce 920M] vendor: ASUSTeK 
  driver: nouveau v: kernel bus ID: 04:00.0 chip ID: 10de:1299 
  Display: x11 server: X.Org 1.20.7 driver: intel,nouveau 
  unloaded: modesetting alternate: fbdev,nv,vesa 
  compositor: kwin_x11 resolution: 1366x768~60Hz 
  OpenGL: 
  renderer: Mesa DRI Intel HD Graphics 5500 (Broadwell GT2) 
  v: 4.6 Mesa 19.3.3 compat-v: 3.0 direct render: Yes 
Audio:
  Device-1: Intel Broadwell-U Audio vendor: ASUSTeK 
  driver: snd_hda_intel v: kernel bus ID: 00:03.0 
  chip ID: 8086:160c 
  Device-2: Intel Wildcat Point-LP High Definition Audio 
  vendor: ASUSTeK driver: snd_hda_intel v: kernel bus ID: 00:1b.0 
  chip ID: 8086:9ca0 
  Device-3: NVIDIA GK208 HDMI/DP Audio driver: snd_hda_intel 
  v: kernel bus ID: 04:00.1 chip ID: 10de:0e0f 
  Sound Server: ALSA v: k5.4.17-1-MANJARO 
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet 
  vendor: ASUSTeK driver: r8169 v: kernel port: e000 
  bus ID: 02:00.0 chip ID: 10ec:8168 
  IF: enp2s0 state: down mac: <filter> 
  Device-2: Broadcom and subsidiaries BCM43142 802.11b/g/n 
  vendor: Lite-On driver: wl v: kernel port: e000 bus ID: 03:00.0 
  chip ID: 14e4:4365 
  IF: wlp3s0 state: dormant mac: <filter> 
  Device-3: TP-Link TL WN823N RTL8192EU type: USB driver: rtl8xxxu 
  bus ID: 1-3:3 chip ID: 2357:0109 serial: <filter> 
  IF: wlp0s20u3 state: down mac: <filter> 
Drives:
  Local Storage: total: 247.34 GiB used: 182.35 GiB (73.7%) 
  ID-1: /dev/sda vendor: Crucial model: CT250MX500SSD1 
  size: 232.89 GiB speed: 6.0 Gb/s serial: <filter> rev: 023 
  scheme: GPT 
  ID-2: /dev/sdb type: USB vendor: Toshiba model: TransMemory 
  size: 14.45 GiB serial: <filter> rev: 1.00 scheme: MBR 
Partition:
  ID-1: / size: 219.28 GiB used: 173.38 GiB (79.1%) fs: ext4 
  dev: /dev/sda2 
  ID-2: swap-1 size: 8.80 GiB used: 0 KiB (0.0%) fs: swap 
  dev: /dev/sda3 
Sensors:
  System Temperatures: cpu: 59.0 C mobo: 27.8 C gpu: nouveau 
  temp: 56 C 
  Fan Speeds (RPM): cpu: 4000 
Info:
  Processes: 234 Uptime: 2m Memory: 7.68 GiB 
  used: 2.54 GiB (33.1%) Init: systemd v: 242 Compilers: 
  gcc: 9.2.0 Shell: bash v: 5.0.11 running in: konsole 
  inxi: 3.0.37 

As you can see I have an external USB network card connected. I installed it because with a previous installation of Ubuntu on che PC the drivers of the default card stopped working. At the beginning, after installing Manajro, the default card was working regurarly.

How can I proceede in diagnostics?

  1. Which is the WiFi you want to get working? TP-link or Broadcom?
  2. What is the output of rfkill list?
  3. And nmcli general status?
  4. You're running on a rather old kernel. Do you have access to the 4.19 or 5.4 LTS (=Long Time Support) kernels?

Thanks for the reply!

  1. I have no particular preferences between TP-link and Broadcom (is there a preferable solution?)
  2. rfkill list:
1: phy1: Wireless LAN
        Soft blocked: no
        Hard blocked: no
19: hci0: Bluetooth
        Soft blocked: no
        Hard blocked: no
20: phy10: Wireless LAN
        Soft blocked: no
        Hard blocked: no
  1. nmcli general status:
STATE        CONNECTIVITY  WIFI-HW    WIFI       WWAN-HW    WWAN      
disconnected none enabled enabled enabled enabled 

  1. I have already installed on the pc the 5.4.17-1 kernel.

That's not up to date, stable has linux54 at 5.4.18-1. Do a full system upgrade please.

  1. I intensely dislike Broadcom, but I don't like TP-Link neither, so it's up to you...
  2. Please remove one of the 2
  3. Looks Good
  4. 5.4.17 is good enough cc @freggel.doe
  5. Please edit and update your posts with the newest information.

:innocent:

Disable MAC Address Randomization in NetworkManager.

Disable MAC Address Randomization with the following command:

echo -e "[device]\nwifi.scan-rand-mac-address=no" | sudo tee /etc/NetworkManager/conf.d/disable-random-mac.conf

After creating the new conf file, reboot both your router and your computer.

1 Like

I edited the inxi -Fxxxz output.
I disabled MAC Address Randomization as suggested by @tbg. After rebooting I still couldn't find wireless networks. I tried to remove the TP-Link USB device and stop-start NetworkManager. After that I managed to connect to the wifi and now the setwork seems to work fine.
Is this an expected behavior? How can I prevent this kind of non-working network situations in the future?
Thank you all.

EDIT: after updating and rebooting, the problem has come up again :roll_eyes: . This time restarting NetworkManager didn't do the trick.

Try enabling dhclient:

Dhclient is likely already installed, but just to be sure issue:

sudo pacman -S dhclient --needed

To create a config file which sets Network Manager to use the stand-alone dhclient program run this command:

echo -e "[main]\ndhcp=dhclient" | sudo tee /etc/NetworkManager/conf.d/dhclient.conf

NetworkManager is now set to call dhclient, which can sometimes conflict with dhcpd.

To disable the dhcpd service run these commands:

sudo systemctl stop dhcpcd.service

sudo systemctl mask dhcpcd.service

sudo systemctl daemon-reload

sudo systemctl restart NetworkManager.service

Then, manually refresh your IP address assigned by your DHCP client:

Run the following command to refresh your IP address:

sudo /sbin/dhclient -r  $(hwinfo --wlan | grep "Device File" | cut -d " " -f5) && sudo dhclient -1 $(hwinfo --wlan | grep "Device File" | cut -d " " -f5) 

Then test your connectivity.

1 Like

When I do these operation the network starts working but after every logout or suspension the problem comes up again, network becomes unreachable and I have to restart NetworkManager to find and connect to a wifi.

1 Like

Thanks for the reference. So if I understand correctly isn't there a more "stable" solution that doesn't require that kind of scripting?

That is simply a workaround until you find your working solution.

1 Like

Finding that configuration was the main point of the post :sweat_smile:

1 Like

Forum kindly sponsored by