How do I permanently disable Linux's console screen saver, system-wide?

I've got an Ubuntu server that boots up in text mode. It rarely has a screen or keyboard attached to it, but when I do attach a screen, I usually have to attach a keyboard too, because the darn console mode screen saver will be on and I'll need to hit a key to see what's going on.

I'm aware that the setterm command can disable this, but it's a per-session thing. How can I make it so the machine never ever blanks the screen in text mode, even when it's first booted up and sitting at the login prompt?


Solution 1:

In Ubuntu 12.10 and earlier the console-tools package allows console options to be controlled.

To turn off screen blanking and powerdown, set BLANK_TIME and POWERDOWN_TIME to 0 in /etc/console-tools/config. If you'd prefer not to modify the config file, the same effect can be achieved by creating a new file in /etc/console-tools/config.d containing the following:

BLANK_TIME=0
POWERDOWN_TIME=0

The name of the file in config.d must consist entirely of upper and lower case letters, digits, underscores, and hyphens.

Solution 2:

Or you use /etc/kbd/config to set up (depends on your system, what is installed)

BLANK_TIME=0
BLANK_DPMS=off

Solution 3:

The parameter is controlled via the kernel command line, using setterm merely alters the runtime settings. To disable it system wide you can alter your kernel boot command line by appending it with "consoleblank=0" in your boot configuration (grub/lilo).

If something during boot setterm's it then it will override the value.

Solution 4:

If you add the setterm command to /etc/rc.local, it should take effect for all virtual consoles, whether or not a user is logged into them. E.g.:

setterm -blank 0