Hot answers tagged

55 votes

How to disable USB autosuspend on kernel 3.7.10 or above?

For Ubuntu and Debian, usbcore is compiled in to the kernel, so creating entries in /etc/modprobe.d will NOT work. Instead, we need to change the kernel boot parameters. Edit the /etc/default/grub ...
user avatar
42 votes

How to disable auto suspend when I close laptop lid?

You can use this to temporarily disable lid-switch events: systemd-inhibit --what=handle-lid-switch sleep 1d
user avatar
39 votes
Accepted

GNOME: disable sleep on lid close

Install GNOME Tweak Tool and go to the Power section. There's an option to disable the automatic suspend on lid close. Option details I compared dconf before and after to find the option, but it ...
user avatar
  • 44.5k
33 votes
Accepted

How can tasks "refuse to freeze" on suspend?

Task freezing is documented in detail in the kernel documentation. User-space processes can’t refuse to freeze; they do get frozen, but the signalling between the kernel and processes is handled ...
user avatar
31 votes

Ubuntu 18.04 won't wake after screen lock and blank / suspend / sleep

There seems to be an issue with nouveau driver. Edit the grub file by editing it with sudo access. sudo vim /etc/default/grub Add nouveau.modeset=0 to the line that says GRUB_CMDLINE_LINUX="&...
user avatar
  • 419
27 votes
Accepted

pm-suspend vs systemctl suspend?

In short, you should generally prefer the suspend mode integrated by your distro. For distros that ship systemd, that's typically systemctl suspend. For instance, the Arch Linux wiki says: systemd ...
user avatar
  • 19.5k
26 votes
Accepted

What is the purpose of the bash `suspend` builtin command?

If you start a shell from another shell, you can suspend the inner one. Say when using su, and wanting to switch back to the regular user for a moment: user$ su Password: ... root# do something root# ...
user avatar
  • 116k
25 votes

What is the purpose of the bash `suspend` builtin command?

That's the equivalent of pressing Ctrl+Z in other commands. It suspends the shell and gives control back to parent shell or process if any. Example: zsh$ bash bash-4.4$ cd / bash-4.4$ suspend zsh: ...
user avatar
24 votes
Accepted

How to run systemd user service to trigger on sleep (aka. suspend, hibernate)?

sleep.target is specific to system services. The reason is, sleep.target is not a magic target that automatically gets activated when going to sleep. It's just a regular target that puts the system to ...
user avatar
  • 2,744
21 votes
Accepted

Is it safe to boot computer that lost power while suspending to disk?

If power is lost prior to explicitly entering S4 or S5 state (hereafter just referred to as "hibernation state" for simplicity), then the partially filled data in the swap partition will be ...
user avatar
  • 114k
18 votes
Accepted

Power button does not trigger suspend (nor anything)

I have the same Laptop. Did you push the power button for more than one second? It needs some time to trigger the event.
user avatar
  • 196
15 votes
Accepted

KDE5 After resume from suspend I have corrupted labels under icons

I know your pain, this has been annoying me for months now. The only way to fix the desktop I've found is brute force, I made a shortcut to do this and run it every time I resume from standby: ...
user avatar
  • 266
15 votes

Make changes to `/proc/acpi/wakeup` permanent

For a USB mouse or keyboard, you can use a udev rule to make the setting permanent. First, look up the PCI vendor ID of your mouse/keyboard using lsusb. For my mouse, it's 046d: Bus 001 Device ...
user avatar
14 votes

How to disable suspend on close laptop lid on NixOS?

While the solution proposed by Mirzhan will probably work, there is a much more elegant way using the services.logind.lidSwitch and services.logind.lidSwitchDocked options. Now, you can just write ...
user avatar
13 votes
Accepted

Prevent system from going to sleep/suspend - how Xviewer/VLC do it

Linux applications inhibit suspend through a D-Bus call to org.gnome.SessionManager.Inhibit Contrasting inhibit vs. prevent Note that inhibit is different than prevent. Inhibiting a screensaver, ...
user avatar
12 votes

How do I make my laptop sleep when it reaches some low battery threshold?

As of Debian ≥ 10 (and comparably recent Linux systems), you can just create a file /etc/cron.d/check-battery that contains: * * * * * root [ "$(cat /sys/class/power_supply/BAT0/status)" != ...
user avatar
  • 369
11 votes

how to run a user script after systemd wakeup?

This answer is based on askubuntu.com/a/661747/394818 (as also referred to in the comment by @sun-bear), askubuntu.com/q/616272/394818 and superuser.com/a/1269158/585953. Using a system service: ...
user avatar
11 votes
Accepted

How do I find out which application is disabling sleep?

Under Freedesktop-compliant environments, including XFCE4, sleep inhibition is communicated via D-Bus on the org.freedesktop.PowerManagement bus. I can't find any documentation about this; the xfce4 ...
user avatar
10 votes

How do I prevent GNOME suspending while I finish a compilation job

You can disable inactivity timeout completely. For example to disable the suspend timeout only for AC power, run gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout 0 I ...
user avatar
  • 10.9k
10 votes

How do I make my laptop sleep when it reaches some low battery threshold?

Instead of hacking your own scripts and if you are using Ubuntu as the tag suggests, you could just install the upower package. It should be available on all Debian derivatives including Ubuntu. By ...
user avatar
  • 295
10 votes

GNOME: disable sleep on lid close

Unfortunately, the inhibitor routes didn't seem to work as advertised for me on openSUSE Tumbleweed (42.1) using GNOME. But, I had success with Systemd masking: systemctl mask sleep.target suspend....
user avatar
  • 4,151
9 votes
Accepted

How to suspend with a keyboard shortcut?

I wrote a script. It seems to do what you ask for: #!/usr/bin/env zsh # Custom suspend # # (That 'zsh' up there can be switched to 'bash', or # pretty much any shell - this doesn't do anything too ...
user avatar
9 votes

how to run a user script after systemd wakeup?

I created a file in /lib/systemd/system-sleep/ (you can call it e.g. wakeup): #!/bin/sh case $1 in post) /bin/runme ;; esac Then I set the executable permission bits. # chmod +x /usr/lib/...
user avatar
  • 296
9 votes
Accepted

Linux Mint 18 suspend issue

I've solved this issue by installing new linux kernel "4.5.2-040502-generic" following this guidelines: https://askubuntu.com/questions/761758/ubuntu-16-04-lts-cannot-suspend-fails-on-suspending ...
user avatar
  • 281
8 votes
Accepted

How to disable suspend on close laptop lid on NixOS?

There is a configuration option services.logind.extraConfig. Open your NixOS configuration file (/etc/nixos/configuration.nix). Assign a string "HandleLidSwitch=ignore" (or whatever you would usually ...
user avatar
8 votes

Ubuntu 18.04 won't wake after screen lock and blank / suspend / sleep

The Screen Saver helped me with Xubuntu 18.04 - except I installed xscreensaver and everything started working correctly.
user avatar
7 votes

Immediate wake-up after suspend

I don't know if you ever got this problem resolved, but I had the same thing happening on Debian buster/sid on a ThinkPad T460. The output of my dmesg wasn't identical to yours, but importantly, it ...
user avatar
  • 866
7 votes
Accepted

How does systemctl suspend work?

The defaults are "mem", "standby", "freeze" (the last two and the ability to configure sleep modes have been added in 2013 so they might not be available on older setups). The manual page you quoted ...
user avatar
  • 73.3k
7 votes

Graceful shutdown with suspend job hanging in syscall

I know this doesn't exactly answer the question but maybe it will help somewhat. You or someone else who will read this. I had (or still have) similar problem now. Suspend didn't finish returning to ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible