Screen Power Saving in the Linux Console
-
Screen Power Saving in the Linux Console
I just made up a Debian trixie setup that has no need for a GUI. In fact, I rarely use the text console either. However, because the machine is dual boot and also serves another purpose, it’s connected to my main monitor and KVM switch.
The monitor has three inputs, and when whatever display it’s set to goes into powersave mode, it will seek out another one that’s active and automatically switch to it.
You can probably see where this is heading: it’s really inconvenient if one of the inputs never goes into powersave mode. And, of course, it wastes energy.
I have concluded that the Linux text console has lost the ability to enter powersave mode after an inactivity timeout. It can still do screen blanking — setting every pixel to black — but that is a distinct and much less useful thing.
You can do a lot of searching online that will tell you what to do. Almost all of it is wrong these days. For instance, none of these work:
- Anything involving vbetool. This is really, really old advice.
- Anything involving xset, unless you’re actually running a GUI, which is not the point of this post.
- Anything involving setterm or the kernel parameters video=DPMS or consoleblank.
- Anything involving writing to paths under /sys, such as ones ending in dpms.
Why is this?
Well, we are on at least the third generation of Linux text console display subsystems. (Maybe more than 3, depending on how you count.) The three major ones were:
- The VGA text console
- fbdev
- DRI/KMS
As I mentioned recently in my post about running an accurate 80×25 DOS-style console on modern Linux, the VGA text console mode is pretty much gone these days. It relied on hardware rendering of the text fonts, and that capability simply isn’t present on systems that aren’t PCs — or even on PCs that are UEFI, which is most of them now.
fbdev, or a framebuffer console under earlier names, has been in Linux since the late 1990s. It was the default for most distros until more recently. It supported DPMS powersave modes, and most of the instructions you will find online reference it.
Nowadays, the DRI/KMS system is used for graphics. Unfortunately, it is targeted mainly at X11 and Wayland. It is also used for the text console, but things like DPMS-enabled timeouts were never implemented there.
You can find some manual workarounds — for instance, using ddcutil or similar for an external monitor, or adjusting the backlight files under /sys on a laptop. But these have a number of flaws — making unwanted brightness adjustments, and not automatically waking up on keypress among them.
My workaround
I finally gave up and ran apt-get install xdm. Then in /etc/X11/xdm/Xsetup, I added one line:
xset dpms 0 0 120Now the system boots into an xdm login screen, and shuts down the screen after 2 minutes of inactivity. On the rare occasion where I want a text console from it, I can switch to it and it won’t have a timeout, but I can live with that.
Thus, quite hopefully, concludes my series of way too much information about the Linux text console!
#linux -
Screen Power Saving in the Linux Console
I just made up a Debian trixie setup that has no need for a GUI. In fact, I rarely use the text console either. However, because the machine is dual boot and also serves another purpose, it’s connected to my main monitor and KVM switch.
The monitor has three inputs, and when whatever display it’s set to goes into powersave mode, it will seek out another one that’s active and automatically switch to it.
You can probably see where this is heading: it’s really inconvenient if one of the inputs never goes into powersave mode. And, of course, it wastes energy.
I have concluded that the Linux text console has lost the ability to enter powersave mode after an inactivity timeout. It can still do screen blanking — setting every pixel to black — but that is a distinct and much less useful thing.
You can do a lot of searching online that will tell you what to do. Almost all of it is wrong these days. For instance, none of these work:
- Anything involving vbetool. This is really, really old advice.
- Anything involving xset, unless you’re actually running a GUI, which is not the point of this post.
- Anything involving setterm or the kernel parameters video=DPMS or consoleblank.
- Anything involving writing to paths under /sys, such as ones ending in dpms.
Why is this?
Well, we are on at least the third generation of Linux text console display subsystems. (Maybe more than 3, depending on how you count.) The three major ones were:
- The VGA text console
- fbdev
- DRI/KMS
As I mentioned recently in my post about running an accurate 80×25 DOS-style console on modern Linux, the VGA text console mode is pretty much gone these days. It relied on hardware rendering of the text fonts, and that capability simply isn’t present on systems that aren’t PCs — or even on PCs that are UEFI, which is most of them now.
fbdev, or a framebuffer console under earlier names, has been in Linux since the late 1990s. It was the default for most distros until more recently. It supported DPMS powersave modes, and most of the instructions you will find online reference it.
Nowadays, the DRI/KMS system is used for graphics. Unfortunately, it is targeted mainly at X11 and Wayland. It is also used for the text console, but things like DPMS-enabled timeouts were never implemented there.
You can find some manual workarounds — for instance, using ddcutil or similar for an external monitor, or adjusting the backlight files under /sys on a laptop. But these have a number of flaws — making unwanted brightness adjustments, and not automatically waking up on keypress among them.
My workaround
I finally gave up and ran apt-get install xdm. Then in /etc/X11/xdm/Xsetup, I added one line:
xset dpms 0 0 120Now the system boots into an xdm login screen, and shuts down the screen after 2 minutes of inactivity. On the rare occasion where I want a text console from it, I can switch to it and it won’t have a timeout, but I can live with that.
Thus, quite hopefully, concludes my series of way too much information about the Linux text console!
#linux@jgoerzen You mean now e.g. setting consoleblank=X will really just produce a black screen after X seconds?
(I don't think this is related to dri and kms, at least not only that. I'd have to check but I think some of the setups of mine where the linux virtual console could trigger screen sleep with older versions were using dri and kms?
I had to do a hardware change and getting this set up was one of the things I've been postponing. Maybe I should look into this soon...)
-
R ActivityRelay shared this topic