Tuesday, February 8, 2011

Linux disable screen blanking i.e. preventing screen going blank

SkyHi @ Tuesday, February 08, 2011
It is easy to disable screen saver under X window. But when it comes to text based login or terminal you will not find easy way to disable text based power saving mode (i.e. when your screen goes blank after a few minutes).
So how do I disable the blank screen mode, which activated after a few minutes? Answer is use setterm command.
setterm writes to standard output a character string that will invoke the specified terminal capabilities. Where possible terminfo database (terminfo is a data base describing terminals, used by screen-oriented programs and libraries such as ncurses) is consulted to find the string to use.
By default, the Linux kernel will use screen-save option to disable it you need to type 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

 

Other useful options

This command also supports other useful options:
Resets the terminal to its power on state:
$ setterm -reset
Alternatively, initialize terminal:
$ setterm -initialize
Turns the terminal's cursor on or off:
$ setterm -cursor [on|off]
Turns automatic line-wrapping on or off (virtual consoles only)
$ setterm -linewrap [on|off]
Sets the foreground text color (virtual consoles only):
$ setterm -foreground blue
Sets the background text color (virtual consoles only):
$ setterm -background red
Enables or disables the sending of kernel printk() messages to the console (virtual consoles only). Useful if you get lots message from iptables firewall:
$ setterm -msg [on|off]
I regularly use these (above) options.

See also:

  • Please consult the setterm and terminfo man pages for more information.

==================================================================
This happens when you run xgl on an ATI graphics card. To fix it, you can do this:
Code:
gksudo gedit /etc/X11/xorg.conf
Add this section to the file and save it:
Code:
Section "ServerFlags"
    Option        "blank time" "0"
    Option        "standby time" "0"
    Option        "suspend time" "0"
    Option        "off time" "0"
EndSection
If you already have a section called "ServerFlags", just add the four "Option" lines before the "EndSection" line.
Restart the xserver (ctrl-alt-backspace) and the new settings should take effect. 

REFERENCES
http://www.cyberciti.biz/tips/linux-disable-screen-blanking-screen-going-blank.html
http://ubuntuforums.org/showthread.php?p=3997204#post3997204
http://ubuntuforums.org/archive/index.php/t-216747.html