Console Displays in VGA, Mounting Filesystems

Absolutely! Many people wonder if it's possible to change the video mode that console-level text is normally displayed in. The answer is, "Yes."

Is It Possible to Have a Console Display that Runs in VGA Mode?

Absolutely! Many people wonder if it’s possible to change the video mode that console-level text is normally displayed in. The answer is, “Yes.”

First of all, you need to make sure that you have VGA support built into the kernel; after that, it’s simply a matter of ensuring that lilo, or whatever boot manager you have, is aware of the VGA settings you wish to use at boot time.

One of the easiest ways to do this is to use the built-in features of your Video Electronics Standards Association (VESA) Framebuffer (vesafb), which is common to most video cards. If you’re scratching your head and saying, “Huh? What’s a framebuffer?”, we advise you to check out the Framebuffer HowTo located at http://www.linuxdoc.org/HOWTO/Framebuffer-HOWTO.html. Meanwhile, a framebuffer is basically an abstraction of the graphics hardware; it provides a well-defined interface that allows all of your software applications to gain access to the hardware.

In particular, the VESA framebuffer works with VESA 2.0-compliant graphics cards. Today, many, if not most, video cards are VESA 2.0-compliant.

If you need to recompile your kernel, the appropriate options to use in make xconfig (or make config) are under “Console Drivers,” and include:

  • VGA text console

  • Video mode selection support

  • Support for frame buffer devices

  • VESA VGA graphics console

  • Advanced low level driver options

Also select {2, 4, 8, 16, 24, 32} bpp packed pixel drivers while you’re at it.

Make sure a framebuffer device exists as /dev/fb0. If not, run the command shown below to create the required framebuffer device:

# mknod /dev/fb0 c 29 0

Once you’ve done that, recompile the kernel and get ready for reboot.

From this point, it’s simply a matter of adding a single line to your lilo configuration. For example, to use normal VGA mode, you just need to edit the /etc/lilo.conf file and add the option vga=normal on a line by itself. Your /etc/lilo.conf might then look something like:

vga = normal
image = /boot/linux-2.4.17
root = /dev/sda3
label = linux

This will use the standard 80×25 console, but it will be in VGA mode. Alternatively, you might want to set vga=extended, which will use a higher resolution. Another common mode is vga=791, which sets the mode to 1024×768 at 16-bit color. If you’d like to play around with various VGA modes, you can set vga=ask to have lilo ask you what video mode you’d like to have the display in.

Once you’ve chosen your mode, save /etc/lilo.conf and rerun /sbin/lilo. If there are problems, make sure the syntax is correct. If all has gone well, you should see your console in VGA mode!

How Can I Make a Filesystem Available Whenever I Boot Up?

There are a number of GUI tools for doing this, but we’re going to look under the hood and edit the file that tells the system what partitions to mount and how to mount them.

The file we’re talking about is /etc/ fstab. The contents of this file will look a little different for everybody, but the principles are the same. Be very careful when editing this file. If you make a mistake, it’s very possible your system will become unbootable. Before working on this file, you should always make a backup of it (by running cp /etc/fstab /etc/fstab.backup as root).

A typical /etc/fstab might look like the sample that is shown in Figure One. Let’s examine the information this file contains. The third line in the file looks like this:

Figure One: A Sample /etc/fstab File


/dev/sda2 /boot ext2
defaults 1 2

This line says the filesystem on the device /dev/sda2 needs to be connected to the mount point /boot and that it’s a filesystem of type ext2. The defaults means there’s nothing special about this filesystem. The “1″ tells the dump program this filesystem needs to be backed up. The final “2″ indicates the order in which the filesystem checker program fsck should check at boot time, should it be necessary. In this case, it would be the second drive to be checked. A value of “0″ indicates that the drive doesn’t need to be checked during the system’s boot sequence.

It may also be useful to add the noauto option so that the partition must be explicitly mounted at the command prompt, rather than being automatically mounted during system boot. This would look like:

/dev/sda2 /boot ext2 defaults,
noauto 1 2

Let’s now add a Microsoft Windows partition to our list of filesystems and have it automatically mounted when the system boots. Let’s say the Windows partition is a VFAT (also known as Win95 FAT32) located on /dev/ hda1. From there, all we have to do is create a mount point:

# mkdir /windows

and then append a reference to the /etc/fstab file:

/dev/hda1 /windows vfat
defaults 0 0

The next time you reboot, your system will automatically mount the partition at /windows. Even without rebooting, you can manually mount the partition right away by running:

# mount /windows

Editing /etc/fstab is a useful way to jump directly into filesystem management; however, GUI tools do have a slight edge. Even if they can be slightly more cumbersome to use, they at least ensure that the machine’s /etc/ fstab file is syntactically correct.

Quentin Cregan is a tech and security consultant hailing from Australia. He can be reached at qc@sensed.com.

Comments are closed.