Home > virtualization > Installing Guest Additions For Ubuntu Guests in VirtualBox

Installing Guest Additions For Ubuntu Guests in VirtualBox

UPDATE: This post has been updated for more current releases. Please see the new Install VirtualBox Guest Additions article.

As promised in my previous post on installing VirtualBox Open Source Edititon today I’ll be going over installing the Guest Addition tools for better integration between host and guest. These steps have not been tested on other Linux distributions but I’m sure they’ll work about the same way. I tested these on Kubuntu 7.04 running atop Kubuntu 7.10 beta as the host.

Installing Linux Guest Additions in VirtualBox

VirtualBox has made it pretty easy to install the Guest Additions for improved integration between guest and host. Some of these benefits are mouse-capture improvements and improved video resolution. The mouse capture improvements now allow you to control your virtual machine when the mouse is over the window, and seamlessly return to your host when it is not. Improved video resolution should allow you to customize a better resolution for your guests.

What we need to do to install the Guest Additions is select the option from the VirtualBox menu. You’ll want to do this after your guest is running (the guest-additions are installed to the guest, not the host). Select:

Devices > Install Guest Additions...

This sometimes takes a minute so don’t worry if you don’t see anything right away. This should then prompt you and say something along the lines of:

The Guest Additions image is not found on your host. Would you like to download this image now?

We’ll select YES and let it download the image. The image is downloaded to the host machine and then mounted within the guest. This way it can be shared with future guests without needing to download multiple times. It should also prompt you whether or not you’d like to mount the image. Again, select YES.

At this point you should see a disk image mounted on your desktop. What we’ll do here is run a script that will generate the proper modules to allow for guest additions. In my preferred method we’ll do this:

  1. Open a terminal by pressing ALT-F2 and enter “gnome-terminal” on gnome or “konsole” on KDE.
  2. cd /media/cdrom
  3. sudo bash ./VBoxLinux*

This will grind away at generating the proper modules and then prompt you to restart your guest machine. Once this has finished and you’ve rebooted your guest operating system you should have the guest improvements ready to go. No additional configuration for the mouse integration should be needed, but you may have to manually update to a better resolution as wanted.

Hopefully I’ll have the tutorial for building proper network bridging soon as well. Until then, enjoy your virtualization with VirtualBox!

If this article has been helpful, please consider linking to it.

Categories: virtualization Tags: ,

Related Posts

  1. gbo
    January 17th, 2009 at 16:42 | #1

    I feel stupid even asking this but having trouble and looking for someone to point out the obvious. Okay, so i’ve got:
    VirtualBox 2.x (just downloaded 1/09)
    Host: WinXP SP3 – 32bit
    Guest: gOS 3 (Ubuntu 8.04/Hardy)

    I have an AMD 5000+ X2 and (nForce4/Gforce6100) and am unsure whether to use the “x86.run” or “amd64.run”? and what happens if i run both for good measure? does that screw things up?

  2. Rishi
    January 20th, 2009 at 07:36 | #2

    I too searched on many of the forums about how to get the problem resolved.

    Finally I came across the fact that the latest version of Virtual Box (2.1) has good support for UBuntu.I Downloaded and configured my Ubuntu 8.10 image (Guest) on Windows XP SP2 (Host).

    Now I’m able to run VBoxLinuxAdditions-x86.run with out any problem and am able to install GuestAdditions also.

    And the best thing is Virtual Box 2.1 does a lot of things for you automatically.

    So enjoy your time with Virtual Box 2.1

  3. Jitendra Rana
    January 21st, 2009 at 16:05 | #3

    Thanks… it worked great!!!

  4. GBO
    January 27th, 2009 at 08:10 | #4

    Questions:

    I have Virtual Box 2.1 installed on a Host that consists of: WinXP sp3 32bit on Athlon 5000X2. The guests are (32bit) Ubuntu 8.04 and OpenSolaris. Do I execute the x86 or amd64 string in the “sudo bash ./VBoxLinux*” command?

    Also, if I already did one of them, and then typed in the other, does it screw everything up? If so, how should I fix it?

  5. Jarno
    January 28th, 2009 at 03:29 | #5

    I tried this on my Ubuntu 8.10 guest, but after it installed the kernel modules it crashes saying ‘unknown version of X window system’. Anyone know how to fix this?

  6. Belindo Filobeo
    January 28th, 2009 at 14:25 | #6

    For Jarno and Ubunto 8.10 users.
    Mount the VBoxGuestAdditions.iso then you have to install DKMS in Linux guests.
    If it is not installed open terminal and use this command:

    sudo apt-get install dkms

    and answer “yes” to the question.
    Then change to the directory where your iso CD-ROM drive is mounted, you have to type such a command like this

    cd /media/cdrom0

    finally type this:

    sudo sh ./VBoxLinuxAdditions-x86.run

    input your password if necessary.

    I hope it’s useful.

  7. Odomera
    January 29th, 2009 at 05:15 | #7

    I tried this:

    “sudo ./VBoxLinuxAdditions-x86.run”

    and works perfect…

    Host: Windows 7
    Guest: Ubuntu 8.10

  8. January 30th, 2009 at 12:07 | #8

    This worked great even with Crunchbang Linux 8.10!

  9. January 30th, 2009 at 17:40 | #9

    I get as far as inputting my password, which it won’t allow me to do.

  10. rado
    February 6th, 2009 at 13:19 | #10

    Thanks for this. I was having problems understanding why my virtualbox wouldn’t load the additions (they were already mounted)

  11. Person
    February 9th, 2009 at 21:58 | #11

    I had a problem getting it to work on my 64 bit Ubuntu, ended up I had to specify the file and use the All command. I input:
    sudo bash ./VBoxLinuxAdditions-amd64 all
    Worked fine! And newish versions of VBox all have the correct Additions btw

  12. Jorge
    February 15th, 2009 at 13:14 | #12

    Belindo Filobeo,

    Installing the dkms in ubuntu 8.10 guest i continue having the problem

  13. will
    February 16th, 2009 at 16:42 | #13

    hi i’m using Ubuntu 8.10 and whenever i try to install guest additions it starts to install but then it says

    Unknown version of the X Window System installed.

    don’t know if this has anything to do with it but i installed it on an external hard drive. any thoughts???

  14. anonymous
    February 25th, 2009 at 07:43 | #14

    After step 2 i.e. “cd /media/cdrom” do :
    3. Type “sudo bash ./VBoxLinuxAdditions-x86.run” if you have an intel CPU
    OR
    Type “”sudo bash ./VBoxLinuxAdditions-amd64.run” if you have an AMD CPU.

  15. jc
    February 25th, 2009 at 15:44 | #15

    Done…worked like a charm…have a question now on “shared folder”….I’m a noob so bare with me…how would I mount this inside the Ubuntu guest….I created a folder on my Host XP desktop and want to see it in guest ubuntu.

    thx…jc

  16. yay
    March 12th, 2009 at 15:12 | #16

    Yes awesome now the mouse isnt stuck in the window and i dont need to press the host key to free it

  17. Allen Meyers
    March 16th, 2009 at 06:51 | #17

    My question is does this work in 8.10 as the article is based in an earlier edition
    Thanks

    • March 16th, 2009 at 07:45 | #18

      Installing Guest Additions should be roughly the same for any Ubuntu release. Give it a try. If it does not, leave a comment here and I’ll try to update the post.

  18. Laurence Buchanan
    April 9th, 2009 at 06:54 | #19

    Nothing worked as advertised, I finally got going as follows:

    VirtualBox 2.2 on Vista host, running ubuntu 8.10 as guest.

    Selecting “devices – Install Guest Additions” did not do anything, /media/cdrom was empty, so I downloaded the iso from virtualbox and saved it in a folder on the vista host.

    Goto http://download.virtualbox.org/virtualbox/ and look for the folder for your version (x.x.x) of virtualbox. From in there download VBoxGuestAdditions x.x.x.iso

    Start your ubuntu guest and login. Install dkms

    sudo apt-get install dkms
    reboot the ubuntu box.
    There is a bug with ubuntu 8.10, dkms points to wrong kernel header version, so the VBoxLinuxAdditions.run script will fail.

    Check which kernel you have.
    uname -r
    Outputs something like: 2.6.27-11-generic (note this last bit)

    Now, fix the incorrect headers problem. (replace generic with your uname output).

    sudo apt-get install linux-headers-generic

    Almost done, the VBoxGuestAdditions.iso must be mounted.
    From the menu in your ubuntu guest window, select
    “devices – mount CD/DVD Rom”
    Now select option “CD/DVD Rom image” and choose the VBoxGuestAdditions iso file you saved in the vista host earlier.

    Now ensure the iso is properly mounted as a cdrom in the guest.
    sudo mkdir -p /mnt/cdrom
    sudo mount -t iso9660 /dev/scd0 /mnt/cdrom

    the cdrom device may differ on your guest, check the output of: ls -l /dev/cdrom

    Finally, run the additions script in thu ubuntu guest::
    cd /mnt/cdrom
    sudo sh ./VBoxLinuxAdditions-x86.run

    Worked for me, YMMV.

  19. Bryan
    April 23rd, 2009 at 15:35 | #20

    Works on 9.04 with 2.2.0, but it comes with 64 bit drivers, so run the command without the wild card.

  20. Bogdy Cornel
    April 25th, 2009 at 08:02 | #21

    It was really great , thank you verry much but now a little update, the command in the terminal is for Ubuntu 9.04:

    " sudo bash VBoxLinuxAddition-x86.run"

    Good luck!

  21. June 18th, 2009 at 18:21 | #22

    There is a very nicely done guide on explaining the entire process of installing the Guest Additions for a Linux Guest. The article also gives an insight to all the problems that you may encounter: http://digitizor.com/2009/05/26/how-to-install-vi...

  22. vcvcvc
    August 3rd, 2009 at 21:54 | #23

    THANK YOU WES !!!

  23. Jason Watson
    August 15th, 2009 at 00:14 | #24

    I found this useful – thank you for your effortss

  24. Jorge
    August 22nd, 2009 at 00:43 | #25

    Hi, I get the following error when I execute the command "sudo bash ./VBoxLinux*" : Detected unsupported x86 environment, what can I do? thanks in advance

  25. Shangaur Salakh
    September 11th, 2009 at 18:12 | #26

    Thanks to Wes and Timbo. I entered full filename in step 3 and managed to install guest additions in Ubuntu 9.04 guest on Windows XP SP3 host. But as someone who has been programming for 30 plus years, I can understand why non-techies are slow to move to Linux. I was searching for two days and trying different suggestions, none of which worked mainly because they dealt with older releases, before I found this forum.

  26. Einar
    October 21st, 2009 at 16:47 | #27

    I'm running Ubuntu 9.0.4 and trying to install Guest Additions from Vbox 3.0.8.
    I got this error " Detected unsupported x86 environment.

    To fix this write:
    sudo bash ./VBoxLinuxAdditions-86.run

    Hope that helps

  27. alex
    October 26th, 2009 at 22:58 | #28

    great!
    but the correct command is:

    sudo bash ./VBoxLinuxAdditions-x86.run

    thanks anyway

  28. alex
    October 27th, 2009 at 00:26 | #29

    Great, it works!

    but the correct command is this:

    sudo bash ./VBoxLinuxAdditions-x86.run

  29. Arun
    November 4th, 2009 at 13:18 | #30

    when i m trying to install guest addition for ubuntu on my window7 host…the terminal window comes but its saying , " u need administrator privilege " ….and i don't know how to give a program administrator privilege in ubuntu…plz any body help me out..

    Thanks

  30. Paul
    November 12th, 2009 at 21:36 | #31

    Running WIndows 7 64 bit Host with VirtualBox 3.0.10 and Ubuntu 9.1 Needed the VBoxLinuxAdditions-x86.run command (not the amd64 version) and now works fine. needed to reinstall aftre the 9.04 to 9.1 upgrade

  31. james
    November 17th, 2009 at 00:20 | #32

    thank you this really helped me out.

  32. Jeff
    December 2nd, 2009 at 06:43 | #33

    Thanks for the tutorial. Up and working with
    Win7 64-bit host, VirtualBox running Ubuntu 9.1 and XP-Pro

  33. Sameera
    December 28th, 2009 at 01:18 | #34

    Most useful! Thanks very much :)

  34. maffiakillen
    January 10th, 2010 at 00:29 | #35

    Thanks dude

  35. bibliac
    January 25th, 2010 at 12:55 | #36

    Thank you! :)

  36. gnidde
    February 9th, 2010 at 23:27 | #37

    Works just fine! I do however need to re-install it from time to time since the mouse integration and the full screen does not work. Any ideas why?

  37. ideans
    February 22nd, 2010 at 22:16 | #38

    Alright, I myself had a HUGE amount of issues trying to get Guest Additions installed on my ubuntu guest os with windows 7 host. After tons of searching I found that I needed several other packages.

    sudo apt-get install dkms build-essential linux-headers-server

    I myself am running the server version, I guess you just replace server with whatever you are running. After installing these packages and manually mounting the guest additions cd I was able to install them from the terminal. The mouse integration and full screen both work great perfectly now.

    Hope this helps anyone who is still having trouble.

  38. ichzazen
    March 16th, 2010 at 05:16 | #39

    @gbo
    It will not harm if you install x86

  39. Ed
    April 9th, 2010 at 17:50 | #40

    Just a tip for anyone who’s been searching for ‘Guest Additions’ help — Sun (now Oracle) has always included a very thorough, detailed ‘User Manual’ that’s a part of each install. Also on virtualbox.org. The ‘VBoxGuestAdditions.iso’ is put on your hard drive with each install as well. Both are updated with each new version release and Sun (err, Oracle) has done an especially nice job updating the User Manual in accordance with each release.

    Online help like the above is often helpful but there’s a lot of pertinent info already included in each VB install. (Also, the User Manual comes as a pdf with a clearly labeled Index.)

  40. Sinc
    April 17th, 2010 at 08:23 | #41

    @Aaron Your password should work. If it’s running like it is on mine, it won’t show any symbols when you type, but it will accept it once you’ve typed it and press enter.

  41. fringe
    May 20th, 2010 at 14:50 | #42

    this method did not work for me – osx snow leopard host, linux mint guest. I got an unsupported x86 error — read somewhere else to go into the guest additions folder and run the autorun.sh file. Did that and it worked

  42. May 21st, 2010 at 05:29 | #43

    All: this post has been a great resource over the time it’s been running; thanks to all the commenter for the updates over time, it got me out of a hole and a couple of readers of my blog also. RC

  43. Jason
    May 27th, 2010 at 19:54 | #44

    ok .. this is all driving me a little silly … not sure if I’m just doin something wrong or what … Host is Windows 7 Guest is Ubuntu 10.04

    I have the Guest Additions mounted, but every time I pull up a terminal window and try to run the scrips in this thread, all I get is “file or directory not found” and nothing

    All I want to do is Not have to keep hitting Right-Ctrl to get my mouse out of the window, and be able to make the window larger .. right now when I make the window larger, Ubuntu stays same size as it did when it boots (I hope that makes since) .. book marking page for help

  44. June 1st, 2010 at 14:55 | #45

    Jason, check this page, I just installed ubuntu 10.04 on win7 in virtual box too. worked very good :) http://helpdeskgeek.com/linux-tips/install-virtualbox-guest-additions-in-ubuntu/

  45. Jason
    June 3rd, 2010 at 18:20 | #46

    That looks AWSOME .. but I still cant get it to work :( when I mount the guest additions and get the CD on the desktop I’m good. Then when I open a terminal and type in “cd /media/cdrom” all I keep getting is “file or directory not found” and then nothing .. when the treminal opens it shows being in “jason@jason ~ desktop” did I do something wrong or am I just totally missing something?

  46. August 2nd, 2010 at 09:31 | #47

    I’m running Windows 7 64bit and have Ubuntu 10.04 32bit guest with x86 guest additions installed. Mouse/Keyboard integration works great and I can resize VM window and the Ubuntu desktop resizes fine, but the full screen and seemless modes are not working. Both appear to have the same problem. When I go to full screen mode the display updates and I can see Ubuntu in full screen but the graphics are non-responsive except for the mouse cursor. If I move the mouse cursor over a menu item then click it nothing happens. If I exit full screen I can see that the menu did indeed open sine the screen has now refreshed.

    Thanks in advance for any help anyone can offer,

    Jacob

Comment pages
1 2 475
  1. February 15th, 2008 at 17:08 | #1
  2. November 22nd, 2009 at 16:44 | #2