Author Topic: Wi-Fi connection fix after system resume form sleep  (Read 100 times)

Offline babis1

  • Newly Subscribed
  • *
  • Posts: 19
  • Karma: 14
  • Admirer and Enthusiast of Peppermint Linux OS.
    • View Profile
  • Peppermint version(s): 10
Wi-Fi connection fix after system resume form sleep
« on: July 20, 2020, 10:41:40 am »
I noticed that in my case on Peppermint 10 that every time I resume my laptop from sleep I have a Wi-Fi connection problem, and for that I wrote a script to reset the network manager every time the laptop resumes from sleep. If you are having similar problems then follow the instructions below.

For this fix you will need to startup the terminal and type:

sudo nano /lib/systemd/system-sleep/netreset.sh
Press enter and type in your passwork and press enter again.

when in the editor enter the contents of the script for netreset.sh by typing:

#!/bin/sh
set -e

if [ "$2" = "suspend" ] || [ "$2" = "hybrid-sleep" ]; then
    case "$1" in
        post) sleep 3; systemctl restart NetworkManager;;
    esac
fi
exit 0


Press CTRL+x and save the file

when back in the terminal type in:
sudo chmod +x /lib/systemd/system-sleep/netreset.sh
Press enter to execute the above command, and your network manager will reset every time you come out of sleep or hibernate reestablishing the network connection.

-Isaak.
« Last Edit: July 21, 2020, 12:52:23 pm by babis1 »
Don't forget to click applaud to encourage effort on this forum whenever you learn something new, or interesting.  It will inspire me to research new information and put up new tutorials.
-Isaak.

Offline Slim.Fatz

  • Global Moderator
  • Veteran
  • *****
  • Posts: 2343
  • Karma: 616
  • Where's the mouse?
    • View Profile
  • Peppermint version(s): Peppermint 7, 8.5 & 10 - 64bit
Re: Wi-Fi connection fix after system resume form sleep
« Reply #1 on: July 21, 2020, 12:40:20 am »
Please note that only if you are having Wi-Fi connection problems when resuming from sleep should you try using this solution. Not everyone has such problems. Also note that it is normal for reconnection (after resuming from sleep) to take up to 10 seconds, depending on your hardware.  ;)

Regards,

-- Slim
Respect science, respect nature, respect each other.

Tread lightly: Fluxbox, JWM, i3, Openbox, awesome