FbTerm: Better terminal windows when you don’t have X


Author: Ben Martin

FbTerm provides you with a fast terminal emulator that runs directly on your system’s framebuffer. Using the framebuffer brings improved performance while allowing you to render UTF-8 text in the terminal. FbTerm aims to be at least as fast as the normal Linux kernel terminal while providing internationalization support and modern font handling with fontconfig. It allows you to create as many as 10 different terminal windows on the same framebuffer, each window having scrollback history.

FbTerm can make life at a terminal easier when you do not or cannot have X Windows installed on the system and must use its terminal. While most of the time you can do system administration of such systems by logging in over SSH, sometimes you want an extended session on the system itself.

FbTerm version 1.0 was just released last month. Because FbTerm has not been around long it is understandable that it has not made it into some of the mainstream Linux distribution package repositories. FbTerm is not packaged for Ubuntu or Fedora but is available as a 1-Click install for openSUSE 11. For this article I built FbTerm 1.0, which was released just last month, from source on a 64-bit Fedora 9 machine using the normal ./configure; make; sudo make install process.

The first snag you are likely to run into with FbTerm is that the /dev/fb files might not exist. I found that on two machines using Nvidia and ATI graphics cards, framebuffer devices were not created on Fedora 9 installations. Surprisingly, a Fedora 9 installation that uses an ancient S3 PCI graphics card did have the /dev/fb0 framebuffer. A simple way create these device files is to insert the kernel module appropriate for your card. For example, on a laptop using an ATI X300, issuing modprobe radeonfb should create the framebuffer devices for you. You can probably locate the framebuffer modules for your system’s kernel at:

/lib/modules/`uname -r`/kernel/drivers/video

Once you have a /dev/fb (which is probably a symbolic link to /dev/fb0) you are almost ready to run FbTerm. At this stage, FbTerm should run as root, but you might like to run it as a normal user. The only thing stopping you from running FbTerm as a regular user is that the /dev/fb0 device has permissions that only allow root to use it. There are many ways to resolve this; for example, you can run a command like chmod username /dev/fb0 or create a framebuffer group and add users to that group.

The fb symlink is created by udev as specified in the 50-udev-default.rules file located in the /etc/udev/rules.d directory. So a more system-friendly solution to the permission issue is to create a custom udev rule that sets the group or permissions for the fb device when it is created. Creating the framebuffer.rules file in a my-rules.d directory as shown below should make the fb0 device owned by the user you nominate.

# mkdir -p /etc/udev/my-rules.d # cd /etc/udev/my-rules.d # cat framebuffer.rules KERNEL=="fb0", OWNER="username", MODE="0640"

Now you should have a framebuffer device that a nominated user can access, and you can start a terminal using the fbterm command. The first time you run FbTerm it creates a configuration file at ~/.fbtermrc with some default settings for your font and color selection. The default configuration file created on a Fedora 9 laptop with an ATI graphics chip is shown below:

# Configuration for fbterm # font family/pixelsize used by fbterm, mulitple font families must be separated by ',' font_family=mono font_size=12 # default color of foreground/background text # available colors: 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white color_foreground=7 color_background=0

FbTerm provides keyboard bindings that you would expect, such as Shift-Pageup to move the terminal up a page to see older output. You can also use multiple framebuffer “windows,” creating new ones with Ctrl-Alt-c and moving between windows with Shift-Left and Shift-Right. You can also jump directly to a specific window with Ctrl-Alt-number. The FbTerm windows are independent of the multiple getty sessions that are available with Alt-function keys.

Shown in the screenshot is part of a terminal generated using FbTerm with the Sazanami Gothic font at size 16. Notice that the Japanese Hiragana and kanji characters are handled correctly.

To test the performance of FbTerm I displayed Dead Souls, a novel from Project Gutenberg, on my screen. This is a 15,000-line file which, using the Sazanami Gothic font, took 1.2 seconds to cat to the terminal using FbTerm and 14.8 seconds using the default Linux kernel terminal.

As one of those, “what happens if I misuse this thing?” moments, I decided to execute fbterm from an SSH session. Of course you are not likely to do this, but if you try, it will inform you that stdin isn’t a interactive tty and exit.

If you are in need of a terminal emulator that runs on the framebuffer, for either server maintenance or embedded use, give FbTerm a try.


  • Desktop Software