Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
Seems to be nicely answered over at askubuntu: askubuntu.com/questions/138918/… –  Roy Oct 15 '12 at 20:12

6 Answers 6

up vote 21 down vote accepted

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.

share|improve this answer
    
How you know that? I've been scouring the Internet all morning looking for the documentation for /etc/console-tools and haven't been able to find any. –  raldi May 1 '10 at 21:28
10  
Word of warning with this: I installed console-tools on ubuntu server 12.04, did the above config and it completely tanked it... Not sure what I did wrong, but if it happens to anyone else (and you're crap at servers like me!), boot to recovery -> root prompt -> mount -o remount,rw / -> apt-get remove console-tools -> reboot –  BaronVonKaneHoffen Sep 20 '12 at 12:47

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

BLANK_TIME=0
BLANK_DPMS=off
share|improve this answer
    
What do I restart when having KBD config change ? –  Frodik Jan 11 '12 at 11:24
1  
Seems to be /etc/init.d/kbd reload –  Toubib Apr 25 '12 at 10:45
2  
I tried this in a fresh install of Ubuntu Server 10.04.4 and 12.04.1, and it didn't work in either one. –  Prof. Moriarty Sep 22 '12 at 0:14
    
To what distributions does this apply? –  Michael Hampton Oct 13 '12 at 4:17

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.

share|improve this answer
2  
As seen on superuser.com/questions/152347/… ! –  codehead Oct 18 '12 at 13:14
    
Using grub2 it could be added in /etc/default/grub GRUB_CMDLINE_LINUX_DEFAULT="consoleblank=0" and then updating grub config with grub[2]-mkconfig -o /boot/grub/grub.cfg. Or it could be embedded in built-in kernel command line while configuring and compiling kernel manually. –  user3132194 Oct 30 at 7:44

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
share|improve this answer
    
That doesn't seem to actually work in rc.local. –  raldi May 1 '10 at 20:09
    
It's worked for me in the past on RedHat-type systems. It could be that Debian/Ubuntu load rc.local at a slightly different time than RH. Sorry about that. –  James Sneeringer May 1 '10 at 21:33
    
Does not work on CentOS 6.3. Screen continues to blank out after 10 minutes. –  Michael Hampton Oct 13 '12 at 4:16

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";
share|improve this answer
    
Your answer would be a lot better if you actually described what is going on here. Just giving huge command like that with no explanation isn't very useful. –  Zoredache Oct 13 '12 at 3:01
    
@Zoredache you're right, I've added an explanation. Thanks for the feedback. –  Chris Pick Jan 24 '13 at 1:37
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.