I am getting a web server setup at home on an older AMD 2400+ desktop. I have Ubuntu 11.04 installed and running however, after a time, I can no longer browse to the server. When I go to the keyboard and press a key, everything magically works again.

I have looked through the BIOS and I am not seeing any power saving features enabled. Is there anything like that in Ubuntu? Can it be disabled?

I don't have any GUI installed. This is console only.

On Ubuntu 16.04 LTS, I successfully used the following to disable suspend:

sudo systemctl mask sleep.target suspend.target hibernate.target hybrid-sleep.target

And this to re-enable it:

sudo systemctl unmask sleep.target suspend.target hibernate.target hybrid-sleep.target

From man systemctl:

mask NAME...  
           Mask one or more units, as specified on the command line. This
           will link these unit files to /dev/null, making it impossible to
           start them. This is a stronger version of disable, since it
           prohibits all kinds of activation of the unit, including
           enablement and manual activation. Use this option with care. This
           honors the --runtime option to only mask temporarily until the
           next reboot of the system. The --now option may be used to ensure
           that the units are also stopped. This command expects valid unit
           names only, it does not accept unit file paths.

 unmask NAME...
           Unmask one or more unit files, as specified on the command line.
           This will undo the effect of mask. This command expects valid
           unit names only, it does not accept unit file paths.
  • How would I test whether these are or aren't masked already? (And what does mask or unmask do anyways? Never heard of those before.) – ArtOfWarfare Sep 15 '17 at 0:53
  • @ArtOfWarfare From man systemctl "Mask one or more units, as specified on the command line. This will link these unit files to /dev/null, making it impossible to start them. This is a stronger version of disable, since it prohibits all kinds of activation of the unit, including enablement and manual activation. Use this option with care. This honors the --runtime option to only mask temporarily until the next reboot of the system. The --now option may be used to ensure that the units are also stopped. This command expects valid unit names only, it does not accept unit file paths." – Centimane Oct 24 '17 at 18:17
  • @Centimane - Thanks. So how would I actually check if they already were masked or not? Obviously I could try just running them and see what happens, but that would potentially cause the side effect of putting my computer to sleep (which would be... bad... it has issues waking up, which is why I want to just ensure it never sleeps.) – ArtOfWarfare Oct 24 '17 at 19:33
  • @ArtOfWarfare you could just check /etc/systemd/system/ for a link to /dev/null – Centimane Oct 24 '17 at 19:38
  • @ArtOfWarfare or systemctl show -p FragmentPath [service]. The FragmentPath property tells you where systemd thinks the unit file lives. A masked service will say /dev/null – Centimane Oct 24 '17 at 19:41

GUI

Have you looked at:

System -> Preferences -> Power Management

On AC Power Tab, Put computer to sleep when inactive for: "Never"

Terminal

Can you open up "gconf-editor"?

Look in: /apps/gnome-power-manager/timeout

Try setting sleep_computer_ac to 0

I'm not positive if anything else needs to be changed as well.

  • How do I do that on the console? I don't have a gui installed. – Mike Wills Jun 6 '11 at 20:17
  • @Mike Wills Updated since you have no gui – Jason Iverson Jun 6 '11 at 20:41
  • 1
    Again, I don't have gnome or any of that installed. It is a pure console. – Mike Wills Jun 7 '11 at 1:47
  • 2
    Up to date command-line way is: gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout '0' && gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout '0' – dess Jul 22 '15 at 11:45
  • 1
    @dess very helpful. Thanks! You should post your response in an answer for others to see. – kalu Jan 12 '16 at 22:59
up vote 10 down vote accepted

The right answer for this located here:

Have you tried adding the kernel options acpi=off apm=off to the GRUB_CMDLINE_LINUX_DEFAULT in /etc/default/grub?

Then run sudo update-grub and reboot your computer.

None of these described solutions worked for me. The laptop was still going to sleep. Using the Grub Linux command line option of acpi=off caused the laptop to fail to boot. I finally found this solution.

sudo vi /etc/default/acpi-support # and then set SUSPEND_METHODS="none"
sudo /etc/init.d/acpid restart

Based on the original solution from Stephan here: Keep Ubuntu Server running on a laptop with the lid closed?

Please try looking into these links - cyberciti.biz and Arch forums

This is an excerpt from the cyberciti.biz link:

By default, the Linux kernel will use screen-save option to disable it you need to type this command (it turns off monitor VESA powersaving features):

$ setterm -powersave off -blank 0

If it dumps back you with an error that read as follows: cannot (un)set powersave mode

You need to shutdown X window system and rerun the above command. Better, add following two commands to your ~/.xinitrc file:

setterm -blank 0 -powersave off -powerdown 0
xset s off

I found Light Locker, as I have Ubuntu 14.04.2 with LXDE (Lubuntu) Desktop; if you have this desktop you can change the default and manage the monitor through that. Otherwise you might have to install gconf-editor through terminal if you don't have it. Light Locker is in can be found in Preferences in the main menu.

  • gconf-editor requires a gui. – Eric Jul 9 '15 at 8:12

protected by Community Aug 23 '17 at 19:10

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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