My Brain on Code

X Server on Gentoo Virtual Box Guest

Well, after a very long time of playing around with my Gentoo Virtual Box Guest, I finally got X Server working!

I first needed to make sure hal was installed:

1
# emerge hal

Then I started it up:

1
# /etc/init.d/hald start

Then I made sure it started at boot:

1
# rc-update add hald default

Next, I installed the Virtual Box Guest Additions by Going to Devices –> Install Guest Additions on the Virtual Box Window. This puts a “CD” in the guests CD drive so we need to mount it:

# mount /mnt/cdrom

Now we need to run the install script that’s on the “CD”

# bash /mnt/cdrom/VBoxAdditionsLinux-x86.run

It took a bit for it to install, and then the system needs a reboot once the vbox additions are installed.

# reboot

Once the system is back up I needed to make sure my xorg.conf was correct. I ended up using:

# Xorg -configure

After the file is generated (should be /root/xorg.conf.new) open it up with your favorite text editor:

# vim /root/xorg.conf.new

Go down to the mouse section and make sure it looks like this:

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "vboxmouse"
    Option      "Protocol" "auto"
    Option      "Device" "/dev/input/mice"
    Option      "ZAxisMapping" "4 5 6 7"
EndSection

Then go down to the video device section and make sure it looks like this:

Section "Device"
    Identifier  "Card0"
    Driver      "vboxvideo"
        # Add the rest of yours here if its present. 
        # The main thing is to make sure the above line shows "vboxvideo"
EndSection

Then the screen section should look like this:

Section "Screen"
    Identifier "Screen0"
    Device     "Card0"
    Monitor    "Monitor0"
    DefaultDepth 16
    SubSection "Display"
        Depth     16
    EndSubSection
EndSection

Finally add this to the end of the file:

Section "Serverflags"
        Option "AIGLX" "off"
EndSection

Save the file and copy it over to the default location of the xorg.conf:

# cp /root/xorg.conf.new /etc/X11/xorg.conf

Now you can run startx to start your X server! If all went well you should be presented with a nasty looking window manager (twm). To finish the twm session, type in exit or Ctrl-D in the upcoming xterms. That’s it! You are now free to install your own window managers.