'linux kernel consoleblank argument ignored

I'm running an embedded Linux board with a console only (no graphical environment) based on the i.MX6 and a custom Yocto build.

I'm trying to stop the screen from shutting off after 15 minutes of inactivity. I think the correct way to do this is to pass consoleblank=0 to the boot arguments, which I have done. The problem is that when I do

cat /sys/module/kernel/parameters/consoleblank

I get 900. The results of cat /proc/cmdline are:

console=ttymxc0,115200 root=/dev/mmcblk0p2 rootwait rw consoleblank=0

Does anyone know where else that parameter could be set?

Thanks

Marlon



Solution 1:[1]

To avoid a console blank after a period of time, there's two things to change:

  • consoleblank=0 as kernel parameter as you mentioned
  • disable terminal blanking with: setterm -blank 0 -powerdown 0

The value that you see in proc, I suspect that in the boot process the setterm parameters are set, that will change consoleblank parameter, to be sure about this, you can make a simple test:

setterm -blank 600
cat /sys/module/kernel/parameters/consoleblank
# This must be 600

setterm -blank 0
cat /sys/module/kernel/parameters/consoleblank
# This must be 0

You can see additional info in this question: https://unix.stackexchange.com/questions/8056/disable-screen-blanking-on-text-console

Solution 2:[2]

I know this is a super old question, but I recently ran into a very similar problem and discovered that the 15 minute blanking timeout was being caused by Qt. If you're running any Qt programs, that's likely the source of the problem.

There is a function in Qt's source called setTTYCursor. If you look at the code in the linked file, it disables the blanking by setting the timeout to 0 when the Qt app loads, and then when it exits, it changes the blanking to a 15 minute timeout. After it does this, /sys/module/kernel/parameters/consoleblank reports a value of 900, regardless of what you initially supplied with the kernel command line. I spent a lot of time questioning my sanity before figuring out that Qt was changing this behind my back.

You can bypass this bizarre behavior by setting an environment variable prior to launching the Qt application:

export QT_QPA_PRESERVE_CONSOLE_STATE=1

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Securez
Solution 2 dougg3