1

I am running ubuntu 18.04 on the XPS 15 9570. Dell removed normal sleep in favor of their modern-standby mode. This means battery drain and fans running while the laptop is in my backpack. In windows I was able to throw my laptop into hybrid sleep, and Ubuntu into deep sleep.

My current issue is that, after waking from deep sleep, my wifi is on, but shows as a question mark and will not allow me to browse the internet. I am using a killer wireless card, the one that dell ships with this laptop.

I found a fix for this to be

service network-manager restart

However, I do not want to run this manually every time I wake the laptop. I have tried other solutions from here about putting a script in /lib/systemd/system-sleep/, however nothing has worked. I suspect this may be due to my change to deep sleep, but I am not 100% sure.

Can anyone help me run a script on wake from deep sleep, or even login of a user?

  • You should post your script in /lib/systemd/system-sleep/ so others can point out how to fix it. You can see script starting and finishing (or failing) with journalctl -xe | grep /lib/systemd/system-sleep – WinEunuuchs2Unix Sep 13 at 10:26
0

You can use a systemd service which will be wanted after hibernate

Have your script file in a known location /sbin/afterhibernate.sh
Create a file /etc/systemd/system/afterhibernate.service:

[Unit]
Description=Run script on wakeup after hibernate
After=suspend.target hibernate.target hybrid-sleep.target

[Service]
ExecStart=/sbin/afterhibernate.sh

[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target

If you want it to be executed only after hibernate, remove suspend.target and hybrid-sleep.target

Enable the service file with:

sudo systemctl enable afterhibernate.service
  • Sorry, meant to say deep sleep in title, not hibernate. Will this still work for deep sleep as well? – Phillip Sep 13 at 15:59
  • Availables modes are suspend, hibernate, hybrid-sleep. No deep sleep – cmak.fr Sep 13 at 18:40
  • @Phillip, did that answer your question ? – cmak.fr Sep 15 at 7:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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