27
Apr

How To: Install VirtualBox on Ubuntu 8.04LTS (Hardy Heron) [Tutorial]

vbox_logo2_gradient.png

Introduction:

This guide is intended to help users fully install VirtualBox and all of it’s features which don’t work out of the box such as USB support.

Download VirtualBox:

As of this writing, there is no specific download for 8.04LTS (Hardy Heron), so you will be downloading the version built for 7.10 (Feisty Fawn).

Goto the VirtualBox download hompage, scroll down to the bottom, click on the “Platform” drop-down menu, and select “Ubuntu 7.10 i386” to download the package. Note: If you have a 64bit computer, download the “Ubuntu 7.10 AMD64” package.

Install VirtualBox

Double-click on the package you just downloaded and you will be prompted to install it.

Setup Permissions:

This can be done in two different ways.  The graphical way or the command line way.

Via Command Line:

[In Terminal] sudo usermod -G vboxusers -a username

Via Graphical Menus:

Goto System -> Administration -> Users and Groups.

Click on the “Unlock” button and then enter in your password.

Click on the “Manage Groups button.

Find the “vboxusers” group which is probably at the very bottom of the list, highlight it by clicking again,  and click once more on “Properties”.

Make sure there’s a check mark next to your user’s name.

Setup USB:

USB is disabled by default, so you’ll probably want to enable it.  Otherwise you’ll get an error when you go into the “Settings” of your virtual machine.  To  correct this, you’ll need to edit the mountdevsubfs.sh file:

[In Terminal] sudo gedit /etc/init.d/mountdevsubfs.sh

Inside, you’ll see a block of code that looks like this:

#
# Magic to make /proc/bus/usb work
#
#mkdir -p /dev/bus/usb/.usbfs
#domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
#ln -s .usbfs/devices /dev/bus/usb/devices
#mount –rbind /dev/bus/usb /proc/bus/usb

Change it to look like this (uncomment out the region by deleting the “#’s”):

#
# Magic to make /proc/bus/usb work
#
mkdir -p /dev/bus/usb/.usbfs
domount usbfs “” /dev/bus/usb/.usbfs -obusmode=0700,devmode=0600,listmode=0644
ln -s .usbfs/devices /dev/bus/usb/devices
mount –rbind /dev/bus/usb /proc/bus/usb

Save the changes, log out, and then log back in again for the changes to take place.

Properly Backup Your VirtualBox .VDI File:

I have written a guide specifically for this purpose.  It is located here:

http://derekhildreth.com/blog/index.php/2007/11/how-to-properly-backup-a-virtualbox-machine-vdi

Minor Troubleshooting:

With these instructions, I was able to get my virtual machine working perfectly in VirtualBox.  If you have any problems, please let me know by commenting below.  I will help to resolve your issue and then place it with the solution in this section of the tutorial.  Thank you.

Feel free to donate if this post prevented any headaches! Another way to show your appreciation is to take a gander at these relative ads that you may be interested in:


There's 16 Comments So Far

  • charlie
    April 30th, 2008 at 3:56 pm

    Hello, Great tutorial! All is working well but I can’t get the guest editions to load…. in my last config in Gusty i had great seamless destop even with compiz effects? The gusty config as I remember just prompted me to add guest editions when I was changing vbox screen size and installation was automated? thanks agin for the great tutorial…c

  • Ben
    May 9th, 2008 at 1:13 pm

    Ran across this from your server setup page. Though I am not at that point yet, I am thinking about moving from a dual boot to a virtual machine running XP as the guest (running Hardy right now). I had some total noob questions for you: so once I remove XP I will have this 20 GB partition laying around, any thoughts on the best way to utilize this (move my home directory there)? once I install XP on the virtualbox, the space I give it is constant right, I can’t change it later (though I can adjust RAM allocations right)? When running windows as a guest on Hardy, is it a security risk in that permissions might be conveyed to the linux OS, or how are they separated? I am thinking about just leaving the virtual machine without network access since I can use the host OS for all of that. Sorry for all the questions, but you seem like you would be willing to answer them (though I can post on a forum if you would like).

  • SendDerek
    May 9th, 2008 at 3:35 pm

    @Charlie:

    Unfortunately, I’m not really sure where you should go at this point. Personally, I’ve only been able to get the guest additions to load in a Windows guest, not in a Linux guest. So, I’m not going to be much help, I’m afraid.

    @Ben:
    Don’t sweat asking questions. I enjoy the feedback.

    Q: Once I remove XP I will have this 20 GB partition laying around, any thoughts on the best way to utilize this (move my home directory there)?

    A:I would probably merge the 20GB partition into your existing home partition. If you don’t have a home partition, use the 20GB as a starting point and then add more space.

    Q: once I install XP on the virtualbox, the space I give it is constant right, I can’t change it later (though I can adjust RAM allocations right)?

    A: You can create a dynamically allocated drive, this way if your guest OS needs more room, it will automatically adjust. If you have created a static virtual machine and would like to change it to a dynamic one, you can read the instructions I posted here (I followed them personally, and they work):
    http://www.derekhildreth.com/blog/how-to-install-virtualbox-on-fedora-8-werewolf/

    It’s item #9. I just haven’t moved it to it’s own post yet.

    Q: When running windows as a guest on Hardy, is it a security risk in that permissions might be conveyed to the linux OS, or how are they separated?

    A: VirtualBox will not mess around with your permissions. A guest OS is simply looked at as a file to Linux. VirtualBox makes it run. If you get a virus in a Windows guest it will not infect the host machine. Just because you’re hosting Windows through Linux, it’s still prone to Viruses just like before. I’m not sure how else to explain this one at the moment, but I hope this is enough.

    I do have personal forums and I do check them regularly. Please feel free to create an account and post around. The forums are located at http://derekhildreth.com/forums.

  • Stuart
    July 12th, 2008 at 12:24 am

    When i start to try and run my virtual machine i get the following error (Ubuntu 8.04)

    Could not load the settings file ‘/home/stuart/.VirtualBox/VirtualBox.xml’ (VERR_OPEN_FAILED).
    FATAL ERROR: Attribute ‘version’ has a value, ‘1.3-linux’, that does not match its #FIXED value, ‘1.2-linux’
    Location: ‘/home/stuart/.VirtualBox/VirtualBox.xml’, line 3, column 83.

    Result Code:
    0x80004005
    Component:
    VirtualBox
    Interface:
    IVirtualBox {76b25f3c-15d4-4785-a9d3-adc6a462beec}

  • Waterfall2
    July 29th, 2008 at 12:01 pm

    I am trying to get the usb to work on my guest os. I have Ubuntu 8.04 as the host and Winxp sp2 as the guest. All works well except the usb. I have followed your tutorial connected to doing this and numerous other fixes I have found on the internet but cannot get to work in the VirtualBox. It works in the host, I have a thumb drive and it reads it ok. Do you have any suggestions. Thank you

  • zwdev
    August 14th, 2008 at 1:50 pm

    Final Step You Need To
    EDIT /etc/udev/rules.d/40-basic-permissions.rules to read:

    # USB devices (usbfs replacement)
    SUBSYSTEM==”usb”, ENV{DEVTYPE}==”usb_device”, MODE=”0664″, GROUP=”vboxusers”
    SUBSYSTEM==”usb_device”, MODE=”0664″, GROUP=”vboxusers”

  • Antonio Torres
    September 5th, 2008 at 1:01 pm

    I’m using Ubuntu 8.04 as host and I’m new to Linux. In order to set the usb, I opened the Terminal, and typed your code:

    sudo gedit /etc/init.d/mountdevsubfs.sh

    But it then askes me for my user’s password:

    [sudo] password for tony:

    I type the password again and again but it won’t take me where you say it will.

    Unfortunately I don’t have enough Linux knowledge, please help me.

  • SendDerek
    September 5th, 2008 at 1:52 pm

    @ Antonio:

    I’m not sure why it wouldn’t get you to the text editor to edit this file. I know that even a slight type-o can goof things up. Tab completion is your best friend in a situation like this. If the file doesn’t exsist in the first place, there’s nothing to edit. Make sure that your password is being typed in as well. In fact, you should be able to leave off the “sudo” part of the command to at least see the file. You won’t be able to edit it, but just knowing that it’s there will help. As soon as you can see it, just add the “sudo” back to the beginning of the command.

    Start with the simple things and move up. I hope this helps even just a little. I’ll continue to try and help you if you need it, just let me know.

    -Derek

  • Antonio Torres
    September 5th, 2008 at 2:57 pm

    I removed the sudo, and yes, the file is there. And just like you said I wasn’t able to save any changes. But I went back and this time typed the sudo again; and the same problem came to me… the password.

    It keeps telling that I didn’t write it properly, but I’m sure that the word is ok, maybe is some code or text that I’m not adding to the sentence.

    Let me put it this way, I’m sure that my only password is, let’s say DRAGON. So I keep typing it, again and again but no. It tells me I didn’t do it right.

    Perhaps there’s a command line I need to type after or before I type DRAGON.

    Here’s a picture of how it looks:

    http://viewmorepics.myspace.com/index.cfm?fuseaction=viewImage&friendID=218859551&albumID=1147991&imageID=15948511

  • SendDerek
    September 5th, 2008 at 3:31 pm

    @ Antonio:

    Oh. Okay. So, the file is intact, it’s just that the password for the root account has been misplaced or forgotten. So, I would suggest resetting it. I did a quick google.com search and came up with this forum thread:

    http://www.linuxquestions.org/questions/debian-26/reset-root-password-293477/

    It should help you reset your root password. Otherwise, if you don’t want to do that, you can post a new thread of your own at the ubuntu forums and somebody there can help.

    It could also be something in your sudoers file. I’ve never had a problem with sudo, so I’m not sure what to do from here. If it were me, I would just reset the root password given the method above.

    I hope this helps.

    PS. Here’s another reference I came across that will help guide you in fixing your sudo account:

    http://www.psychocats.net/ubuntu/fixsudo

  • Antonio Torres
    September 5th, 2008 at 7:28 pm

    You’ve been very helpful my friend. I’ll let you know if I finally get it right.

    Thanks.

  • kang
    November 9th, 2008 at 9:06 pm

    Hi, Thanks for the detail info. I was able to install virtualbox by following your instruction. Everything are working fine except my webcam cannot be detected. The purpose I install virtualbox is to use MSN live messenger to chat with friends and families. It would be a big help to me if you can give some advices.

    I have a Dell vostro 1400 laptop, the webcam is an “Integrated 2.0 mega pixel webcam 1400”.

    BTW, I’m not sure is the webcam is a usb webcam or what. But I have the USB enabled(I think, cause the usb mouse is working).

  • kang
    November 9th, 2008 at 9:08 pm

    some more information about my case.

    I have hardy installed, webcam is working in ubuntu.

  • Anrooo
    January 7th, 2009 at 6:37 pm

    I’m in the same boat as kang, except not using a laptop. I have installed Virtualbox and everything is working great. Trying to use msn messenger for my webcam but it is not detected by Virtualbox.

    My cam works in amsn etc. USB is working also as mouse etc is working fine. Just the darn webcam!

  • Lawrence Law
    March 2nd, 2009 at 3:09 am

    I’m lost. When I type “sudo gedit /etc/init.d/mountdevsubfs.sh” in terminal, i got the below which seem totally different.

    #! /bin/sh
    ### BEGIN INIT INFO
    # Provides: mountdevsubfs
    # Required-Start: mountkernfs
    # Required-Stop:
    # Should-Start: udev
    # Default-Start: S
    # Default-Stop:
    # Short-Description: Mount special file systems under /dev.
    # Description: Mount the virtual filesystems the kernel provides
    # that ordinarily live under the /dev filesystem.
    ### END INIT INFO
    #
    # This script gets called multiple times during boot
    #

    PATH=/lib/init:/sbin:/bin
    TTYGRP=5
    TTYMODE=620
    [ -f /etc/default/devpts ] && . /etc/default/devpts

    TMPFS_SIZE=
    [ -f /etc/default/tmpfs ] && . /etc/default/tmpfs

    KERNEL=”$(uname -s)”

    . /lib/lsb/init-functions
    . /lib/init/mount-functions.sh

    do_start () {
    #
    # Mount a tmpfs on /dev/shm
    #
    SHM_OPT=
    [ “${SHM_SIZE:=$TMPFS_SIZE}” ] && SHM_OPT=”,size=$SHM_SIZE”
    domount tmpfs shmfs /dev/shm tmpfs -onosuid,nodev$SHM_OPT

    #
    # Mount /dev/pts. Master ptmx node is already created by udev.
    #
    domount devpts “” /dev/pts devpts -onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE
    }

    case “$1” in
    “”)
    echo “Warning: mountdevsubfs should be called with the ‘start’ argument.” >&2
    do_start
    ;;
    start)
    do_start
    ;;
    restart|reload|force-reload)
    echo “Error: argument ‘$1’ not supported” >&2
    exit 3
    ;;
    stop)
    # No-op
    ;;
    *)
    echo “Usage: mountdevsubfs [start|stop]” >&2
    exit 3
    ;;
    esac

Share your thoughts, leave a comment!