How do I permanently disable Linux's console screen saver, system-wide?
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
Solution 5:
If you are running a newer Ubuntu that uses upstart, you can use:
for file in /etc/init/tty*.conf; do tty="/dev/`basename $file .conf`"; echo "post-start exec setterm -blank 0 -powersave off >$tty <$tty" | sudo tee -a "$file"; done
A little explanation of what's going on here:
Newer Ubuntu versions use upstart for system startup. With upstart, the Linux consoles are setup with config files stored within /etc/init. The command above starts by iterating over each of those config files:
for file in /etc/init/tty*.conf;
The tty's upstart config file name in $file is used to build the name of the tty device:
tty="/dev/`basename $file .conf`";
An upstart "post-start" command is built that runs "setterm" to disable screen blanking and power saving after the tty has been started:
echo "post-start exec setterm -blank 0 -powersave off >$tty <$tty"
And finally that command is appended to the upstart config file:
| sudo tee -a "$file";