2

On my laptop, after waking from suspend, the WiFi does not connect and does not find any. And while trying to fix the problem, I found out that sudo commands in the terminal would not execute either. (just executing sudo results in the terminal doing nothing. No password prompts, no output.)

I also had this issue with Linux Mint 19.2 and 19.3. I'd really like to know if there is a fix for this?

elementary OS 5.1.2 Hera

EDIT (more info as per comment):

Waiting 5 minutes did not work, when I went into System Settings > Network, Wireless was displaying 'Failed'. When I tried to turn it off, then turn it on, System Settings froze. lshw -c Network command also did not display anything beyond the following then hung

WARNING: you should run this program as super-user.
Network Interfaces

The output of lshw -c Network after rebooting:

WARNING: you should run this program as super-user.
  *-network                 
       description: Wireless interface
       product: QCA6174 802.11ac Wireless Network Adapter
       vendor: Qualcomm Atheros
       physical id: 0
       bus info: pci@0000:01:00.0
       logical name: wlp1s0
       version: 20
       serial: 5c:93:a2:9a:76:33
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical wireless
       configuration: broadcast=yes driver=ath10k_pci driverversion=5.3.0-40-generic firmware=SW_RM.1.1.1-00157-QCARMSWPZ-1 ip=192.168.123.170 latency=0 link=yes multicast=yes wireless=IEEE 802.11
       resources: irq:50 memory:f7000000-f71fffff
  *-network
       description: Ethernet interface
       product: RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
       vendor: Realtek Semiconductor Co., Ltd.
       physical id: 0
       bus info: pci@0000:02:00.0
       logical name: enp2s0
       version: 0c
       serial: 24:f5:aa:d0:9d:12
       capacity: 1Gbit/s
       width: 64 bits
       clock: 33MHz
       capabilities: bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
       configuration: autonegotiation=on broadcast=yes driver=r8169 firmware=rtl8168g-2_0.0.1 02/06/13 latency=0 link=no multicast=yes port=MII
       resources: irq:19 ioport:e000(size=256) memory:f7200000-f7200fff memory:f0000000-f0003fff
WARNING: output may be incomplete or inaccurate, you should run this program as super-user.

running it in sudo mode had two different lines as following:

(Wireless interface)
capabilities: pm msi pciexpress bus_master cap_list ethernet physical wireless
(Ethernet interface)
capabilities: pm msi pciexpress msix vpd bus_master cap_list ethernet physical tp mii 10bt 10bt-fd 100bt 100bt-fd 1000bt-fd autonegotiation
5
  • Some wifi cards take a while to reconnect again when you wake up from suspend. Can you wait 5 minutes and see if it connects automatically? After those 5 minutes, if it doesn't connect, go to System Settings > Network and enable the Wireless connection if it was disabled. Does it work now? We would need more info about your wireless card, please execute lshw -c Network.
    – Maccer
    Feb 25, 2020 at 9:18
  • @Maccer I updated the post with more info. Feb 25, 2020 at 10:02
  • For your Wifi Issue try this answer. You need to create those 2 files inside /etc/systemd/system/. See the commented lines of those files (the ones starting with #) to know how to enable the service.
    – Maccer
    Feb 25, 2020 at 12:08
  • @Maccer I don't know if I did something wrong, but the answer in above link did not work. I changed all the path to where the commands were located, and renamed the adapter id. From what I could figure out (though I'm not really a tech savvy person) from the log from 'systemctl status network-resume.service', network-resume.service did not even run after unsuspend. And are the services supposed to run (disable/enable wifi) when executing 'systemctl start ...'? Feb 25, 2020 at 13:58
  • I've created an answer with the correct steps for your system. Check if that works. But first execute sudo systemctl disable network-resume.service && sudo systemctl disable network-suspend.service && sudo systemctl daemon-reload && sudo rm /etc/systemd/system/network-suspend.service && sudo rm /etc/systemd/system/network-resume.service to remove the previous service that didn't work.
    – Maccer
    Feb 25, 2020 at 17:21

3 Answers 3

1

Seems like the problem is that the Wireless card isn't capable of waking up after suspend. We are going to create a service that disables the wireless card on suspend and then enables it again when you start the computer.

First, open a terminal window and execute the following command:

sudo io.elementary.code /etc/systemd/system/network-suspend.service

On the window that opens, paste the following code and then close the window:

#/etc/systemd/system/network-suspend.service
#sudo systemctl enable network-suspend.service
#sudo systemctl start network-suspend.service
#sudo 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
ExecStart=/usr/bin/sudo -u $USER /bin/bash -lc 'nmcli networking off'
ExecStart=/bin/sleep 1
ExecStart=/usr/bin/systemctl stop NetworkManager
ExecStart=/bin/sleep 1
ExecStart=/usr/bin/ip link set wlp1s0  down
ExecStart=/bin/sleep 1
ExecStart=/usr/bin/rmmod  ath10k_pci
ExecStart=/bin/sleep 1
ExecStartPost=/usr/bin/rmmod  ath10k_core

[Install]
WantedBy=sleep.target

Now type on terminal again:

sudo io.elementary.code /etc/systemd/system/network-resume.service

And paste the following code. Close the window.

#/etc/systemd/system/network-resume.service
#sudo systemctl enable network-resume.service
#sudo systemctl start network-resume.service
#sudo systemctl status network-resume.service
#sudo systemctl daemon-reload
[Unit]
Description=Network resume service
After=suspend.target
StopWhenUnneeded=yes

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

[Install]
WantedBy=suspend.target

Lastly, execute all of this on terminal:

sudo systemctl enable network-resume.service && sudo systemctl start network-resume.service && sudo systemctl enable network-suspend.service && sudo systemctl start network-suspend.service && sudo systemctl daemon-reload

And done! It should work now. It shouldn't be necessary to reboot but it won't hurt anyway!.


source

If you want to remove this service (because it didn't work or any other reason) just execute on terminal:

sudo systemctl disable network-resume.service && sudo systemctl disable network-suspend.service && sudo systemctl daemon-reload && sudo rm /etc/systemd/system/network-suspend.service && sudo rm /etc/systemd/system/network-resume.service
2
  • Thank you for yout help, but this only changed wlp7s0 to wlp1s0 right? That is what I have already done, but it did not work. Assuming that I am also meant to change the path to where the command actually resides in as found by 'whereis'. (changing /usr/bin/sleep to /bin/sleep, /usr/bin/modprobe to /sbin/modprobe, etc) Feb 26, 2020 at 0:47
  • I just wrote that to make sure you had followed the correct steps. I don't know what else to do. Maybe you should file a bug to the kernel so they may decide to solve it. As a last option you could try to upgrade your kernel to any mainline kernel from here. You'd need to download 4 deb files linux-headers- XXXX_all.deb, linux-headers-XXXX-generic_XXXX_amd64.deb, linux-image-unsigned-XXXX-generic_XXXX_amd64 and linux-modules-XXXX-generic_XXXX_amd64.deb . Then install with sudo apt -f install ./linux*.deb .
    – Maccer
    Feb 26, 2020 at 21:39
0

This always happen. suspend bug(after a long suspend state, 1hr or more). all ubuntu based distro i've tried have this too. reboot and it all will be ok(atleast in my experience).....

1
  • It happens after 30 seconds in suspend as well. So there is no fix for this? I'm expected to never close my laptop lid? Feb 25, 2020 at 13:52
0

I had same issue (on Ubuntu) and somehow suspected to the router. After changing the router, with the same machine and the same OS, it worked without the issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.