vbetool Command in Linux



In Linux, vbetool is a specialized utility designed to interface with the video BIOS (Basic Input / Output System) in order to alter and control video hardware state. Its primary function is to execute real-mode BIOS code, code that was originally run at system boot, to control aspects of the video hardware that modern operating systems rarely invoke directly.

Table of Contents

Here is a comprehensive guide to the options available with the vbetool command −

How to Use vbetool Command in Linux?

vbetool operates by making use of the LRMI (Linux Real-Mode Interface) layer to run BIOS routines while you are in a "protected mode" operating system. Through vbetool, you can change the display power states, get or set video modes, and even call specific functions on your graphics adapter.

vbetool is built on top of the LRMI library, which provides Linux with the ability to switch briefly into real mode. By leveraging LRMI, vbetool can call BIOS routines that are usually not available after the boot process has completed. It allows you to, for instance, use the VESA 0x4f0f extensions for video state (vbestate) operations and the 0x4f10 extensions for DPMS (Display Power Management Signaling).

Explanation of Available Options and Subcommands

vbetool does not follow the "flag-argument" model that many GNU utilities use.

vbestate: Saving and Restoring Video State

The vbestate subcommand uses the VESA 0x4f0f extensions to either save or restore the hardware state of the video card.

vbetool vbestate save
vbetool vbestate restore
vbetool Command in Linux1

How It Works

  • Saving − When you run vbetool vbestate save, the current state of the video adapter is read and output to standard output. It is common to redirect this output to a file for later use.
  • Restoring − Conversely, vbetool vbestate restore reads data from standard input and attempts to restore the hardware state previously saved.

Example − Save the current video state into a file and later restore it

vbetool vbestate save > state.bin
vbetool Command in Linux2

Note − Restoring state saved on a different machine or after significant system changes can lead to unpredictable results. This command is not recommended when running X, as it may interfere with the graphical session - Linux man page](https://linux.die.net/man/1/vbetool).

dpms: Display Power Management

The dpms subcommand employs the VESA 0x4f10 extensions to modify the power management state of your display.

vbetool dpms on
vbetool dpms off
vbetool dpms standby
vbetool dpms suspend
vbetool dpms reduced

Example − To turn off the monitor

sudo vbetool dpms off
vbetool Command in Linux3

And to bring it back on −

sudo vbetool dpms on
vbetool Command in Linux4

Caution − Using these commands can interfere with running graphical sessions (X), so be sure you are on a text console when applying them.

vbemode: Getting and Setting the VESA Mode

The vbemode command is used to query or change the current VESA video mode.

vbetool vbemode get
vbetool vbemode set <mode_number>

Example − To read the current mode −

vbetool vbemode get
vbetool Command in Linux5

To change to mode 0x03 (typically the standard VGA text mode) −

vbetool vbemode set 0x03
vbetool Command in Linux6

vgamode: Setting Legacy VGA Mode

The vgamode subcommand sets the legacy VGA mode to a specific numeric value.

vbetool vgamode <mode_number>

Example − To set the VGA mode to a particular mode, you can run −

vbetool vgamode 3
vbetool Command in Linux7

This might set the system to a common VGA mode, although the exact behavior can vary depending on the hardware,

post: Running BIOS POST Code

The post command instructs vbetool to run the BIOS code typically used during system boot to initialize the video card.

sudo vbetool post
vbetool Command in Linux8

Example − Simply invoke −

sudo vbetool post
vbetool Command in Linux9

Warning − Use this command only if you understand that it may execute arbitrary code and possibly leave your video hardware in an inconsistent state - Linux man page](https://linux.die.net/man/1/vbetool).

vgastate: Enabling or Disabling the Video Card

The vgastate command enables or disables the current video card.

vbetool vgastate on
vbetool vgastate off

Use Cases − Disabling the video card might be used in low-power scenarios or in configurations where you want to ensure that the display hardware is completely shut down. However, this command is rarely used in modern configurations and carries risk when executed on systems relying on a framebuffer.

Example − To disable, run the following command −

sudo vbetool vgastate off
vbetool Command in Linux10

And to re-enable −

sudo vbetool vgastate on
vbetool Command in Linux11

vbefp: Interfacing with the VESA Flat Panel

The vbefp subcommand allows you to interact with the VESA flat panel interface a standard proposed for controlling integrated flat panel displays.

vbetool vbefp panelid
vbetool vbefp panelsize
vbetool vbefp getbrightness
vbetool vbefp setbrightness <value>
vbetool vbefp invert

Examples of vbetool Command in Linux

To illustrate how vbetool might be used in real-world scenarios, consider the following examples −

Saving and Restoring Video State

Imagine you need to perform an operation that might disturb the current video mode. In such cases, you can first save the current state, perform the operation, and then restore the state −

Save the current video state to a file −

vbetool vbestate save > /tmp/vbestate.bin

Perform some diagnostic or hardware reinitialization here

sudo vbetool post
vbetool Command in Linux12

Later, reapply the saved video state

vbetool vbestate restore < /tmp/vbestate.bin

This workflow minimizes disruption by ensuring you can return the video adapter to its prior state.

Altering the Power Management State

For power management, you may want to control screen power directly from the console −

Put the display into standby mode

vbetool dpms standby

This example is useful in scenarios where you need to conserve power temporarily or test DPMS functionality.

Querying and Setting Video Modes

Suppose you are troubleshooting display issues on a text console. You can check the current VESA mode and change it if necessary −

Get the current VESA mode

sudo vbetool vbemode get
vbetool Command in Linux13

Change the mode to a common text mode (e.g., mode 0x03)

sudo vbetool vbemode set 0x03
vbetool Command in Linux14

Such commands can help in recovery scenarios or when attempting to reinitialize hardware manually.

Running a Full POST Reinitialization

On rare occasions, you may wish to reinitialize your video card as though the system is booting up −

sudo vbetool post
vbetool Command in Linux15

Conclusion

In conclusion, vbetool remains one of the few tools that let you interact directly with a computer's video BIOS. Though its use is largely confined to specific scenarios such as legacy hardware troubleshooting, low-level maintenance, or embedded systems control, its precise control and direct access make it indispensable in the right context.

Advertisements