A framebuffer is a device file which allows for a simplified interface to the screen. For example running the below code on a RaspberryPi with a HDMI display connected:

cat /dev/urandom > /dev/fb1

There are commands (fbi, fim) which allow for injecting full images into the framebuffer.

There are multiple resources on the internet (ref1, ref2, ref3) trying to more or less succesfully explain how to add make a systemd service which will result in an image on the screen.

A common thread in those resources is the mentioning tty together with the framebuffer. (i.e. both fbi and fim have options to pass them a tty).

My assumption was that a tty is a separated concept from a framebuffer. The tty uses the framebuffer to output content to a user, but the framebuffer isn't in any way tied to a tty.

Is there a hidden relationship behind a tty and a framebuffer which could explain why commands to print images to a framebuffer seem to depend on a tty?

1 Answer 1


The “hidden relationship” is related to the fact that Linux supports multiple virtual terminals, which means that the framebuffer can be used by a number of different terminals. Programs which manipulate the framebuffer directly need to be aware of which terminal currently owns the framebuffer:

  • When such a program starts, it needs to store the current terminal configuration, then tell the kernel that it wants to control the display directly (it switches to “graphics mode” using the KDSETMODE ioctl) and set the framebuffer up as necessary (e.g. in fbi, configure panning). It also needs to tell the kernel that it wants to be told about virtual terminal switches (when the user presses CtrlAltFn).

  • If the user switches terminals, the kernel will then tell the running program about it; the program needs to restore the terminal settings and relinquish control over the terminal (VT_RELDISP) before the switch can actually proceed.

  • If the user switches back to the terminal running the framebuffer-based program, the kernel again tells the program about it, and the program sets up the terminal and framebuffer as necessary and restores its display.

This is described in detail in How VT switching works.

  • Thanks, does the tty write to the framebufer from userspace or their communication happens within the kernel? Jun 2 at 8:22
  • That’s all in-kernel. Jun 2 at 12:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.