Run a script on wake from deep sleep?

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?

Suspend puts computer to sleep, then immediatly wakes itself up

The computer will suspend for a matter of seconds, then without touching anything on my mouse, nor moving it and not touching my keyboard it will wake itself up.

I have tried using: cat /usr/local/sbin/select-resume-devices

Which looks like, I select microftsoft keyboard and save. It makes no difference:

enter image description here

#!/bin/bash #  # Script to create resume udev rules for USB devices # # Depends on zenity # 09/05/2012 - V1.0 by Nicolas Bernaerts  # udev file to generate UDEV_FILE="/etc/udev/rules.d/90-hid-wakeup-enable.rules"  # set separator as CR IFS=$  '\n'  # list all USB devices, excluding root & hubs LIST_DEVICE=(`lsusb | grep -v "0000:0000" | grep -iv "hub" | sed 's/^.*[0-9a-f]\:[0-9a-f]* \(.*\)$  //g'`)  # loop thru the devices array to generate zenity parameter for DEVICE in "$  {LIST_DEVICE[@]}" do   # if needed, remove [xxx] from device name as it gives trouble with grep   DEVICE=`echo "$  DEVICE" | sed 's/\[.*\]//g'`    # add it to the parameters list   ARR_PARAMETER=( FALSE $  {DEVICE} $  {ARR_PARAMETER[@]} ) done  # display the dialog box to choose devices TITLE="Wakeup - Enable USB devices" TEXT="Please, select USB devices you want to use to resume your computer" CHOICE=`zenity --list --width=600 --height=250 --text=$  TEXT --title=$  TITLE --checklist --column "Select" --column "Device name" "$  {ARR_PARAMETER[@]}"`  # slit the device choice into an array IFS="|" read -a ARR_CHOICE <<< "$  CHOICE"  # if at least one device has been selected, initialise udev rules file [ $  {#ARR_CHOICE[@]} -gt 0 ] && echo "# udev rule for USB wake-up of selected devices" > $  UDEV_FILE [ $  {#ARR_CHOICE[@]} -gt 0 ] && echo "#" >> $  UDEV_FILE  # loop thru the selected devices to create udev rules for DEVICE_NAME in "$  {ARR_CHOICE[@]}" do   # get current device data   DEVICE_DATA=`lsusb | grep "$  {DEVICE_NAME}" | sed 's/^.*ID \([0-9a-f]*\):\([0-9a-f]*\).*$  /|/g'`   DEVICE_VENDOR=`echo $  DEVICE_DATA | cut -d"|" -f1`   DEVICE_PRODUCT=`echo $  DEVICE_DATA | cut -d"|" -f2`    # create udev rule for current device   DEVICE_RULE="SUBSYSTEM==\"usb\", ATTRS{idVendor}==\"$  DEVICE_VENDOR\", ATTRS{idProduct}==\"$  DEVICE_PRODUCT\" RUN+=\"/usr/local/sbin/enable-wakeup $  env{DEVPATH}\" "    # add udev rule for current device   echo "# $  {DEVICE_NAME}" >> $  UDEV_FILE   echo $  {DEVICE_RULE} >> $  UDEV_FILE done  # if at least one device has been selected, display notification TITLE="USB resume enabled" TEXT="Your USB devices are resume enabled.\nTo finalize configuration you have to do one of these actions :\n- replug USB devices\n- reboot the computer" [ $  {#ARR_CHOICE[@]} -gt 0 ] && notify-send --icon=media-eject $  TITLE $  TEXT 

What my wakeup looks like

hutber@hutber:~$   cat /proc/acpi/wakeup Device  S-state   Status   Sysfs node PEG0      S4    *enabled   pci:0000:00:01.0 PEGP      S4    *disabled  pci:0000:01:00.0 PEG1      S4    *disabled PEGP      S4    *disabled PEG2      S4    *disabled PEGP      S4    *disabled SIO1      S3    *disabled  pnp:00:00 PS2K      S4    *disabled PS2M      S4    *disabled UAR1      S4    *disabled  pnp:00:01 RP01      S4    *enabled   pci:0000:00:1c.0 PXSX      S4    *disabled RP02      S4    *disabled PXSX      S4    *disabled RP03      S4    *disabled PXSX      S4    *disabled RP04      S4    *disabled PXSX      S4    *disabled RP05      S4    *disabled PXSX      S4    *disabled RP06      S4    *enabled   pci:0000:00:1c.5 PXSX      S4    *disabled  pci:0000:04:00.0 RP07      S4    *enabled   pci:0000:00:1c.6 PXSX      S4    *enabled   pci:0000:05:00.0 RP08      S4    *enabled   pci:0000:00:1c.7 PXSX      S4    *disabled  pci:0000:06:00.0 RP09      S4    *enabled   pci:0000:00:1d.0 PXSX      S4    *disabled  pci:0000:08:00.0 RP10      S4    *disabled PXSX      S4    *disabled RP11      S4    *disabled PXSX      S4    *disabled RP12      S4    *disabled PXSX      S4    *disabled RP13      S4    *disabled PXSX      S4    *disabled RP14      S4    *disabled PXSX      S4    *disabled RP15      S4    *disabled PXSX      S4    *disabled RP16      S4    *disabled PXSX      S4    *disabled RP17      S4    *disabled  pci:0000:00:1b.0 PXSX      S4    *disabled RP18      S4    *disabled PXSX      S4    *disabled RP19      S4    *disabled PXSX      S4    *disabled RP20      S4    *disabled PXSX      S4    *disabled RP21      S4    *disabled PXSX      S4    *disabled RP22      S4    *disabled PXSX      S4    *disabled RP23      S4    *disabled PXSX      S4    *disabled RP24      S4    *disabled PXSX      S4    *disabled GLAN      S4    *enabled   pci:0000:00:1f.6 XHC   S4    *enabled   pci:0000:00:14.0 XDCI      S4    *disabled HDAS      S4    *disabled  pci:0000:00:1f.3 CNVW      S4    *disabled 

Laptop heating problems when on sleep

It seems like my laptop seems to heats up whenever it goes to sleep as the fan is not running. I’m aware that some components are still running while on sleep, and I’m almost certain that my GPU is running while sleeping, which is causing a lot of battery loss. I was wondering if there’s any way to make shut off the GPU whenever the computer goes to sleep. I’m almost certain that heating up shouldn’t be the expected behavior because it doesn’t heat up when I’m using Windows sleep.

Thunderbolt dock screens not working after waking from sleep

I have a HP ZBook 15 G4 with both Intel 630 and Nvidia Quadro M1200 Mobile GPU with Nvidida driver 430 running 18.04.3. At work I have a Thunderbolt dock ( that I connect to access my two external displays and mouse & keyboard. This works fine if I do a cold boot of the machine but if I would put Ubuntu to sleep, disconnect the thunderbolt cable and wake the machine the next day and connect, only the keyboard and mouse works, not the screens. The get them back working, I have to reboot my machine and thus closing all my open programs and files.

I have tried various graphics drivers but not been able to get this working. My dock is running the latest firmware as well as the bios of my machine.

How can I solve this issue? Could I somehow do a “soft” reboot of the driver or something else when waking it up?

portable monitor isn’t detected after sleep

I have a dell xps 13 9380 running 19.04 Ubuntu. I also have a zenscreen mb16ac portable monitor. The portable monitor connects to my laptop via usb c as a display and to get power.

Initially, when I plug the monitor in, my laptop detects it and everything works, but when my laptop goes to sleep or suspends, and i wake it back up, my laptop no longer detects the monitor, but it’s still powering it.

The only way to get it to detect the monitor is if I unplug and plug the usb port back in. I’m not sure why this is happening.

How can I get my laptop to detect my portable monitor when it wakes up? I don’t want to keep unplugging and plugging in the cable every time ubuntu sleeps or suspends.

Monitors do not enter powersave / sleep mode after screen blanking

Ubuntu 1904, both X and Wayland. AMD 2400G, ASUS motherboard with 3 screens: HDMI,VGA,DVI.

When I leave my computer, it will blank the screen after the timeout, then my 3 monitors will fall asleep, but they will wakeup after 10 seconds or so, and never enter power save mode again. They will keep showing the lock screen.

So it is a costly affair, burning 100 Watts, and shortening lifespan of my screens.

Also when I turn off my screens manually:

xset dpms force off 

They turn off, and wake up after 10 seconds.

Could be this bug 1292041. But I doubt because it’s is also happening when powering off the screens with xset.

How do I get my screens to enter powersave mode?

Ubuntu 19.04 with External Monitors Closes All Applications after Sleep or Suspend and Requires 2 Logins

System: Ubuntu 19.04 – all updated are performed

MSI laptop has two external monitors; after sleep/suspend, system requires two logins. First login appears to be linux core; the second login has the newer modern UI.

After login, all applications are closed!

I have updated my NVIDIA drivers and attempted several fixes but the issue continues to exist.

Please help!

Attempted Solution: updated linux-generic (uname -r –> 5.0.0-25-generic)

Thank you :o)

Color Spray vs. Sleep: which spell should a low-level spellcaster use?

One of the easiest ways of winning low-level combat encounters is casting Color Spray or Sleep. Those two are both save-or-lose spells, and low-CR enemies usually have weak Will saves.

However, choosing one spell or another is tricky. What are the advantages and disadvantages of both?

I am mainly playing PFS scenarios.

Rules-as-written, does an attempt to tie up a creature affected by Sleep awaken it?

When playing PFS, I used Sleep on a group of thugs and disabled them all. When I declared tying up one of them, our GM told us that the thug awoke and was now trying to fight. This left us with no choice other than finishing the thugs, which was rather unpleasant: I don’t like to make my characters murderous cretins, and I try to spare any non-mindless enemies that I can and report them to local authorities.

The situation happened rather long ago.

However, just now, rereading the description of Sleep, I remembered this situation and looked at the list of things that can awaken an affected target:

  • Wounding: I understand that as dealing HP damage
  • Slapping: “Awakening a creature is a standard action (an application of the aid another action)”

It is also explicitly noted that “normal noise” is not enough.

  1. Is it RAW to rule that tying someone up awakens them?
  2. Is it reasonable (beneficial for the game) to make such a ruling?

I want to remind everyone that the first question is about rules as written (RAW) and needs to be based on rules alone, no interpretations allowed. The second question is subjective and requires the answerer to state their experience regarding the Sleep spell vs. taking prisoners, or regarding taking prisoners in general.