You are here
Automatic sleep on DICE machines
The computer will automatically sleep after it has become idle. You can help it to be idle either by logging out or by locking the screen. To lock the screen look for the Xlock icon on the Toolbar or in the Applications -> Graphics menu, or press Ctl-Alt-L.
If the computer is idle it should usually fall asleep within a few minutes. Occasionally it may have to stay awake so that an automatic management process can run: see Why does the computer wake up by itself?. It may also stay awake because someone has logged in to it remotely, or because the computer is busy. For these reasons it's not a good idea to have a "sleep right now" command. If you have your own DICE computer you can ask Support to change the sleep settings to make it go to sleep more quickly. In addition if you really need the computer to sleep immediately you can do it using the Gnome menu.
If you have the computer in front of you, either press a key on the keyboard or press the computer's power button once. If you are elsewhere in the world but need to wake your computer, read Remote wake-up for sleeping computers to learn how to wake it from a web browser.
DICE computers are managed and configured automatically. That automated management can be done at any time during the day or night, often when computers would be likely to be unused and sleeping. To cope with this, DICE computers have sleep software which wakes them up when it's time to to perform the automated management, and sends them back to sleep at other times.
Check your GNOME Power Manager preferences. You may have changed these to make GNOME Power Manager send your computer to sleep automatically. To find them, choose "Power Management" from the System -> Preferences menu. Then make sure that "Put computer to sleep when inactive for" is set to Never, as in this picture:
If you think that sleep has caused a problem please tell Computing Support.
To keep the computer awake while it runs a long-running command, prefix that command with nosleep. For instance to protect an ssh session from sleep you might type nosleep ssh my.remote.site.com. As long as your command (which you have prefixed with nosleep is still running, the computer should stay awake.
Before doing this please satisfy yourself that there is no alternative course of action. To permanently stop sleep on your computer type om sleep disable. To reverse that and enable sleep again type om sleep enable. These commands will normally only work on a computer which is allocated to you.
Some applications, particularly ssh, firefox and thunderbird, can react badly to sleep. If this happens regularly, and you find yourself having to kill or restart a program after the machine has slept, try using the nosleep command with that application - for instance start firefox with the command nosleep firefox &. This should keep the computer awake as long as the command is still running.
We do it to save energy and to minimise our environmental impact. The University's strategic plan commits us to this.
The software which we use to manage sleep is called The LCFG sleep component or lcfg-sleep for short. You can see it at, or download it from, the LCFG Subversion repository. It's written in Perl and is a component of the LCFG configuration system.
The LCFG sleep component is unrelated to GNOME Power Manager, which is the sleep control built into the GNOME environment used on DICE computers. GNOME Power Manager can be configured to send the machine to sleep when the keyboard and mouse have been idle for a while. By contrast the LCFG sleep component makes many more measurements than this when deciding whether or not it is safe to send the machine to sleep.
To change the behaviour of the LCFG sleep component for your machine, ask computing support. They will change the machine's sleep settings for you.
All recent sleeping and waking is logged in the files matching /var/lcfg/log/sleep.activity*.
The sleep software runs every three minutes. Its actions are logged in the file /var/lcfg/log/sleep. The last twenty or so lines at the bottom of that file should show the result of the most recent run of the sleep software. Each time it runs a number of factors are examined and each results in a "Sleep OK" or "Sleep veto". These are the factors:
- test_imminent_cron looks for important cron jobs which are due to run soon. If it finds one it vetoes sleep.
- load average looks to see if the machine's load average is below the sleep limit (set to 0.1 at the time of writing).
- idle time checks that the idle time of each interactive user shell is over the limit (set to 3 hours at the time of writing).
- minawake checks that the computer has been awake for the specified minimum period (1 minute).
- console activity will agree to sleep only if the
computer's keyboard and mouse have been idle for a while. Note that this test currently only works when the GNOME environment is used. (GNOME is DICE's default environment.) We're working on a fix for idleness detection for other environments (KDE, fvwm, Ice, Xfce, etc.). Until that fix is ready users of these environments will probably find that session idleness is not detected so the machine won't sleep during a login session.
- video checks for known good or bad video driver software.
- current cron stops sleep if an important cron job is currently running.
- disabled checks to see if you have disabled sleep on this computer.
- blacklist prevents sleep if the computer's hardware model is on a blacklist (a few models react badly to sleep).
- nosleep command stops sleep if the nosleep command is currently in use.
- minsleep permits sleep only if the machine would sleep for longer than a permitted minimum period, set to half an hour at the time of writing.
In addition the cron jobs are listed in two categories, those worth waking the machine for and the others; and the machine's next wake-up time is announced and set. For more detail see the man page (type man lcfg-sleep to see it) or look at the source.