Control VESA Screen Blanking Safely with setvesablank

Your Linux console keeps blanking mid-task, and setvesablank is the tool that controls it directly. It changes the VESA blanking state of a Linux virtual console, checks whether the command can talk to the active console, and restores the previous practical setting if needed. Allow about ten minutes. The examples use the kbd package version 2.6.4-2ubuntu2 installed on this machine.

This is a narrow console tool. It is not a general display-power manager, a screen-locker or a desktop setting: it only changes the VESA screen blanking state exposed by the console it runs on. Test it on a spare virtual console before using it on a machine where losing the display would interrupt work.

1. Check the installed command

Confirm the executable and its manual page belong to the expected package. These checks are ordinary and do not change display state:

$ command -v setvesablank
/usr/sbin/setvesablank
$ dpkg-query -W -f='${Package} ${Version}\n' kbd
kbd 2.6.4-2ubuntu2
$ man 8 setvesablank

The installed manual describes on and off as the state arguments. It also documents the optional -b/--blanking, -h/--help and -v/--verbose options. Keep the state argument explicit in scripts rather than relying on an abbreviated or undocumented form.

Checkpoint: you should be working on a real Linux virtual console, with the terminal visible, and should know which state you want to apply. A terminal emulator inside a graphical session may not provide the console device this program needs.

2. Turn VESA blanking on

Use the following command when the console should be allowed to blank:

$ setvesablank on
$ status=$?
$ printf 'setvesablank exit status: %s\n' "$status"
setvesablank exit status: 0

Status 0 is the useful verification from the command line: the program completed without reporting an error. The manual does not specify a normal human-readable success message, so scripts should check the exit status rather than parse output. The exact visual delay before blanking is controlled by the console and kernel configuration, not by an interval argument to this command.

Do not use sudo automatically. Start as the account that owns the console session. If the command reports a permission failure, review the console device permissions and your local privilege policy, then rerun only with the elevation your system requires. Elevated privileges do not make a graphical terminal into a VESA console.

3. Turn VESA blanking off

To keep the console visible instead, run:

$ setvesablank off
$ status=$?
$ printf 'setvesablank exit status: %s\n' "$status"
setvesablank exit status: 0

This is the recovery command when blanking is stopping you seeing the console. It is also the safer first test if you are unsure whether the current display hardware supports the requested operation, since it makes the intended state explicit without touching a timer or a desktop power policy.

Recovery: if you changed the state by accident, run the opposite command. There is no separate undo file or persistent configuration to edit here. Keep the original state in your change record if this is being used during maintenance.

4. Handle an unsupported terminal

setvesablank needs access to a console device and VESA support. Running it from a container, an SSH session or a terminal emulator can fail before the state argument is even relevant. For example, this environment does not expose a usable console file descriptor, so both state changes fail with an error rather than changing a display:

$ setvesablank off
Couldn't get a file descriptor referring to the console.
$ printf 'exit status: %s\n' "$?"
exit status: 1

The wording and status can vary with the kernel, device permissions and package build. The important boundary is that a non-zero status is not proof that blanking is now off: treat it as a failed operation, then check where the command is running:

$ tty
$ test -t 1 && echo 'standard output is a terminal'
$ ls -l /dev/console /dev/tty 2>/dev/null

These commands only inspect the session. If you are connected remotely, log in on the physical or virtual console that owns the display and repeat the state change there. Do not create device nodes or change permissions as a quick fix without understanding the host's console and security configuration.

5. Use diagnostic options carefully

The manual documents -h/--help and -v/--verbose. They confirm the installed interface, but even help or verbose mode may need to open the console before it can respond. Run them on the target console:

$ setvesablank --help
$ setvesablank --verbose off

Do not treat a help screen as proof that the setting changed. Use an explicit on or off invocation and check its status. The optional --blanking form is documented by the installed manpage, but the plain state commands are easier to read in an operational runbook.

6. Keep the change within its real boundary

This command is about VESA console blanking only. It does not configure X11, Wayland, a desktop environment, a laptop's display power policy or a monitor's standby timer. If the screen still blanks after a successful command, work out which layer is doing it before changing unrelated settings.

The command also has no durable system-wide configuration file in the documented interface. If you need the state to survive a reboot, record it in the console-management mechanism your distribution uses and test the boot path separately. Do not add it blindly to a service or startup script: running it without a usable console turns a display preference into a recurring error.

Done means