Closing lid cause network deactivation

Hi,
I’m new to Manjaro. I’ve some troubles with my network manager when I close the lid of my laptop or when I suspend the pc. If I do one of these thing my laptop goes in sleep mode but when I open the lid again and restart it the wireless network adapter is disabled (but wired connection still works) . In order to reuse wifi I can do nothing except restart the system.

This is my laptop configuration:

~> lspci
00:00.0 Host bridge: Intel Corporation Broadwell-U Host Bridge -OPI (rev 09)
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 5500 (rev 09)
00:03.0 Audio device: Intel Corporation Broadwell-U Audio Controller (rev 09)
00:04.0 Signal processing controller: Intel Corporation Broadwell-U Processor Thermal Subsystem (rev 09)
00:14.0 USB controller: Intel Corporation Wildcat Point-LP USB xHCI Controller (rev 03)
00:16.0 Communication controller: Intel Corporation Wildcat Point-LP MEI Controller #1 (rev 03)
00:1b.0 Audio device: Intel Corporation Wildcat Point-LP High Definition Audio Controller (rev 03)
00:1c.0 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #1 (rev e3)
00:1c.1 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #2 (rev e3)
00:1c.2 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #3 (rev e3)
00:1c.3 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #4 (rev e3)
00:1c.4 PCI bridge: Intel Corporation Wildcat Point-LP PCI Express Root Port #5 (rev e3)
00:1f.0 ISA bridge: Intel Corporation Wildcat Point-LP LPC Controller (rev 03)
00:1f.2 SATA controller: Intel Corporation Wildcat Point-LP SATA Controller [AHCI Mode] (rev 03)
00:1f.3 SMBus: Intel Corporation Wildcat Point-LP SMBus Controller (rev 03)
08:00.0 Network controller: Intel Corporation Wireless 3160 (rev 83)
09:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL810xE PCI Express Fast Ethernet controller (rev 0a)
0a:00.0 3D controller: NVIDIA Corporation GM108M [GeForce 940M] (rev ff)

I’ve tried to disable the power managment of the adapter with:

sudo iw dev wlo1 set power_save off

but it didn’t work. Could anyone help me?
Thanks.

The best way to resolve this issue involves writing a systemd service. There are many threads on the forum that you can refer to for information on writing systemd unit files. A systemd unit is not that difficult to write when you have lots of working examples to refer to.

Here are some links with pertinent information:

You will find many other posts on this topic if you search the forum. Here are some other links:

https://forum.manjaro.org/t/kernel-4-19-0-3-not-network-after-suspending-gnome-edition/63544/2

https://forum.manjaro.org/t/wifi-adapter-tp-link-tl-wn823n-must-be-reconnected-for-it-to-work/52968/19

https://forum.manjaro.org/t/surface-pro-1796-wifi-not-resuming-after-suspend/48133/47

https://forum.manjaro.org/t/thinkpad-x230t-wont-suspend-under-kernel-419rc4-4-18-4-17-4-14-4-9/59798/21

Here are some external links with excellent systemd reference material:

The ArchWiki - systemd

Red Hat - systemd-targets

Red Hat - systemd unit files

Systemd manpage

Please post:

inxi -Fxxxz

Please post all terminal commands as text with code tags, (not as pics).

Information on how to properly post hardware specs and logs:

Please format any terminal output with three backticks before and after, as shown in this picture:

This may be not much helpful, but I had this problem for over a year or longer in my alienware laptop. I did nothing specific to solve it. I was just updating the system, moving to new kernels, etc. At one day I realized, the issue is gone and I can suspend without network deactivation. So maybe it took almost 2 years for kernel to got up to speed with the hardware I had? Or there were some bugfixes? I don’t know, but eventually this resolved itself.

As a workaround, I just set closing lid to shut the screen off to avoid suspend. So I wasn’t suspending computer for a long time and that is why I never knew when the fix happened.

1 Like

@tbg I’ve followed your link and the answer you gave in a previous question. So this is what I did:

 $ inxi -n
Network:   Device-1: Intel Wireless 3160 driver: iwlwifi 
           IF: wlo1 state: up mac: 34:e6:ad:b7:9c:bf 
           Device-2: Realtek RTL810xE PCI Express Fast Ethernet driver: r8169 
           IF: eno1 state: down mac: 3c:a8:2a:ac:78:8a 

So I replaced my information in the systemd services you’ve suggested like this:

network-suspend.service

[Unit]
Description=Network suspend service 
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/ip link set wlo1 down
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/rmmod iwlwifi
ExecStart=/usr/bin/sleep 1
ExecStartPost=/usr/bin/rmmod iwlwifi

[Install]
WantedBy=sleep.target

network-resume.service

[Unit]
Description=Network resume service
After=suspend.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/bin/sleep 10
ExecStart=/usr/bin/modprobe iwlwifi
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/ip link set wlo1 up
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/systemctl start NetworkManager
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi off'
ExecStart=/usr/bin/sleep 2
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi on'

[Install]
WantedBy=suspend.target

I run the commands for enabling and starting new systemd services, I closed and reopened my lid (so without restarting the system) but I got this errors:

systemctl status network-resume.service

● network-resume.service - Network resume service
   Loaded: loaded (/etc/systemd/system/network-resume.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2019-03-03 13:14:50 CET; 9s ago
  Process: 3136 ExecStartPre=/usr/bin/sleep 10 (code=exited, status=0/SUCCESS)
  Process: 3137 ExecStart=/usr/bin/modprobe iwlwifi (code=exited, status=0/SUCCESS)
  Process: 3138 ExecStart=/usr/bin/sleep 2 (code=exited, status=0/SUCCESS)
  Process: 3139 ExecStart=/usr/bin/ip link set wlo1 up (code=exited, status=2)
 Main PID: 3139 (code=exited, status=2)

mar 03 13:14:37 luigi-cer1 systemd[1]: Starting Network resume service...
mar 03 13:14:50 luigi-cer1 ip[3139]: RTNETLINK answers: Operation not possible due to RF-kill
mar 03 13:14:50 luigi-cer1 systemd[1]: network-resume.service: Main process exited, code=exited, status=2/INVALIDARGUM>
mar 03 13:14:50 luigi-cer1 systemd[1]: network-resume.service: Failed with result 'exit-code'.
mar 03 13:14:50 luigi-cer1 systemd[1]: Failed to start Network resume service.

And
systemctl status network-suspend.service

● network-suspend.service - Network suspend service
   Loaded: loaded (/etc/systemd/system/network-suspend.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Sun 2019-03-03 13:13:42 CET; 3min 31s ago
  Process: 2679 ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc nmcli networking off (code=exited, status=0/SUCCESS)
  Process: 2727 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2810 ExecStart=/usr/bin/systemctl stop NetworkManager (code=exited, status=0/SUCCESS)
  Process: 2811 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2812 ExecStart=/usr/bin/ip link set wlo1 down (code=exited, status=0/SUCCESS)
  Process: 2813 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2814 ExecStart=/usr/bin/rmmod iwlwifi (code=exited, status=1/FAILURE)
 Main PID: 2814 (code=exited, status=1/FAILURE)

mar 03 13:13:39 luigi-cer1 systemd[1]: Starting Network suspend service...
mar 03 13:13:39 luigi-cer1 sudo[2679]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/bash -lc nmcli networking off
mar 03 13:13:39 luigi-cer1 sudo[2679]: pam_unix(sudo:session): session opened for user root by (uid=0)
mar 03 13:13:39 luigi-cer1 sudo[2679]: pam_unix(sudo:session): session closed for user root
mar 03 13:13:42 luigi-cer1 rmmod[2814]: rmmod: ERROR: Module iwlwifi is in use by: iwlmvm
mar 03 13:13:42 luigi-cer1 systemd[1]: network-suspend.service: Main process exited, code=exited, status=1/FAILURE
mar 03 13:13:42 luigi-cer1 systemd[1]: network-suspend.service: Failed with result 'exit-code'.
mar 03 13:13:42 luigi-cer1 systemd[1]: Failed to start Network suspend service.

Then I tried to restart the system but the situation is worse in the sense that the wifi doens’t work even after restart (so without closing/reopening the lid).

EDIT4:
I solved this last problem by disabling the systemd services and by manually reloading the modules.

EDIT: I followed also this: No Ethernet Network Connection after Resume; very recent problem (after replacing with my system’s settings/modules) and the problem arises at point 8. I get:

 ~> sudo ip link set wlo1 up
RTNETLINK answers: Operation not possible due to RF-kill

If I do:

 ~> rfkill list all
1: phy0: Wireless LAN
        Soft blocked: no
        Hard blocked: yes

and if I click the button on the keyboard for enabling/disabling flight mode it changes to:

 ~> rfkill list all
1: phy0: Wireless LAN
        Soft blocked: yes
        Hard blocked: yes

Why the interface became phy0 instead of wlo1 as before?

I’ve tried to do sudo rfkill unblock all before point 8 but nothing changes.

EDIT2:

I’ve searched online for similar problems and I’ve followed one that suggests to blacklist hp_wmi from rf_kill with

echo "blacklist hp_wmi" > /etc/modprobe.d/hp.conf

then reboot the system and retry all the passages but wifi still doens’t work.

I’m happy to see you attempted this on your own. It shows motivation and self-sufficiency (which is great).

The reason that unit didn’t work for you is because the iwlwifi driver is different than most other wifi modules. It has dependencies that must be unloaded first. I will help you with that once we get your wifi working again.

I would put a comment “#” (pound sign) in front of the blacklist line you put in “/etc/modprobe.d/hp.conf” to nullify your changes for now.

It should be changed to this:

#blacklist hp_wmi

A network adapter with a hard block can sometimes be hard to correct. Changing the BIOS settings may help in this situation (as well as power cycling). If available, a BIOS update may also help correct these problems. Below are several methods that may help with raising your adapter.

Resetting the BIOS back to the factory default settings may help. This also sometimes helps to remove a hard block. Boot into the BIOS settings utility and reset the BIOS back to the factory default. Save the default settings, and power down the laptop.

After powering down the laptop remove the battery and power plug. Let the laptop sit without power for a few minutes. Then, hold down the power button for approximately 30 seconds. Pressing the power button will help drain all left over power from the unit’s motherboard.

Then restart the laptop, and see if it will boot with the factory default settings. If not, you may have to change some settings in the BIOS (such as secure boot) to get Linux to boot up.

Hopefully, after rebooting your adapter is now working.

Are you dual booting with windows?

Hi, thanks for your help and sorry for late reply but we are in very different time zones :slight_smile:

I forgot to mention that I solved the wifi not working problem by disabling the two systemd services I posted yesterday and my manually loading the wifi modules with:
sudo modprobe iwlmvm
sudo modprobe iwlwifi
sudo ip link set wlo1 up
I will edit the previous post with this information, sorry about that. Obviously I still get the error of network deactivation after closing lid. So I did all the part about rfkill after disabling your suggested services.

As far as concerned the BIOS update I’m a bit relucatant in doing it beacuse I’ve a lot of file in the system. Is this operation safe or could it cause problems with secure boot and legacy mode?
Also I had this problem with other linux distros (such as Debian, Ubunut, ElementaryOS), and nope, I don’t have dual boot.

I have written a service for you that you can try rather than manually entering the commands. It is only a single service file, so it is very easy to set up.

This Is a very different service than I usually write, so I’m not 100% sure it will work on the first shot. I’m trying to make things easier for those unfamiliar with systemd by condensing everything down to a single service unit. With all these consecutive commands the service should really be using external scripts. Hopefully this condensed single combined suspend/resume service will get the job done correctly.

Create the single service file:

/etc/systemd/system/network-suspend.service

With the following contents:

#/etc/systemd/system/network-suspend.service
#sudo systemctl enable network-suspend.service
#sudo systemctl start network-suspend.service
#sudo systemctl stop network-suspend.service
#sudo systemctl disable network-suspend.service
#systemctl status network-suspend.service
#sudo systemctl daemon-reload

[Unit]
Description=Network suspend service 
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStartPre=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/ip link set wlo1 down
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/rmmod iwlmvm
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/rmmod  iwldvm
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/rmmod iwlwifi
ExecStop=/usr/bin/sleep 5
ExecStop=/usr/bin/modprobe iwlwifi
ExecStop=sudo rfkill unblock all
ExecStop=/usr/bin/sleep 2
ExecStop=/usr/bin/ip link set wlo1 up
ExecStop=sudo rfkill unblock wifi
ExecStop=/usr/bin/sleep 2
ExecStop=/usr/bin/systemctl start NetworkManager
ExecStop=/usr/bin/sleep 2
ExecStop=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
ExecStop=/usr/bin/sleep 2
ExecStop=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi off'
ExecStop=/usr/bin/sleep 2
ExecStop=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi on'

[Install]
WantedBy=sleep.target

It would be best to substitute in your own username for “$USER” wherever it appears in the service unit. However, the service should still work even if you don’t.

The sleep units may be reduced (or eliminated) if you do not like the delay it creates. Be aware though, that doing so may reduce the reliability of the service.

Once you have finished creating, (and saved) the service file, enable the service:

sudo systemctl enable network-suspend.service

Restart.

(edited) to hopefully resolve an rfkill blockage.

Hi, I followed your instructions and I get the following error:

 ~> sudo systemctl status network-suspend.service
[sudo] password for luigi: 
● network-suspend.service - Network suspend service
   Loaded: loaded (/etc/systemd/system/network-suspend.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-03-04 09:47:15 CET; 2min 24s ago
  Process: 1231 ExecStartPre=/usr/bin/sudo -u $USER /bin/bash -lc nmcli networking off (code=exited, status=0/SUCCESS)
  Process: 1277 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 1359 ExecStart=/usr/bin/systemctl stop NetworkManager (code=exited, status=0/SUCCESS)
  Process: 1360 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 1361 ExecStart=/usr/bin/ip link set wlo1 down (code=exited, status=0/SUCCESS)
  Process: 1362 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 1363 ExecStart=/usr/bin/rmmod iwlmvm (code=exited, status=0/SUCCESS)
  Process: 1369 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 1370 ExecStart=/usr/bin/rmmod iwldvm (code=exited, status=1/FAILURE)
  Process: 1371 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 1372 ExecStart=/usr/bin/rmmod iwlwifi (code=exited, status=0/SUCCESS)
  Process: 1429 ExecStop=/usr/bin/sleep 5 (code=exited, status=0/SUCCESS)
  Process: 1597 ExecStop=/usr/bin/modprobe iwlwifi (code=exited, status=0/SUCCESS)
  Process: 1599 ExecStop=/usr/bin/sleep 2 (code=exited, status=0/SUCCESS)
  Process: 1603 ExecStop=/usr/bin/ip link set wlo1 up (code=exited, status=2)
 Main PID: 1372 (code=exited, status=0/SUCCESS)

mar 04 09:46:54 luigi-cer1 sudo[1231]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/bash -lc nmcli networking off
mar 04 09:46:54 luigi-cer1 sudo[1231]: pam_unix(sudo:session): session opened for user root by (uid=0)
mar 04 09:46:54 luigi-cer1 sudo[1231]: pam_unix(sudo:session): session closed for user root
mar 04 09:46:58 luigi-cer1 rmmod[1370]: rmmod: ERROR: Module iwldvm is not currently loaded
mar 04 09:46:59 luigi-cer1 systemd[1]: Started Network suspend service.
mar 04 09:47:08 luigi-cer1 systemd[1]: Stopping Network suspend service...
mar 04 09:47:15 luigi-cer1 ip[1603]: RTNETLINK answers: Operation not possible due to RF-kill
mar 04 09:47:15 luigi-cer1 systemd[1]: network-suspend.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
mar 04 09:47:15 luigi-cer1 systemd[1]: network-suspend.service: Failed with result 'exit-code'.
mar 04 09:47:15 luigi-cer1 systemd[1]: Stopped Network suspend service.
lines 2-30/30 (END)

The problem I think is with the module iwldvm, in fact:

 -> sudo rmmod iwldvm
rmmod: ERROR: Module iwldvm is not currently loaded

I know that module is not loaded. This is supposed to be a universal solution for iwlwfi suspend issues. Some people use that driver and some have the one you are using.

If you notice there is a “-” before both those modules in the service. That delimiter stops the unit from erroring out because of an improper rmmod.

If you look carefully at your output you will see it is the rfkill issue that prevented the unit from loading. I will revise the unit and add some rfkill switches to it.

I will edit the above unit.

If it still does not work after my edit then test it again after you remove this line.

ExecStart=-/usr/bin/rmmod  iwldvm

Restart after any changes to the service.

I can’t enable the service:

sudo systemctl enable network-suspend.service
Failed to enable unit: File network-suspend.service: Invalid argument

Maybe the last two lines you’ve added need to be after an ExecStart=… ?

You’ve already enabled it. You can’t enable it again. All you have to do is restart or:

sudo systemctl daemon-reload

I think a simple restart is more foolproof though.

Oh sorry just re-read your comment. You are right I was in a rush and missed that.

I just re-edited it. It needed ExecStop=

I just double-checked the systemd documentation to be sure I had the error prevention parameter correct. It appears I did. The error should be ignored.

From the manpages:

" - " If the executable path is prefixed with " - ", an exit code of the command normally considered a failure (i.e. non-zero exit status or abnormal exit due to signal) is recorded, but has no further effect and is considered equivalent to success.

Again bad news.

With the first service I still get the error related to RF Kill:

● network-suspend.service - Network suspend service
   Loaded: loaded (/etc/systemd/system/network-suspend.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-03-04 10:41:31 CET; 3s ago
  Process: 2350 ExecStartPre=/usr/bin/sudo -u $USER /bin/bash -lc nmcli networking off (code=exited, status=0/SUCCESS)
  Process: 2401 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2493 ExecStart=/usr/bin/systemctl stop NetworkManager (code=exited, status=0/SUCCESS)
  Process: 2494 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2495 ExecStart=/usr/bin/ip link set wlo1 down (code=exited, status=0/SUCCESS)
  Process: 2496 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2497 ExecStart=/usr/bin/rmmod iwlmvm (code=exited, status=0/SUCCESS)
  Process: 2505 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2524 ExecStart=/usr/bin/rmmod iwldvm (code=exited, status=0/SUCCESS)
  Process: 2525 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
  Process: 2531 ExecStart=/usr/bin/rmmod iwlwifi (code=exited, status=0/SUCCESS)
  Process: 2597 ExecStop=/usr/bin/sleep 5 (code=exited, status=0/SUCCESS)
  Process: 2776 ExecStop=/usr/bin/modprobe iwlwifi (code=exited, status=0/SUCCESS)
  Process: 2779 ExecStop=/usr/bin/sudo rfkill unblock all (code=exited, status=0/SUCCESS)
  Process: 2781 ExecStop=/usr/bin/sleep 2 (code=exited, status=0/SUCCESS)
  Process: 2792 ExecStop=/usr/bin/ip link set wlo1 up (code=exited, status=2)
 Main PID: 2531 (code=exited, status=0/SUCCESS)

mar 04 10:41:10 luigi-cer1 sudo[2350]: pam_unix(sudo:session): session closed for user root
mar 04 10:41:15 luigi-cer1 systemd[1]: Started Network suspend service.
mar 04 10:41:24 luigi-cer1 systemd[1]: Stopping Network suspend service...
mar 04 10:41:29 luigi-cer1 sudo[2779]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/usr/bin/rfkill unblock all
mar 04 10:41:29 luigi-cer1 sudo[2779]: pam_unix(sudo:session): session opened for user root by (uid=0)
mar 04 10:41:29 luigi-cer1 sudo[2779]: pam_unix(sudo:session): session closed for user root
mar 04 10:41:31 luigi-cer1 ip[2792]: RTNETLINK answers: Operation not possible due to RF-kill
mar 04 10:41:31 luigi-cer1 systemd[1]: network-suspend.service: Control process exited, code=exited, status=2/INVALIDARGUMENT
mar 04 10:41:31 luigi-cer1 systemd[1]: network-suspend.service: Failed with result 'exit-code'.
mar 04 10:41:31 luigi-cer1 systemd[1]: Stopped Network suspend service.

With the second (so I 've removed the line), it’s worse:

 network-suspend.service - Network suspend service
   Loaded: loaded (/etc/systemd/system/network-suspend.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2019-03-04 10:42:36 CET; 9s ago
  Process: 3220 ExecStartPre=/usr/bin/sudo -u $USER /bin/bash -lc nmcli networking off (code=exited, status=8)

mar 04 10:42:36 luigi-cer1 systemd[1]: Starting Network suspend service...
mar 04 10:42:36 luigi-cer1 sudo[3220]:     root : TTY=unknown ; PWD=/ ; USER=root ; COMMAND=/bin/bash -lc nmcli networking off
mar 04 10:42:36 luigi-cer1 sudo[3220]: pam_unix(sudo:session): session opened for user root by (uid=0)
mar 04 10:42:36 luigi-cer1 sudo[3220]: Error: NetworkManager is not running.
mar 04 10:42:36 luigi-cer1 sudo[3220]: pam_unix(sudo:session): session closed for user root
mar 04 10:42:36 luigi-cer1 systemd[1]: network-suspend.service: Control process exited, code=exited, status=8/n/a
mar 04 10:42:36 luigi-cer1 systemd[1]: network-suspend.service: Failed with result 'exit-code'.
mar 04 10:42:36 luigi-cer1 systemd[1]: Failed to start Network suspend service.

and wifi doesn’t work even after reboot. To solve I’ve manually I have to reload the iwlwifi module and all the network manager’s stuff.
I have a doubt, is there some NetworkManager (or nmcli) command to prevent this power managment? Or some kind of script that Manajaro automatically execute before suspension like the /usr/lib/pm-utils/sleep.d used by Ubuntu in which maybe there is a command that disables the wifi?

You could try :

sudo systemctl disable tlp

restart then see if things are improved.

I tried also with this: https://unix.stackexchange.com/questions/269661/how-to-turn-off-wireless-power-management-permanently but if I edit the /etc/NetworkManager/NetworkManager.conf the service doesn’t go online again.

tlp is the utility for battery managment?

power management,

Nope, nothing changes.
For now I think I will keep this problem and as soon as possible I’ll update the BIOS, I will comment this post when I’ll do this.

Thanks for your time :slight_smile:

I have written a new service for you.

I have tested this new service on my own system, and this version appears to be working well. Unfortunately, I do not own an Intel iwlwifi based adapter to test things conclusively.

I had to simulate Intel usage by manually loading the Intel modules before performing the tests with my adapter. Even though I could only simulate the environment, I'm fairly sure the errors in the earlier versions have been eliminated,

Please give this service a try, and I hope this version works well for you.

Combined Suspend/Resume iwlwifi.service

Create the combined service file:

/etc/systemd/system/iwlwifi.service

With the following contents:

#/etc/systemd/system/iwlwifi.service
#sudo systemctl enable iwlwifi.service
#sudo systemctl start iwlwifi.service
#sudo systemctl stop iwlwifi.service
#sudo systemctl disable iwlwifi.service
#systemctl status iwlwifi.service
#sudo systemctl daemon-reload

[Unit]
Description=Network Suspend/Resume Service 
Before=sleep.target
StopWhenUnneeded=yes

[Service]
User=root
Type=oneshot
RemainAfterExit=yes
ExecStartPre=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/systemctl stop NetworkManager
ExecStart=/usr/bin/sleep 1
ExecStart=-/usr/bin/ip link set wlo1 down
ExecStart=/usr/bin/sleep 1
ExecStart=-/bin/bash -c "lsmod | grep -o -e ^iwlmvm -e ^iwldvm -e ^iwlwifi | xargs sudo rmmod"
ExecStop=/usr/bin/sleep 5
ExecStop=-/usr/bin/modprobe iwlwifi
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/ip link set wlo1 up
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/systemctl start NetworkManager
ExecStop=/usr/bin/sleep 2
ExecStop=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking on'
ExecStop=/usr/bin/sleep 1
ExecStop=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi off'
ExecStop=/usr/bin/sleep 1
ExecStop=-/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli r wifi on'

[Install]
WantedBy=sleep.target

It is sometimes best to substitute in your own "username" for "$USER" wherever it appears in the service unit. The service should still work even if you don't, but it will be executed differently.

The sleep units may be reduced (or eliminated) if you do not like the delay it creates. Be aware though, that doing so may reduce the reliability of the service.

Once you have finished creating, (and saved) the service file, enable the service:

sudo systemctl enable iwlwifi.service

Restart.

(edit)

Other users have since confirmed this service worked well for them.

Hello,
Go to power settings and make sure to check that the network card is not set to deactivate when closing the lid.

Forum kindly sponsored by Bytemark