I’m running linux clusters, mostly on SLES10. The servers are mostly blades, accessed via remote console. There is a real console in the server room, but switched off.
I would like to disable the screen blanking as it serves no purpose and is a
nuisance. You have to press key to see if you are connected which is a pain. We are running in runlevel 3, so the console is in text mode, no X11 involved.
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
You can verify what timeout the kernel uses for virtual console blanking via:
$ cat /sys/module/kernel/parameters/consoleblank 600
This file is read-only and the timeout is specified in seconds. The current default seems to be 10 minutes.
You can change that value with entering the following command on a virtual console (if you are inside an xterm you have to change to a virtual console via hitting e.g. Ctrl+Alt+F1).
$ setterm -blank VALUE
Where the new VALUE is specified in minutes. A value of 0 disables blanking:
$ cat /sys/module/kernel/parameters/consoleblank 600 $ setterm -blank 0 $ cat /sys/module/kernel/parameters/consoleblank 0
setterm has other powersaving related options, the most useful combination seems to be:
$ setterm -blank 0 -powersave off
Thus to permanently/automatically disable virtual console blanking on startup you can either:
- add
consoleblank=0to the kernel parameters (edit grub configuration) - add the
setterm -blank 0command to anrc-localor equivalent startup script -
add the
settermoutput to/etc/issuesince/etc/issueis output on every virtual console:# setterm -blank 0 >> /etc/issue
Choose one alternative from the above.
Method 2
Try using this:
setterm -blank
Method 3
According to : https://wiki.archlinux.org/index.php/Display_Power_Management_Signaling#DPMS_Interaction_in_a_console_with_setterm
Prevent screen from turning off (in console)
$ setterm -blank 0 -powerdown 0Alternatively you can disable console blanking permanently using the following command:
# echo -ne "33[9;0]" >> /etc/issue
Method 4
The only permanent solution is to add consoleblank=0 to the kernel command-line. You can view the value (which defaults to 600 seconds) in:
/sys/module/kernel/parameters/consoleblank
(note that the file is read-only). The only way to change the value of consoleblank is to reboot with the new kernel command-line option.
Method 5
I’ve implemented and tested the following configuration, which works fine on sles10, my workhorse at the moment.
In
/etc/init.d/boot.local
add
setterm -blank
it looks like that is all it takes. Thanks for Uku Loskit and Gilles for the push in the right direction.
Method 6
I was really buffled by this problem. All tricks above with using setterm and redirect from/to /dev/tty0 didn’t worked from my ssh.
Then I realized a way to disable it:
TERM=linux setterm -blank 0 -powerdown 0 -powersave off >/dev/tty0 </dev/tty0
TERM=linux replaces default TERM (which is xterm-256color on my machine), and helps setterm to query proper parameters from tty0.
You can check result by
cat /sys/module/kernel/parameters/consoleblank
It should be 0. If it is 600, trick hasn’t worked out.
Method 7
If you only want to prevent screen blank out after user login, then just need to append setterm -powersave off -blank 0 to $HOME/.bash_profile of respective users.
Method 8
/usr/bin/setterm -powerdown 0 might help also
Method 9
For those of us running Ubuntu 20.04, simply append the following code to /etc/init.d/console-setup.sh
# Set screen blank time to 5 minutes (5) log_action_begin_msg "Setting screen blank interval to 5 minutes" /usr/bin/setterm -blank 5 log_action_end_msg $?
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0