Linux kernel consoleblank argument ignored

The consoleblank kernel parameter

I currently work on an embedded system using Qt 5.6 for the application running on Linux 4.4. and faced the problem, that after the end of the main application the console blanks after 15 minutes. In general, you can set this behavior via the kernel consoleblank argument. So, my first step was to check the corresponding kernel  parameter and found it set to 900 seconds:

Because of this, my first idea was to correct the value during boot of the system and saw it already set to zero.

Set kernel parameters during boot

For grub open /etc/default/grub in your favorite editor using sudo.  Then check if  consoleblank=0 is added to the GRUB_CMDLINE_LINUX_DEFAULT setting.

E.g., yours may say:

GRUB_CMDLINE_LINUX_DEFAULT=”quiet splash consoleblank=0″

For uboot, you have to use the bootargs environment variable. The bootloader passes the contents of this variable automatically to the Linux kernel as boot arguments. You can set the bootargs using the setenv command.

If you make changes to the bootargs environment variable, please keep in mind, that these are in RAM only and you will lose them on a reboot of the system. If you want to make this changes permanent, you have to use the saveenv command to store the settings and can be reloaded during startup. These commands are documented here: UBootCmdGroupEnvironment

You can find the Documentation for the kernel parameters here: kernel.org – kernel-parameters

Consoleblank within Qt

To narrow down the search, I tried a different value. This showed that during the run of the Qt app the consoleblank parameter was zero and afterward I found it to be 900. Very strange. Therefore, I checked the Qt framebuffer source and found the following function within the Qt framebuffer functionality:

You will find this function within  ./qt/5.6.0/src/qtbase/src/platformsupport/fbconvenience/qfbvthandler.cpp .

The above function with the name setTTYCursor is setting the consoleblank parameter as well as the parameter for cursor blink via escape sequence to fixed values (either zero or to 15 Minutes in case of the consoleblank), regardless what was set before.

For more info how to use the above escape sequence check this reference: linuxgazette – Cursor Appearance in the Linux Console

If you want to disable console blank after the end of the Qt application you can use the following command within your terminal:

Searching the Internet showed that this behavior is still existent in Qt for Version 5.9.1……

https://bugreports.qt.io/browse/QTBUG-61916

In conclusion, if you are using Qt via framebuffer and your consoleblank boot parameter seems to be ignored you are probably facing a problem with this Qt framebuffer implementation.

Share Button
The following two tabs change content below.

Mike Bergmann

Technical software developer loving low level, bit peeking, embedded development as well as GUI, OO, and X-platform development.