Installing Guest Additions in VirtualBox for an Ubuntu Server Guest

Installing VirtualBox’s “Guest Additions” is not as straight forward as I’d like it to be for an Ubuntu Server Guest but I figured out the solution.

In this tutorial I am using:

  • Host: Windows XP Professional
  • VirtualBox: 3.1.6
  • Guest: Ubuntu Server 10.04 (Lucid Lynx)

So say you have a host with VirtualBox installed (I have Windows XP, you have any version of Windows, Mac, Solaris, Linux, etc.) and have an Ubuntu Server installed as a guest. If you want to install “Guest Additions” for added features (such as seemless mode, copy and paste support, or shared folders in my case), you’re supposed to click Devices > Install Guest Additions... but when I clicked the button, nothing popped up. Why doesn’t anything pop-up? Did it download? Was there an error?

Unbeknown to me, VirtualBox actually downloaded an image called VBoxGuestAdditions.iso, all without telling me. Great,  it’s downloaded, but how do I mount and install it?

First off, let’s grab some libraries we need for Guest Additions to install
sudo apt-get install build-essential linux-headers-`uname -r`
Then mount it
sudo mount /dev/cdrom1 /mnt

Then run the proper executable (make sure you look for the correct one for your machine)
sudo bash /mnt/VBoxLinuxAdditions-x86.run

There will be an error that states the not all features could be installed

Installing the Window System drivers …fail!
(Could not find the X.org or XFree86 Window System.)

But this is okay. VirtualBox’s Guest Additions installs some features that we don’t need on a server (seemless mode, copy and paste, etc.) If you want these features, you’ll have to install 67MB+ of X.Org libraries
sudo apt-get install xserver-xorg xserver-xorg-core

So it’s up to you: GuestAdditions with 67MB+ of X.Org libraries or let these drivers fail and enjoy shared folders.

  • http://nnutter.com Nathan Nutter

    Hi Brett, just read your post. I don’t have access to my Ubuntu box at the moment but I believe the VirtualBox guest additions (OSE) are available through apt-get. I do recall though being confused by the number of choices.

    aptitude search virtualbox-ose

    • http://brettalton.com brett

      That’s true, there is a package for guest additions, but you have to be running virtualbox-ose (which I’m not because Windows is my host) and all the package is, is the ISO file which I downloaded anyway. You still have to mount and install it.

      The code you’re looking for is:
      sudo aptitude install virtualbox-guest-additions

  • http://nnutter.com Nathan Nutter

    Hi Brett, just read your post. I don’t have access to my Ubuntu box at the moment but I believe the VirtualBox guest additions (OSE) are available through apt-get. I do recall though being confused by the number of choices.

    aptitude search virtualbox-ose

    • http://brettalton.com brett

      That’s true, there is a package for guest additions, but you have to be running virtualbox-ose (which I’m not because Windows is my host) and all the package is, is the ISO file which I downloaded anyway. You still have to mount and install it.

      The code you’re looking for is:
      sudo aptitude install virtualbox-guest-additions

  • http://www.getdeb.net João Pinto

    Brett,
    are you sure the OSE guest additions are not compatible with the regular VBOX ?

    The debian package is not just as simple as the iso, The package provides the contents of the iso and automatically does the installation.

    • http://brettalton.com brett

      Hi Joao,

      No, I’m not 100% but I saw in the description of the file that it was simply an ISO file. I will test it out to confirm.

  • http://www.getdeb.net João Pinto

    Brett,
    are you sure the OSE guest additions are not compatible with the regular VBOX ?

    The debian package is not just as simple as the iso, The package provides the contents of the iso and automatically does the installation.

    • http://brettalton.com brett

      Hi Joao,

      No, I’m not 100% but I saw in the description of the file that it was simply an ISO file. I will test it out to confirm.

  • http://nnutter.com Nathan Nutter

    I just finished installing 10.04 and it appears the package that works is virtualbox-ose-guest-x11. I also installed virtualbox-ose-guest-dkms first and while this built the kernel modules from source it did not set them to auto load (checked after a restart). The x11 package did though. After restart I could resize window and move mouse without capturing!

    • http://brettalton.com brett

      What about guest additions for the server?? (No x11)

  • http://nnutter.com Nathan Nutter

    I just finished installing 10.04 and it appears the package that works is virtualbox-ose-guest-x11. I also installed virtualbox-ose-guest-dkms first and while this built the kernel modules from source it did not set them to auto load (checked after a restart). The x11 package did though. After restart I could resize window and move mouse without capturing!

    • http://brettalton.com brett

      What about guest additions for the server?? (No x11)

  • http://nnutter.com Nathan Nutter

    Just installed Kubuntu. virtualbox-ose-guest-x11 will install the DKMS module as a prerequisite so that answers that.

  • http://nnutter.com Nathan Nutter

    Just installed Kubuntu. virtualbox-ose-guest-x11 will install the DKMS module as a prerequisite so that answers that.

  • http://nnutter.com Nathan Nutter

    Not near my Ubuntu box so can’t check but there are several virtualbox-ose-guest-* packages.

    However, I thought the only point of the guest additions was to improve X.org, e.g. mouse integration and better graphics? Is there more to the guest additions?

    • http://brettalton.com brett

      You can only mount folders with guest additions I believe. That’s the feature I needed on Windows with an Ubuntu virtual server. Luckily I was able to find an IAX-compatible VoIP client so I can use Ubuntu for development this summer.

  • http://nnutter.com Nathan Nutter

    Not near my Ubuntu box so can’t check but there are several virtualbox-ose-guest-* packages.

    However, I thought the only point of the guest additions was to improve X.org, e.g. mouse integration and better graphics? Is there more to the guest additions?

    • http://brettalton.com brett

      You can only mount folders with guest additions I believe. That’s the feature I needed on Windows with an Ubuntu virtual server. Luckily I was able to find an IAX-compatible VoIP client so I can use Ubuntu for development this summer.

  • X-BASS

    Works great on Ubuntu Server 10.04 with VirtualBox 3.2.4 r62467 on a XP32sp3 host and using Guesta Additions 3.2.4

    Thanks for the tutorial, very helpfull.

    X-BASS

  • http://carnevaledesign.com Paul

    Thanks for the post. Just what I was looking for.

  • http://twitter.com/Whatdoesitwant Willem

    The copy paste option is nice on a Windows host because you may not have set up putty or cygwin at this point for ssh access. So for 64bit Lucid:
    sudo -s
    aptitude install -y dkms build-essential linux-headers-$(uname -r) xserver-xorg-core
    mount /dev/cdrom /mnt
    bash /mnt/VBoxLinuxAdditions-amd64.run

  • kevin

    installing the headers before running the vbox additions script solved my window resizing and shared clipboard problems. thank you!

  • http://www.eighthourlunch.com Eight Hour Lunch

    Thank you. Wish I had seen this first. I’d been bashing my head against a wall for — well, too long. The X.org error was the last question on my list.

  • Pingback: Ubuntu 10.04 Server on VirtualBox Step-by-Step | Jake Levirne's Blog

  • http://profiles.google.com/gizzar Ken Chau

    sudo bash VBoxLinuxAdditions.run –nox11

    Add that flag and it won’t fail.

  • Maibam Sharat

    amazing solution!!

  • http://typrase.myopenid.com/ Jesse Glick

    In 12.04 server I tried to just install virtualbox-guest-dkms, hoping that this would save me the trouble of mounting and running the ISO, but this did not work – it was trying to install X11-related packages as well.

  • http://twitter.com/aendrew Ændrew Rininsland

    THANK YOU SO MUCH. I’ve been bashing my head against a wall for AT LEAST the last hour trying to get even the most minimal display working with Virtualbox 4.2.12 and Ubuntu 12.04.2.

    You have earned a thousand Internets, good sir!

  • Chris P

    I’d recommend installing samba for file sharing and a resizable terminal window, and using putty to connect via ssh for copy and paste. You can then run your virtualbox headlessly (“Program FilesOracleVirtualBoxvboxmanage” startvm MACHINENAME –type headless).

  • Steve Metzler

    Couldn’t use the -r option for the linux headers and cdrom1 was cdrom.

  • Pingback: Virtualbox shared folders – executable flag and automount | fileas.code

  • http://www.carnivorosanonimos.org/ Carnivoros Anonimos

    Worked perfectly on Ubuntu Server 12.04 thanks!

    • brettalton

      Great, glad to help! And happy it still helps in later versions of Ubuntu.