[BUG] Closing the lid makes WiFi not usable anymore

Since I updated my system yesterday I have a new bug.

When I close the lid the WiFi turns off.

It is disabled but the text of the menu in the upper right corner says “Turn Off” anyway. SImilarly to waht it did with Bluetooth.

If I click on “Turn Off” nothing happens and Wifi stays disabled. I had to reboot my PC to use WiFi again.

I have Fedora 34

As a work around, I think you could change HandleLidSwitch to poweroff in /etc/systemd/logind.conf.

I am still affected by this issue.

Note that in GNOME Tweak I have disabled “Suspend when laptop lid is closed”, but still the wifi gets turned off when I close the lid.

As a work around, I think you could change HandleLidSwitch to poweroff in /etc/systemd/logind.conf .

Doesn’t this power off my PC when I close the lid?

Yes. But it should work around the problem with WiFi not working when you turn the system back on. The suspend and hibernate modes have been a pain point for Linux ever since hardware vendors started supporting them. Ubuntu disabled hibernation because of exactly the sort of problem you are describing.

Excerpted from What is difference between Suspend and Hibernate in Linux:

Ubuntu had Hibernate as a default feature in the Power panel, but since Ubuntu 12.04 LTS, the feature was dropped due to ever increasing problems reported by several users.

I don’t have problem turning the Wifi back on after I open the lid. It turns back on automatically.

But when I close the lid the Wifi is turned off. So If I download something, when I close the lid the download stops.

I want the Wifi to stay on when I close the lid :slight_smile:

Sorry, I misunderstood your question.

If you want to (almost) completely disable power management, you could try passing acpi=ht on the kernel command line. This may inhibit more than you want though. For example, your screen will not turn off either and your system will not power off when you perform a soft shutdown.

If you just want to disable power management for your WiFi card, use lsmod to figure out which driver (kernel module) your WiFi card is using and then use modinfo <module> to list the parameters that the kernel module accepts. One of them will likely be an option to enable or disable power management. You can then create a .conf file under /etc/modprobe.d containing a line like the following to pass the option to the module on system startup:

options <module> <parameter>=<value>

Gregory,

thanks very much for your help with this :slight_smile:

I am using the iwlwifi driver. modinfo shows two relevant options:

$ modinfo iwlwifi | grep power
parm:           power_save:enable WiFi power management (default: disable) (bool)
parm:           power_level:default power save level (range from 1 - 5, default: 1) (int)

But the power_save should default to disable. Who turned it on? :stuck_out_tongue:

I created a .conf file inside /etc/modprobe.d as you suggested, I put inside it:

options iwlwifi power_save=false

But when I rebooted my PC I had no wifi whatsoever! I probably got the syntax wrong.

So I renamed the file and rebooted again to have my wifi back :slight_smile:

At that point about all you can do is google the problem. I found the following which states that the way that driver interprets those parameters is counter intuitive.

Using iwconfig was suggested as a workaround.

I think you could put the following in /etc/rc.d/rc.local and mark that file executable (chmod +x /etc/rc.d/rc.local) to have power saving disabled on system startup. I’m not sure if it would stay disabled though. It is possible that something else in the system is turning power management on for the WiFi card.

#!/bin/sh

/sbin/iwconfig wlan0 power off

You might need to substitute wlan0 for the link name associated with your card. Use ip link to list the network links detected on your PC.

1 Like