Running VirtualBox on Ubuntu 11.04 Natty alpha

I’m using the current Ubuntu alpha – 11.04 as my desktop OS on my laptop, and on the same laptop I sometimes need to run VirtualBox to access an MS-Windows environment.

In the current Natty alpha this doesn’t work well. I have VirtualBox 4.0 installed from Oracle’s repository, but it doesn’t manage to compile the kernel module it needs – probably because of the “RC” nature of the current Natty’s kernel (2.6.38-rc4) as of this writing.

I’ve seen many posts on the internet about running Ubuntu 11.04 as a guest in VirtualBox, but couldn’t find anyone talking about my problem, which is the opposite – running VirtualBox on Ubuntu 11.04. So here’s how to get this thing working:

  1. Install VirtualBox 4.0 (from Oracle’s repository)
  2. Install the kernel headers package for Ubuntu: sudo apt-get install linux-headers
  3. Edit the headers’ Makefile to declare the same version as the uname command: run uname -r and note the suffix after the version number, for example mine says “2.6.38-3-generic“, so I am interested in “-3-generic“. Edit the Makefile using sudo gedit /usr/src/linux-headers-<version>-3-generic/Makefile , and the fourth line should say something like “EXTRAVERSION = -rc4“. Change the value (in this case “-rc4“) to what you found out from uname.
  4. add autoconf.h to the linux include directory, because it is missing for some reason:
    cd /usr/src/linux-headers-<version>-3-generic/include/linux
    sudo ln -s ../generated/autoconf.h

Now you can run sudo /etc/init.d/vboxdrv setup and it should complete successfuly and allow you to start VirtualBox.

Enhanced by Zemanta

33 Responses to “Running VirtualBox on Ubuntu 11.04 Natty alpha”

  1. Shezif:

    That’s my first time here :P such a nice blog.
    Is 11.04 working well on your computer? I’d workig with 10.10 then I upgrade to the new one and I’ve got a lot of ubuntu’s bugs…
    since the last month I’m working with debian testing :D she’s amazing!
    you should try it!

    • Oded:

      I’m usually running the Ubuntus pre-releases a few months before they are released and normally my experience is very good – especially a by D – 2 months.

      That being said 11.04′s stability is not impressive. I recommend not upgrading to it until the release.

  2. C.K.:

    Thanks a lot worked for me (kernel -7-generaic)

  3. marrusl:

    Thanks. This was handy.

  4. clemens:

    Thanks! It worked very well with the current 11.04 beta (-7-generic)!

  5. Virtualbox 4.0 in Ubuntu Natty 11.04 « riccardogasparotto:

    [...] gli headers per la versione 2.6.38-8-generic-pae che non si avviava, come spiegato qui http://geek.co.il/wp/2011/02/16/running-virtualbox-on-ubuntu-11-04-natty-alpha Questo post è stato scritto da riccardogasparotto e pubblicato il aprile 10, 2011 alle 10:37 am [...]

  6. fooues:

    Thanks man .. it worked without problems.

  7. Miguel:

    I’m experiencing problems with it. Everytime I try to run the Windows XP on the VirtualBox, the VM just stops responding after it loads the Windows, and everytime it happens I have to kill the application and start over. Do you have any idea of what is happening?

    • Oded:

      Nope, sorry – this seems out of scope from this article which is about getting the thing off the ground. Once VirtualBox can start a VM, then my work here is done.

      One thing that I can guess is that there may be some weird interaction between the older guest tools installed in the Windows XP VM and the newer VirtualBox – not that I’ve seen anything like this before. You can try loading the Windows VM in “safe mode” and if you can load it like this then its probably a good idea to back up all the VM data and reinstall.

  8. Pompi:

    I have just upgraded to Ubuntu 11.04 and it works great. The only problem i have is that i cant access my MS-Windows environment. I am running my virtual box in Ubuntu 11.04. Is there a way to rectify this problem without having to re-install the virtual box coz by this i will loose my docs in the MS windows environment?
    When i run the virtual box the following error appears:

    RTR3Init failed with rc=-1912 (rc=-1912)

    The VirtualBox kernel modules do not match this version of VirtualBox. The installation of VirtualBox was apparently not successful. Executing

    ‘/etc/init.d/vboxdrv setup’

    may correct this. Make sure that you do not mix the OSE version and the PUEL version of VirtualBox.

    Thanks.

  9. Ludovic Bertin:

    Thanks a lot, you saved my day

  10. Codrin:

    this is what i get >
    Error! Your kernel headers for kernel 2.6.38-9-generic-pae cannot be found at
    /lib/modules/2.6.38-9-generic-pae/build or /lib/modules/2.6.38-9-generic-pae/source.

    What’s happening, please? I have ubuntu 11

    • Oded:

      You need to have the “kernel-headers” package installed – this is covered in step 2 of the instructions above.

      But please note, that as Miguel reported above, the PAE kernel does not work well with VirtualBox and you should use a generic kernel instead. There’s really no reason to use the PAE kernel unless you are running a machine that is not capable of using 64 bit mode (AMD64 or EM64T) and has more then 4GB or memory – this case should be very rare.

  11. Joseph Dantes:

    I had to pick which header to install with this command: sudo apt-get install linux-headers

    When you attempt to run VirtualBox from the command line, the error message will tell you which kernel version you have. Use that info to pick the appropriate header.

  12. Joseph Dantes:

    After the latest upgrade, virtualbox is broken again and this doesn’t work.

    uname = 2.6.38-10-generic-pae

  13. Joseph Dantes:

    subscibed

  14. Joseph Dantes:

    Got it working with the new version from the repositories, after a restart. Not sure exactly what I did.

  15. Oded:

    Ok, thanks for reporting on that :-)

  16. Per Liedman:

    Thanks, helped me a lot.

  17. Petro Semeniuk:

    Worked like a magic. Thanks a lot!

  18. Ingolf:

    Thanks a lot. Although I did not follow exactly your workflow your hints helped me getting back virtualbox up and running.

  19. Marto:

    Hi pals, thanks for the posts. Am running windows 7 as a guest in the current 11.04 using virtual box. The problem is that i can’t access usb devices in the windows environment. How can i solve this problem? pls help. previously i was running in Ubuntu 10.10 and everything was OK but upon upgrading to natty this problem occurred.

  20. Oded:

    Hi Marto.

    The problem is that the USB support is a proprietary module that is not distributed with VirtualBox – as that is open source under the GPL.

    To get USB support, you need to go to Oracle’s VirtualBox web site and download the “Extension Pack”: http://www.virtualbox.org/wiki/Downloads . Then start the VirtualBox manager and under File->Preferences->Extension add the extension pack you downloaded.

  21. כך חולפת תהילת עולם :: Things n' Stuff:

    [...] היה נראה שלי שהבלוג שלי אינו זוטה MySQL 5.5 on Ubuntu 10.10 [↩]VirtualBox on Ubuntu 11.04 [...]

  22. Ben:

    Thanks for the great instructions. However, whenever I try to start my VM, I’m still getting a “Failed to load VMMR0.r0 (VERR_NO_EXEC_MEMORY)” error. In the past, rebuilding the VirtualBox kernel modules fixed this issue but didn’t this time.

    Any ideas?

  23. Ubu11.4:

    Hi all ! I do not know what to do o_O
    —————————–
    VirtualBox-Critical Error

    NS_ERROR_FAILURE (0×80004005)

    Failed to create the VirtualBox COM object

    Location’/home/mycomput/.VirtualBox/VirtualBox.xml’,line 46 (8),column 26.

    /home/vbox/vbox-4.1.8/src/VBox/Main/src-server/VirtualBoxlmpl.cpp[485](nsresult VirtualBox::init()).
    ——————————

    Am using my main host system Ubuntu 11.4 , were just some time ago I did run
    VirtualBox 4.1.8
    In that (among other’s) I was working today on my “XP pro SP2 ,32bit”
    Did dedicate 8Gb fixed size vdi for my xp , did run
    some driver download for my logitech and ,this whole thing got frozen ,with this error message .I forced it to quit. And then I could not even in the graphical interface restart my host 11.4 needed to “shutdown -h now”

    Then it did , but upon booting up it got stuck.So I pressed the powerbutten till it went down again. After the seconnd try to boot my main sys ,it did boot up , like before , but shoutet at me with this error message and I can not even open up my virtual box. I have snapshot of the message , but on top I did also write what it silently showed to me :/

    I do not know. Either I did download the logitech driver for 64bit on my 32bit (but I checked and there was not much info anyway in wankdows xp)
    Maybe that crashed? But most likely I think I have run out of space there
    and it just froze
    x_X

    And I see now , adding ,especialy on Wankdows xp in virtualBox additional
    hardware drivers is not the best thing to do, but on the other hand ,how do you want to test out something.

    And yes I see it is lethal to VBox if powering it down by force….
    I should have take 5 and come back to it ,approach this with issue ,by trying opening up new VBox to see if it boots up paralel one, but this whole thing was way to frozen as I remember.

    Now it is what it has become

    I did have 3 snapshots done from my xp. I also did have many other systems set up there. Do I have to lose everything again @_@ ?

    Is there any way to fix this, please ????

    ——————————————

    1) Is there any way to run Corrupt VBox in safe mode ?
    I did run my main Hostsys ubu11.4 in recovery mode, but this did not help , Vbox not responding.

    2) Should I delete the Vbox (but not the files) and install it ? If yes
    would it be correct to just go to Package manager remove it and back install it (not selecting the total removal of siles)

    3) Ubuntu software Center is showing me the option of reinstalling it – But this would delete all my basic configurations or not ?

    4) Or should I just delete (not the files) the GUESTADDITIONS of the VBox ?

    Thank you
    Best regards

    • Oded:

      The problem is likely in the configuration file. If you force-shutdown your host, then the VirtualBox configuration file can get corrupted. At this point its important to *not run the VM again* before resolving the corruption, otherwise you’d lose the configuration backup that VirtualBox does automatically.

      To resolve the corruption, go into the directory where your VirtualBox VMs are stored (it changes according to the user – sometimes its in Documents. If you are unsure, open the VirtualBox application, right click the VM you are having trouble with and select “Show in file manager”). There should be a “VM name”.vbox file, and there should also be a file named the same but with the extension “vbox-prev” – that file is the configuration backup that VirtualBox keeps. You need to compare the two files and fix the problems in the first. If its too much of a problem (or if the first file is too much gone), you can just copy the backup file over the current one and see if that lets you start your VM.

Leave a Reply