VirtualBox Install Linux Guest Additions

My actuall job has a lot of good things like:

  • been able to travel,
  • go to vacation travel without even stop working (oh yes working from home)
  • the posibility to arrive to the office in the afternoon

… but there is just one thing i really don’t feel very confortable with, and this is that I can not use linux as a desktop machine, so we have a problem there…

But beyond to start complaining about my company maybe i can do something about it using a VirtualMachine and install what ever OS I prefer. So I began thinking about which GNU/Linux distribution to install, and since I want to get the LPI certification well I decided to install Fedora 13 using VirtualBox.

Actually it worked pretty well but if you have installed it you may realized the screen resolution is only 800×600… bad stuff, but we can solve it very quickly… I found some manuals about how to install guest additions and I put all together and posted it here.

All the commands here are run with root privileges. When you use a GUI, like Gnome, a terminal should be used (but you can also drop to a virtual terminal, or TTY, by using the Host key and F2).

System preparations
Tthere are a few additional packages needed for the Guest Additions. These packages enables you to create kernel modules. For Debian and Debian based distro’s like Ubuntu, you need the following packages:

  • build-essential
  • linux-headers-generic

apt-get install build-essential linux-headers-generic

Note: If you run server, or a different kernel flavour, you need to change generic to that flavour.

Fedora users need the following packages(like me):

  • binutils
  • gcc
  • make
  • patch
  • libgomp
  • glibc-headers
  • glibc-devel
  • kernel-headers
  • kernel-devel

yum -y install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel

Mount the Guest Additions
Now that we have what is needed for the Guest Additions, it’s time to actually start installing what we want. If you haven’t done so already, mount the GA ISO to the VM. This is done using the Device Menu, then click on Install Guest Additions.

Select “Install Guest Additions…” from the menu

Make sure that no other CD is already loaded for the VM, like the install disk. Unmount that one first. The CD doesn’t always get mounted automatically, so you have to do that manually. Usually an icon appears on the Desktop with the name of the inserted CD.

You can mount the disc from there, but if you don’t have a GUI, you have to mount it using the command line. The CLI can also be used if you have a GUI. Use a terminal emulator for that.

In the CLI, check if there is a valid mount point for the CD. This is usually /media/cdrom, but any empty folder can be used as mount point. Now to mount the CD, issue the following command:

mount /dev/scd0 /media/cdrom

It’s now mounted on /media/cdrom.

Install the GA
So, the CD is mounted. It should come up with a message about content that can be run from the CD on newer releases of the distro you use. This is usually a Desktop Manger or file manager setting, so not all Desktop Managers have this. Gnome, KDE and Xfce should have it, but I’m not sure if it’s enabled by default. Accepting the autorun should install the GA now.

If there is no autorun message, or you don’t trust it or want to do it manually, follow the steps below.
Go to the folder with a terminal (this can be easily done from a graphical file browser (like Nautilus (Gnome), Thunar (Xfce) or Dolphin (KDE)) by right-clicking on the folder and select “Open Terminal here”, or use cd /path/to/cdrom). In that folder, check it’s contents with the ls command, so you are certain you are at the right place and you know the file names. Depending on the architecture you run for the Guest (32 bit or 64 bit), you run one of the two commands:

sh ./

sh ./

The Additions should install without issues. If there is an error, it usually states what’s wrong. Check /var/log/vbox-install.log for more information. It’s usually a version mismatch of the kernel headers or source. If you don’t run Xserver, you will get a message about it that looks like this:

No Xserver found, skipping

This means that because you don’t have X installed, the mouse and video modules won’t be created and shared clipboard will not be available. If you install X later, you have to run the GA installer again.
There are some parameter options available for the GA installer. Run the installer with the parameter –help for a list of available parameters. See the manual too for some information about that.

Configuring your Xorg/Xserver

If you have the system-config-display package installed, you can use the system-config-display command to create a configuration file. You can run it interactively simply by runningsystem-config-display as root (or find it in the system menus under System > Administration > Display). This may not work if you cannot run X at all. In this case, you can run it non-interactively by using the –noui parameter, so:

system-config-display –oui

Ok now ewe have /etc/X11/xorg.conf created now:
The GA are installed and you are asked to reboot the Guest. Do that, but don’t be alarmed if your GUI doesn’t start. It means that there is some misconfiguration in your xorg.conf file (/etc/X11/xorg.conf). Log in on the CLI (Command Line Interface) by hitting the Host Key + F2 (Host key is the key used to release the keyboard and used for shortcuts) and open xorg.conf with an editor as root. Nano is easier to use, but some prefer Vi or Vim. Check the file with this example configuration.

The syntax might be different for other distro’s.

vim /etc/X11/xorg.conf

#Example xorg.conf from my Fedora 13
Section “InputDevice”
Identifier   “Keyboard[0]“
Driver       “kbd”
Option “XkbModel” “pc105+inet”
Option “XkbLayout” “la”
Option       “Protocol” “Standard”
Option       “CoreKeyboard”
Section “Monitor”
Identifier   “Monitor[0]“
ModelName    ”VirtualBox Virtual Output”
VendorName   “Sun Microsystems Inc”
Section “Device”
BoardName    ”VirtualBox Graphics”
Driver       “vboxvideo”
Identifier   “Device[0]“
VendorName   “Sun Microsystems Inc”
Section “Screen”
SubSection “Display”
Depth      24 Modes    ”800×600″ “1024×600″ “1280×600″ “1366×768″
Device       “Device[0]“
Identifier   “Screen[0]“
Monitor      ”Monitor[0]“

Note, more recent versions of Xserver might not need this kind of configuration and everything is done automatically.

The developers (from Xserver-Xorg) are planning to stop using xorg.conf for configuration and let HAL take over.

A part of that is already working, but only with the open source drivers shipped with your xserver-xorg version.

The VB video driver is not a default driver, just like the fglrx for ATi cards and nVidia-glx for nVidia cards.

An explicit configuration to use the non-standard driver is needed for these kinds of drivers.

Note 2: The Guest Additions no longer need the xorg.conf configuration with recent VB versions and distributions.

Leave a Reply

Your email address will not be published. Required fields are marked *