Switch off screen on minimal install + power saving at idle

I’m using a Surface Pro 3 with a minimal install. The idea is to provide all my network services such as vaultwarden, pi-hole / adguard, tailscale or simlar, etc.

This is my first proper nixos install. I’ve installed it in a VM and played around a bit. If I can help it I’d like to avoid flakes for now. One problem at a time.

I’ve installed 23.05. I’ve tried 23.11 it hangs on blank screen with a cursor, it also crashes on Hyper-V for what that’s worth.

So far what I’ve found is that I can’t switch my screen off without having X or Wayland installed, I’ve looked at the arch wiki but can’t find anything there that helps in this situation.

I’d really prefer the minimalist solution to get the screen to switch off and optimise power consumtion at idle. Since it’ll be providing network services I can’t have it go to sleep, it’s not sleeping now, but want to make that clear.

2 Likes

I love what you are trying to do! Yay for minimalism.

Do setterm commands work for you, such as

setterm --powersave off --blank 0

I suggest experimenting to see what you like.

This ArchWiki page might be helpful.

Also, an interesting discussion on StackExchange about creating a systemd service to do something similar to what you are attempting.

An addendum, as I continue to think about this…

Shouldn’t logind be enough?

services.logind.extraConfig could be your friend, and set IdleAction and its siblings. See logind.conf.

Edit: Meh. After looking into it further, I don’t think that merely turning off the monitor is in logind’s purview. I’ll still leave my less-than-helpful comment here just in case I am wrong.

Thanks, yes I do have a preference with keeping things light.

I’ve done some testing and with the --powersave flag I get an error.

setterm: cannot (un)set powersave mode: Inappropriate ioctl for device

If I remove that flag and simply use setterm --blank 0 it doesn’t seem to do anything.

echo -e "\033[9;1]" > /dev/tty1 works, although I’ll need to keep an eye on it as I found a post on the Ubuntu forums where someone said the screen turned on after a while.