Removing 10 minute screen timeout for Ubuntu Server
My situation is that I run an Ubuntu Server for normal server-like tasks; web server, file server, etc. I decided to install XMBC on it so I could make it into a HTPC because after all, it already had all my media stored on it. Installing XMBC meant that I also had to install Xserver and along with that install, I scored some defaults for screen saver timeout and monitor timeout (all set to 10 minutes) and this really sucks when you’re watching a movie and even 10 minutes the display would turn off unless you gave some input (keyboard, mouse, remote). This guide will show how I fixed it.
The magic tool that will help us here is called
xset, that according to its man pages says it’s a user preference utility for X. By default it seems to operate on the current X display so if you’re doing all these commands on the actual machine, you should be able to get away without the
-display :0 bits that I have in all my commands although leaving them in there won’t hurt. The reason that I needed to have them is because I’m SSHing into the server and your SSH session has no X display so you must explicitly state it. For more information on displays, have a look at the section titled DISPLAY NAMES under the man X(7) pages.
The overview of what we’re going to do is check to see what the preferences are currently set to and then set them to a value that means the display will never timeout. This is probably a bad thing if your box has a monitor permanently attached to it but I use a TV as my monitor so it gets turned off separately from the server (which never gets turned off).
Note that I’ve bolded the commands that I submit and if you copy and paste them, be sure to leave off the starting dollar sign ($).
Update 23 August 2012: I found that setting the display to never turn off made the UI of XBMC slow down to a snail’s pace. I suspect it’s the rubbish video card that I have but I fixed the problem by setting the timeout to 3hrs so it effectively never turns off while I’m using it (unless you watched something for longer than 3hrs without pressing anything on the remote/keyboard/mouse) but it will turn off eventually. Now the UI performs as normal. Experiment and see what works for you.
First we need to check where we’re starting from by having a look at what the preferences currently are. The important bits are highlighted in red. We can see that we have a screen saver that is set to come on after 600 seconds and that DPMS is enabled and set to standby, suspend and turn off (so ultimately just turn off) the display.
So let’s start by turning DPMS off:
$ xset -display :0 -dpms
Optional: We’ve just turned DPMS off so it’s timeouts should no longer have any effect but if you really want to kill all those values, use this command:
$ xset -display :0 dpms 0 0 0
The command(s) that we’ve run so far don’t give any feedback to the user so we run the same command as in the first step to see if our changes have done anything. I ran both commands in steps 2 and 3 so my timeouts are 0 but the really important bit is that DPMS is Disabled as you can see in red.
Now, we need to disable the screen saver using the following command:
Again, let’s check that it worked and you’ll see the two timeout values for the screen saver set to 0 (and highlighted in red):
We’re done. Your monitor should stay on all the time now. Note that if you ever want to re-enable the timeouts, you can supply a value of your choosing (in seconds) to the commands we used to set the timeouts to zero. You can also turn DPMS back on using the plus sign (+) instead of the minus sign (-) that we used to turn it off in step 2.
As with all commands in linux/unix, if you want more information then the following two commands are your friend:
$ xset --help $ man xset