I just dual booted to 24.04.1 on my laptop. Whenever I open ubuntu I connect to wifi like usual. But when my screen sleeps or it enters suspend, whether I close it or it auto-sleeps, all networks just dissappear.
I've tried:
sudo systemctl restart NetworkManager
Changed
wifi.powersave
to= 2
sudo apt update && sudo apt upgrade
Ran: sudo nano /lib/systemd/system-sleep/restart-network-manager.sh Created script:
#!/bin/sh case $1 in post) systemctl restart NetworkManager ;; esac
and thensudo chmod +x /lib/systemd/system-sleep/restart-network-manager.sh
Updated drivers
sudo ubuntu-drivers autoinstall
Checked
rfkill list
; not blocked btw
All networks still disappear after suspend. It's like it's looking for networks but just never finds it
Ideas anyone?
So the answer was like @david said to make the screen sleep. I'll go through it step by step for the complete beginners as well:
Enter terminal(Ctrl + alt + T by default):
Enter
sudo nano /etc/systemd/logind.conf
sudo
triggers you to write your password so write it and press 'Enter' to open the fileFind the line:
#HandleLidSwitch=suspend
Remove the
#
Change the line to
HandleLidSwitch=lock
(Optional) I changed
HandleLidSwitchExternalPower
andHandleLidSwitchDocked
as well so it works when its connected to an external screen or charging tooThen you press "Ctrl + X", press "Y", and then finally press "Enter"
NOTE: The next step will restart the pc. Save anything you need to be safe. When you run the command the screen will turn black, then show lock screen and after you've logged in it will show black again. To return to normal press Ctrl + C.
Restart by writing :
sudo systemctl restart systemd-logind
And now it should work!