Wifi is toggled when closing laptop lid

when I used sudo journalctl -f
the output was rfkill keeps blocking my wifi

مار 13 15:59:09 SchoolLaptop systemd-logind[472]: Lid closed.
مار 13 15:59:11 SchoolLaptop kernel: wlo1: deauthenticating from 7c:21:0d:7a:57:41 by local choice (Reason: 3=DEAUTH_LEAVING)
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: wlo1: CTRL-EVENT-DISCONNECTED bssid=7c:21:0d:7a:57:41 reason=3 locally_generated=1
مار 13 15:59:11 SchoolLaptop avahi-daemon[448]: Interface wlo1.IPv6 no longer relevant for mDNS.
مار 13 15:59:11 SchoolLaptop avahi-daemon[448]: Leaving mDNS multicast group on interface wlo1.IPv6 with address fe80::f46:2904:3e1e:6fa7.
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: rfkill: WLAN soft blocked
مار 13 15:59:11 SchoolLaptop avahi-daemon[448]: Interface wlo1.IPv4 no longer relevant for mDNS.
مار 13 15:59:11 SchoolLaptop avahi-daemon[448]: Leaving mDNS multicast group on interface wlo1.IPv4 with address 10.57.56.156.
مار 13 15:59:11 SchoolLaptop avahi-daemon[448]: Withdrawing address record for fe80::f46:2904:3e1e:6fa7 on wlo1.
مار 13 15:59:11 SchoolLaptop avahi-daemon[448]: Withdrawing address record for 10.57.56.156 on wlo1.
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.0695] device (wlo1): supplicant interface state: completed -> interface_disabled
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.0695] device (p2p-dev-wlo1): supplicant management interface state: completed -> interface_disabled
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.0715] manager: rfkill: Wi-Fi now disabled by radio killswitch
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.0716] device (wlo1): state change: activated -> unavailable (reason 'none', sys-iface-state: 'managed')
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.1013] dhcp4 (wlo1): canceled DHCP transaction
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.1015] dhcp4 (wlo1): activation: beginning transaction (timeout in 45 seconds)
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.1015] dhcp4 (wlo1): state changed no lease
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: wlo1: PMKSA-CACHE-REMOVED 7c:21:0d:7a:57:41 0
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: wlo1: PMKSA-CACHE-REMOVED 7c:21:0d:7b:6f:e1 0
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.1397] manager: NetworkManager state is now DISCONNECTED
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
مار 13 15:59:11 SchoolLaptop NetworkManager[2188]: <info>  [1678715951.1520] device (p2p-dev-wlo1): state change: disconnected -> unavailable (reason 'supplicant-failed', sys-iface-state: 'managed')
مار 13 15:59:11 SchoolLaptop dbus-daemon[462]: [system] Activating via systemd: service name='org.freedesktop.nm_dispatcher' unit='dbus-org.freedesktop.nm-dispatcher.service' requested by ':1.80' (uid=0 pid=2188 comm="/usr/bin/NetworkManager --no-daemon")
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: wlo1: CTRL-EVENT-DSCP-POLICY clear_all
مار 13 15:59:11 SchoolLaptop systemd[1]: Starting Network Manager Script Dispatcher Service...
مار 13 15:59:11 SchoolLaptop wpa_supplicant[834]: nl80211: deinit ifname=wlo1 disabled_11b_rates=0
مار 13 15:59:11 SchoolLaptop dbus-daemon[462]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
مار 13 15:59:11 SchoolLaptop systemd[1]: Started Network Manager Script Dispatcher Service.
مار 13 15:59:11 SchoolLaptop audit[1]: SERVICE_START pid=1 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
مار 13 15:59:11 SchoolLaptop kernel: audit: type=1130 audit(1678715951.199:308): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=unconfined msg='unit=NetworkManager-dispatcher comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success'
مار 13 15:59:11 SchoolLaptop systemd-logind[472]: Lid opened.

Hi @hassan0ayman,

:bangbang: Tip: :bangbang: Providing terminal output

When posting terminal output, copy the output and paste it here, wrapped in three (3) backticks, before AND after the pasted text. Like this:

```
pasted text
```

Or three (3) tilde signs, like this:

~~~
pasted text
~~~

This will just cause it to be rendered like this:

Sed
sollicitudin dolor
eget nisl elit id
condimentum
arcu erat varius
cursus sem quis eros.

Instead of like this:

Sed sollicitudin dolor eget nisl elit id condimentum arcu erat varius cursus sem quis eros.

Alternatively, paste the text you wish to format as terminal output, select all pasted text, and click the </> button on the taskbar. This will indent the whole pasted section with one TAB, causing it to render the same way as described above.

Thereby increasing legibility thus making it easier for those trying to provide assistance.

For more information, please see:


:bangbang::bangbang: Additionally

If your language isn’t English, please prepend any and all terminal commands with LC_ALL=C. For example:

LC_ALL=C bluetoothctl

This will just cause the terminal output to be in English, making it easier to understand and debug.


According to what I found online, you should:

Create the file /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf:

sudo touch /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

And obviously edit it:

sudo nano  /etc/NetworkManager/conf.d/default-wifi-powersave-on.conf

Feel free to use your preferred text editor.

Add the following lines in the newly created file:

[connection]
wifi.powersave = 2

Save the file, Ctrl+O, and exit, Ctrl+X.

And then restart NetworkManager:

sudo systemctl restart NetworkManager

Note:

I have not tested it, nor can I, so if it doesn’t work I don’t really know why.

Hope this helps!

Unfortunately, It didn’t solve my problem

Unfortunately, I have no idea how to proceed then. Sorry.

:sob:

Perhaps someone more knowledgeable than I can help.

this solved the problem
https://askubuntu.com/questions/1156932/ubuntu-18-04-goes-to-aeroplane-mode-when-i-close-the-lid