Wednesday, August 10, 2011

Installing VirtualBox 4.1 on Fedora 15. The easy way and the #@!%§ one.

I'm testing a lot of stuff using Oracle software and decided to have my own test environment on VirtualBox machines. Expecting to face some problems with the more advanced Oracle stuff, I didn't think the installation of VirtualBox would be a problem.

And it doesn't have to be, those are the steps for a freshly installed Fedora 15:

Doing it right

  1. Get the VirtualBox yum repository
    [root@client01 ~]# wget -O /etc/yum.repos.d/virtualbox.repo http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
    This will put the file in the right place, being used with the next yum call.
  2. Install all needed packages
    [root@client01 ~]# yum -y install VirtualBox-4.1 dkms gcc kernel-devel-`uname -r`
    So very important... you'll see.
  3. Add your personal user to the vboxusers group
    [root@client01 ~]# usermod -a -G vboxusers rhanuschke
  4. Download the extension pack to get USB2.0 support and PXE improvements
    [root@client01 ~]# wget -O /tmp/Oracle_VM_VirtualBox_Extension_Pack-4.1.0-73009.vbox-extpack http://download.virtualbox.org/virtualbox/4.1.0/Oracle_VM_VirtualBox_Extension_Pack-4.1.0-73009.vbox-extpack
  5. Install the extension pack
    [root@client01 ~]# VBoxManage extpack install /tmp/Oracle_VM_VirtualBox_Extension_Pack-4.1.0-73009.vbox-extpack
  6. Clean your system
    [root@client01 ~]# rm /tmp/Oracle_VM_VirtualBox_Extension_Pack-4.1.0-73009.vbox-extpack
    [root@client01 ~]# yum clean all

Pretty simple, huh? Yes, if you know it. If you read the manuals. But probably you're a man. I'm a man. And men don't read manuals, do they? Especially when doing something so easy like installing VirtualBox, assembling furniture or programming DVD recorders.

I'm pretty sure most of the people who read this will have gotten here by googling the error messages they received during install.

So this is what happens if you're a man (and have the repo file downloaded already):



Doing it wrong

  1. Step 1? Why is this numbered? There won't be a step 2, I'll just execute this...
    [root@client01 ~]# yum -y install VirtualBox-4.1
    Trying to register the VirtualBox kernel modules using DKMS [FAILED]
    (Failed, trying without DKMS)
    Recompiling VirtualBox kernel modules [FAILED]
    (Look at /var/log/vbox-install.log to find out what went wrong)
    ... oh.
  2. Well, OK, somewhere on the VirtualBox homepage it stated something about installing that dkms that failed there. So I'll do that and run the setup again.
    [root@client01 ~]# yum install -y dkms
    [root@client01 ~]# /etc/init.d/vboxdrv setup
    Trying to register the VirtualBox kernel modules using DKMSError! echo
    Your kernel headers for kernel 2.6.38.6-26.rc1.fc15.x86_64 cannot be found at
    /lib/modules/2.6.38.6-26.rc1.fc15.x86_64/build or /lib/modules/2.6.38.6-26.rc1.fc15.x86_64/source.
    [FAILED]
    (Failed, trying without DKMS)
    Recompiling VirtualBox kernel modules [FAILED]
    (Look at /var/log/vbox-install.log to find out what went wrong)
    What?
  3. Allright then, yum install kernel-headers...

    No, I'll interrupt right here. You don't install kernel-headers in this step. You install kernel-devel. And you don't even really install kernel-devel - you install kernel-devel-`uname -r` because without the uname, you might just get the newest available kernel-devel, not the one you're running on.
  4. [root@client01 ~]# yum -y install kernel-devel-`uname -r`
    [root@client01 ~]# /etc/init.d/vboxdrv setup
    Trying to register the VirtualBox kernel modules using DKMSError! Bad return status for module build on kernel: 2.6.38.6-26.rc1.fc15.x86_64 (x86_64)
    Consult /var/lib/dkms/vboxhost/4.1.0/build/make.log for more information.
    [FAILED]
    (Failed, trying without DKMS)
    Recompiling VirtualBox kernel modules [FAILED]
    (Look at /var/log/vbox-install.log to find out what went wrong)
    What the...? But you said..!
    Okay, let's have a look into that /var/log/vbox-install.log

    /bin/sh: gcc: command not found
    ... d'oh!
  5. [root@client01 ~]# yum -y install gcc
    [root@client01 ~]# /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel modules [ OK ]
    Uninstalling old VirtualBox DKMS kernel modules [ OK ]
    Trying to register the VirtualBox kernel modules using DKMS[ OK ]
    Starting VirtualBox kernel modules [ OK ]
    Right, need a beer now...
After the beer, execute step 3 to 6 of the first list.

What we learn from this:
  1. RTFM. If you don't know the abbreviation, google it, live it, teach it... well, we all probably won't.
  2. VirtualBox does not install all of its dependencies.
  3. We don't always get meaningful error messages from VirtualBox.
  4. You don't have to reinstall VirtualBox if anything goes wrong, /etc/init.d/vboxdrv setup works fine for all those situations

No comments:

Post a Comment