This is a read-only archive. Find the latest Linux articles, documentation, and answers at the new Linux.com!

Linux.com

Feature: Desktop Software

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

By Ben Martin on August 05, 2008 (9:00:00 AM)

Share    Print    Comments   

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.

Ben Martin has been working on filesystems for more than 10 years. He completed his Ph.D. and now offers consulting services focused on libferris, filesystems, and search solutions.

Share    Print    Comments   

Comments

on FbTerm: Better terminal windows when you don't have X

Note: Comments are owned by the poster. We are not responsible for their content.

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

Posted by: Anonymous [ip: 70.130.189.143] on August 05, 2008 11:46 AM
Two typos:
1) "chmod username /dev/fb0" should be "chown username /dev/fb0"
2) "# cat framebuffer.rules" should be "# cat >framebuffer.rules"

#

Re: FbTerm: Better terminal windows when you don't have X

Posted by: Anonymous [ip: 83.241.11.135] on August 05, 2008 04:29 PM
2nd) is OK, what you suggest won't work, because cat won't have input file

#

Re(1): FbTerm: Better terminal windows when you don't have X

Posted by: Anonymous [ip: 82.192.250.149] on August 05, 2008 05:42 PM
The original post is correct, your correction to the correction is wrong. If cat has no file arguments it takes input from STDIN.

#

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

Posted by: Anonymous [ip: 209.82.26.132] on August 05, 2008 09:13 PM
The correction is correct if you want to use cat to paste data into a file. If you just want to use it to display the contents, then the original article is correct.

Please check your facts before saying someone is wrong.

#

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

Posted by: Anonymous [ip: 70.190.41.15] on August 05, 2008 09:39 PM
When I attempt to compile FbTerm on OpenSuse-10.2 I get the following:

make[3]: Entering directory `/usr/local/src/fbterm-1.0/src'
g++ -DHAVE_CONFIG_H -I. -I.. -g -O2 -fno-exceptions -Ilib -I/usr/include/freetype2 -MT fbterm.o -MD -MP -MF .deps/fbterm.Tpo -c -o fbterm.o fbterm.cpp
fbterm.cpp: In function ‘void pollSignal()’:
fbterm.cpp:73: error: ‘pendsig’ was not declared in this scope
make[3]: *** [fbterm.o] Error 1
make[3]: Leaving directory `/usr/local/src/fbterm-1.0/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/usr/local/src/fbterm-1.0/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/usr/local/src/fbterm-1.0'
make: *** [all] Error 2

I have done my usual grepping around in various include files on my system but so far I have not been able to locate a declaration for pendsig()
Any ideas or suggestions?

#

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

Posted by: Anonymous [ip: 123.204.26.92] on August 06, 2008 02:27 PM

Do Binary blobs not enable fb by default?

Posted by: Anonymous [ip: 12.153.51.253] on August 06, 2008 04:44 PM
"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."

Were you using the binary blob drivers? That might be why those machines didn't have a framebuffer enabled by default. FWIW Ubuntu asks you if you want to enable/use the kernel's framebuffer device. I believe it's on by default but you can turn it on/off if you run "sudo dpkg-reconfigure xserver-xorg" from a command prompt.

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya