49

I'm running Ubuntu 12.04, and my laptop* won't wake from sleep/suspend/hibernate. (Is sleep the same thing as suspend?) I'm not even sure which of these things it's doing. When I am done working for the day, I lock my screen (Control-Alt-L). When I come back the next day, the screen is in power saving mode, and no amount of typing or clicking (on the usb keyboard/mouse or the builtin keyboard/trackpad) nor tapping the power button will bring it back to life.

The only way I can get my machine to work is to hold down the power button until it shuts off, then press the power button again to turn it back on. Obviously, anything I had open from the previous day is pretty much gone -- in particular, my VMs all get rudely shut down without any warning.

This is driving me INSANE. I spend the first hour of every work day trying to figure out how to get my computer to stop locking up over night.

What I've tried:

  1. Editing the org.freedesktop.upower.policy to disable suspend and hibernate.
  2. Setting power management options in "Power" section of "System Settings".
  3. Looking at all power management options in the BIOS (none appear to be relevant to sleep/suspend/hibernate).
  4. Reading every forum post/askubuntu post that I can find that's even tangentially related to the subject.
  5. Add acpi=off to kernel args. (Results in USB keyboard and mouse not working, so I didn't wait to see if it fixes the suspend.)
  6. Add apm=off to kernel args.

My question: how to disable the automatic sleep and/or hibernate (and/or anything similar) in Ubuntu 12.04. I don't care if it's still possible to sleep/suspend/hibernate/whatever by pushing buttons or running some command or reciting led zeppelin lyrics backwards. I just want my laptop to be ready for work in the morning.

*The laptop is a Dell Latitude something or other. I don't want to get too specific because I've seen a lot of similar questions get closed for being too specific. I think my question is generic enough to stand -- it's a question about the latest, stable version of Ubuntu.

Link to dmesg

Link to /var/log/kern.log

EDIT:

Nothing I've tried so far has prevented Ubuntu from sleeping at night, and when it does sleep, nothing I have tried can reliably get it to wake back up. I've seen a few posts that say buggy video drivers can cause problems with waking.

Last night, on a hunch, I tried switching to console (ctrl+alt+1) before leaving work, just to see what would happen. This morning when I woke up the computer, it instantly woke up back to the console. I switched over to Gnome (ctrl+alt+7) and although the screen looked frozen, I typed my password, pressed enter, and made some coffee. When I got back a few minutes later, my desktop was ready, just like I left it last night.

I'm going to keep trying this to see if this is a reliable solution.

EDIT 2:

No dice. Switching to the console after logging out does nothing for me... still have to reboot my computer each morning. It's driving me nuts... I can't believe how erratic suspend is on Ubuntu. Or the fact that it can't simply be disabled.

9
  • Have you looked under the Advanced Settings of the screen saver?
    – Mitch
    Jun 29, 2012 at 14:39
  • Where are the screen saver settings? I looked under Display, Appearance, Brightness and Lock. Can't find screen saver. The searchbox in system settings doesn't help: no results when searching for "saver". Jun 29, 2012 at 14:43
  • check the power settings, they have rules regarding suspend/hibernate
    – Thomas Ward
    Jun 29, 2012 at 15:00
  • You need to consider that what you think is "suspend" may just be a crash, plain and simple. Please pastebin dmesg and /var/log/kern.log . If it's suspended, you should get the blinking/slowwwwly-on-to-off-and-back light.
    – ish
    Jun 29, 2012 at 15:56
  • @izx /var/log/kern.log doesn't show anything interesting overnight, except for some blocked packets here and there. I could be wrong, but the dmesg buffer gets overwritten during startup, so I don't think indications of a crash could be found there. Jun 29, 2012 at 16:30

8 Answers 8

39

Here are the two common Gnome 3 ways which usually disable suspend; otherwise you can try booting with the acpi=off parameter:

  1. Power Settings:

    enter image description here

    enter image description here

  2. gnome-tweak-tool (install if necessary):

    enter image description here

5
  • Thanks @izx. I already tried #1 before posting. I just tried #2 but the options are already set to "Nothing". Your comment about acpi=off reminded me that I had already tried that as well, so I updated my original post. Still, +1 for the effort. Jun 29, 2012 at 16:54
  • Well, my computer managed to wake from sleep after sleeping all weekend, and then it woke from sleep again after sleeping Monday night. I don't think I actually changed anything since the last time I posted here, so I'm not sure why it's suddenly working. I'm selecting this post as the correct answer because it is the most thorough. Jul 3, 2012 at 12:40
  • 1
    Scratch that last comment. After working twice in a row, it's now failed every single day since then. I'm about ready to throw this computer out the window. Jul 12, 2012 at 13:55
  • I installed the gnome-tweak-tool and saw that on my Dell GX620 I had suspend set for Laptop lid close action on battery and for Laptop lid close action when on AC. The weird thing is that my Dell GX620 is not a laptop but a USSF (Ultra Small Form Factor) mini-tower. I've just changed these settings to Nothing and will confirm tomorrow if this change will have prevented it from going to sleep.
    – user88823
    Jan 21, 2013 at 3:21
  • I need to find "Brightness and Lock" option to disbale power off automatically.
    – shaby
    Oct 6, 2016 at 4:51
16

From System Settings or by searching in Dash, go to Power settings. You'll find what you need there ;)

Power settings

And to prevent from locking, go to Brightness and Lock:

Brightness and Lock settings

0
5

@Kaled Kelevra, I've created the file 00CPU and followed all the steps, unfortunately my machine still went to sleep after 10 minutes.

On the ArchLinux forums, I found a solution that worked for me. See answer #21.

This is how I fixed mine in /etc/X11/xorg.conf:

Section "ServerLayout"

    Identifier     "Layout0"
    Screen      0  "Screen0"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Evdev Mouse" "CorePointer"

  Option "BlankTime" "0"
  Option "StandbyTime" "0"
  Option "SuspendTime" "0"
  Option "OffTime" "0"

I just added the 4 options you see there. Test it out and post back. Good luck.

4

Why not check out Caffeine application indicator. It does precisely what you want, and is very easy to use.

1
  • 2
    Be warned: I used the Ubuntu Caffeine application indicator recently in an attempt to keep on of my desktops (running 18.04.2 LTS on 4.15.0-46) turned on and accessible while I was out of town, and despite being activated/enabled, the system still ended up suspending/hibernating which made it inaccessible while I was away. After that experience, I would recommend sticking with the accepted answer (i.e., disabling automatic suspension), but your mileage may vary.
    – Spencer D
    Apr 6, 2019 at 17:24
3

In unity dash type screen saver, and click on it. When the window open click on the advanced tab, and uncheck Power Management Enabled.

enter image description here

4
  • Most people have xscreensaver installed... :-)
    – reverendj1
    Jun 29, 2012 at 14:53
  • Sorry, I should have mentioned: I'm not running Unity. I'm running Gnome. Gnome has a dashboard but typing "screen" and/or "saver" doesn't have any hits. Jun 29, 2012 at 14:59
  • 1
    Do you have Gnome classic or Gnome 3?
    – Mitch
    Jun 29, 2012 at 15:11
  • @Mitch Gnome 3. Jun 29, 2012 at 16:17
3

I don't know if you had solved that problem you have with suspend/hibernate, but if not, I've a script maybe solve it (I had the same problem and it worked for me). :) Create a script in the /etc/pm/sleep.d/ directory ("sudo gedit /etc/pm/sleep.d/ 00CPU", for example) with the following content:

#!/bin/sh
# Workaround for concurrency bug in xserver-xorg-video-intel 2:2.4.1-1ubuntu10.
# Save this as /etc/pm/sleep.d/00CPU

. "${PM_FUNCTIONS}"

case "$1" in
hibernate|suspend)
for i in /sys/devices/system/cpu/cpu*/online ; do
echo 0 >$i
done
;;
thaw|resume) 
sleep 10 # run with one core for 10 secs
for i in /sys/devices/system/cpu/cpu*/online ; do
echo 1 >$i
done
;;
*)
;;
esac

Then just give the script execute permission (sudo chmod 755 00CPU) and... that's all! Enjoy your Ubuntu.

P.S.: sorry for my english. P.S.2.: you can change the "sleep 10" value, with "sleep 5" for example, so your second processor core will run a bit earlier.

Note: It seems to be a concurrency problem with some kernels versions and determinate multi-core processors.

3

You can use gsettings for enabling and disabling monitor from going to sleep:

  • Disable turning off screen

    gsettings set org.gnome.desktop.session idle-delay 0

  • Enable turning off screen with 5 min delay

    gsettings set org.gnome.desktop.session idle-delay 300

source : https://askubuntu.com/a/788456/88543

1
  • If the answer from another question directly helps this one, and the questions are similar, consider flagging this question as a duplicate of the other one, instead of copying your answer many times.
    – Thomas Ward
    Jul 2, 2017 at 19:09
0

With 12.04 I've noticed that my computer seems to be very hard to activate once the screensaver/lock has been invoked, particularly when it is locked for more than a few minutes. The system isn't really being suspended or hibernated--it just seems that way.

I find that I can wait several minutes and eventually the system will prompt me for my userid and password and I'm back in business. Before I figured out that it would come back I'd power it off like you do.

I don't know why it takes so long, it's probably a bug. Does it help to simply wait 3 to 10 minutes? If so perhaps we are seeing the same thing.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .