25
May

How To: Install VirtualBox 3.2 on Fedora 13

This is a step by step tutorial on how to get VirtualBox 3.2 up and running on Fedora 13. Specifically, this guide was written using the VirtualBox 3.2.0 (32-bit) version. It can be adapted to upcoming versions and different CPUs (64-bit). The folks at VirtualBox have made it easy to install for Fedora users and I’m going to show you how in a few easy steps. Right, open a terminal window and let’s get to it…

Step 1: Download, Copy, and Edit Repository File

This is a one-liner command that will download, copy, and edit the VirtualBox repository file at once.

su -c 'wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo; sed -i "s,enabled=0,enabled=1,g" /etc/yum.repos.d/virtualbox.repo'

Step 2: Update Repository and Install VirtualBox-3.2

This command will update yum repositories to include the new VirtualBox repository file we copied in the last step and then it will attempt to install VirtualBox-3.2 with dependencies.

su -c 'yum update; yum install -y VirtualBox-3.2 dkms gcc'

Step 3: Run VirtualBox Setup Script

This command will run the VirtualBox driver setup script.

su -c '/etc/init.d/vboxdrv setup'

If you’re having issues, try installing “kernel-PAE-devel” or “kernel-devel”.

Step 4: Setup Groups for VirtualBox Access

This command will add you to the vboxusers group. Replace “username” with your actual username found by using the whoami command.

su -c 'usermod -G vboxusers -a username'

If you find that you’re getting SELinux errors or denials, try adding VirtualBox.so as an exception with this command:
su -c 'chcon -t textrel_shlib_t /usr/lib/virtualbox/VirtualBox.so'

Step 5: Run VirtualBox

Finally, run VirtualBox and have fun with it!

VirtualBox

 

Appendix A: To Properly Backup the VirtualBox Machine (.vdi):

Please refer to my other page here:

How To: Properly Backup a VirtualBox Machine (.VDI)

Appendix B: Setup a Pre-Built VirtualBox Guest Image

Please refer to my other page here:

How To: Setup a Pre-Built VirtualBox Guest Image [Tutorial/Guide]

Appendix C: Shrinking a VirtualBox Guest Image

Please refer to my other page here:

Shrinking a Dynamic VirtualBox Disk Image

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 35 Comments So Far

  • kistej
    May 26th, 2010 at 4:04 pm

    Hi,
    how do you call the kernel-source package in fedora? My install failed because the missing kernel sources and I do not know how it is call in fedora (just changed from suse and in that the package was called kernel-source).

    Thanks a lot!
    k

  • Derek@TheDailyLinux
    May 26th, 2010 at 4:59 pm

    “yum install -y kernel-devel” ought to take care of it for you. ;)

  • Nasser M. Abbasi
    June 1st, 2010 at 7:00 am

    I followed the above instructions. It can’t find the kernel sources. WhenI do

    yum install -y kernel-devel

    It telling me that the sources allready installed? What do I do now?

    I am using fedora 13, 64 bit

    # yum update; yum install -y VirtualBox-3.2 dkms gcc

    ……

    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing : kernel-devel-2.6.33.5-112.fc13.x86_64 1/2
    Installing : dkms-2.1.0.1-1.fc12.noarch 2/2

    Installed:
    dkms.noarch 0:2.1.0.1-1.fc12

    Dependency Installed:
    kernel-devel.x86_64 0:2.6.33.5-112.fc13

    Complete!

    # /etc/init.d/vboxdrv setup

    Stopping VirtualBox kernel module [ OK ]
    Recompiling VirtualBox kernel module [FAILED]
    (Look at /var/log/vbox-install.log to find out what went wrong)

    # cat /var/log/vbox-install.log
    Attempting to install using DKMS

    Creating symlink /var/lib/dkms/vboxdrv/3.2.0/source ->
    /usr/src/vboxdrv-3.2.0

    DKMS: add Completed.

    Error! Your kernel source for kernel 2.6.33.3-85.fc13.x86_64 cannot be found at
    /lib/modules/2.6.33.3-85.fc13.x86_64/build or /lib/modules/2.6.33.3-85.fc13.x86_64/source.
    You can use the –kernelsourcedir option to tell DKMS where it’s located.
    Failed to install using DKMS, attempting to install without
    Makefile:159: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

    # yum install -y kernel-devel

    Loaded plugins: presto, refresh-packagekit
    Setting up Install Process
    Package kernel-devel-2.6.33.5-112.fc13.x86_64 already installed and latest version
    Nothing to do

    # VirtualBox

    WARNING: The vboxdrv kernel module is not loaded. Either there is no module
    available for the current kernel (2.6.33.3-85.fc13.x86_64) or it failed to
    load. Please recompile the kernel module and install it by

    sudo /etc/init.d/vboxdrv setup

    You will not be able to start VMs until this problem is fixed.
    WARNING: The compilation of the vboxdrv.ko kernel module failed during the
    installation for some reason. Starting a VM will not be possible.
    Please consult the User Manual for build instructions.

    thanks
    –Nasser

  • Derek@TheDailyLinux
    June 1st, 2010 at 7:55 am

    From what I can see, you’ve installed kernel version 2.6.33.5-112.fc13 (kernel-devel.x86_64 0:2.6.33.5-112.fc13) but DKMS is trying to look for kernel version 2.6.33.3-85.fc13.x86_64 (kernel 2.6.33.3-85.fc13.x86_64).

    For the record, I have never installed a 64-bit version of VirtualBox. I would suggest making sure that your packages are all up to date with ‘yum update’.

  • Nasser M. Abbasi
    June 1st, 2010 at 11:15 am

    Hello Derek@TheDailyLinux;

    I did do yum update, and I also below show all the steps again, and it still says it can’t find the sources. please see below. You are correct that the kernel sources are not there. I have this:

    # ls -l /lib/modules/
    total 8
    drwxr-xr-x. 7 root root 4096 May 31 06:04 2.6.33.3-85.fc13.x86_64
    drwxr-xr-x. 7 root root 4096 Jun 1 06:31 2.6.33.5-112.fc13.x86_64

    # cd /lib/modules/2.6.33.3-85.fc13.x86_64
    # cd source
    bash: cd: source: No such file or directory

    But the sources for the 2.6.33.5-112.fc13.x86_64 exist:

    # cd /lib/modules/2.6.33.5-112.fc13.x86_64
    # cd source
    # ls -l
    total 2716
    drwxr-xr-x. 25 root root 4096 Jun 1 06:48 arch
    drwxr-xr-x. 2 root root 4096 Jun 1 06:48 block
    drwxr-xr-x. 3 root root 4096 Jun 1 06:48 crypto
    etc…

    So, when I tell it to use the sources that exist, it goes one step more, but it still fail:

    # export KERN_DIR=/lib/modules/2.6.33.5-112.fc13.x86_64/source
    # /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module [ OK ]
    Recompiling VirtualBox kernel module [ OK ]
    Starting VirtualBox kernel module [FAILED]
    (modprobe vboxdrv failed. Please use ‘dmesg’ to find out why)

    # dmesg | grep vboxdrv
    vboxdrv: version magic ’2.6.33.5-112.fc13.x86_64 SMP mod_unload ‘ should be ’2.6.33.3-85.fc13.x86_64 SMP mod_unload ‘
    [root@cpe-75-84-8-49 source]#

    So, I guess what I need is the sources for 2.6.33.3-85.fc13.x86_64 , which is what vbox wants, but what I have is the sources for 2.6.33.5-112.fc13.x86_64, which is not what vbox wants!

    How to get the correct kernel sources?

    # yum update
    Loaded plugins: presto, refresh-packagekit
    Setting up Update Process
    No Packages marked for Update

    # wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -O /etc/yum.repos.d/virtualbox.repo; sed -i “s,enabled=0,enabled=1,g” /etc/yum.repos.d/virtualbox.repo
    –2010-06-01 10:36:04– http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
    Resolving download.virtualbox.org… 137.254.16.69
    Connecting to download.virtualbox.org|137.254.16.69|:80… connected.
    HTTP request sent, awaiting response… 200 OK
    Length: 238 [text language="/plain"][/text]
    Saving to: “/etc/yum.repos.d/virtualbox.repo”

    100%[==================================================================================>] 238 –.-K/s in 0s

    2010-06-01 10:36:04 (30.9 MB/s) – “/etc/yum.repos.d/virtualbox.repo” saved [238/238]

    # yum update; yum install -y VirtualBox-3.2 dkms gcc
    Loaded plugins: presto, refresh-packagekit
    virtualbox | 951 B 00:00
    Setting up Update Process
    No Packages marked for Update
    Loaded plugins: presto, refresh-packagekit
    Setting up Install Process
    Package VirtualBox-3.2-3.2.0_61806_fedora13-1.x86_64 already installed and latest version
    Package dkms-2.1.0.1-1.fc12.noarch already installed and latest version
    Package gcc-4.4.4-2.fc13.x86_64 already installed and latest version
    Nothing to do

    # /etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module [ OK ]
    Recompiling VirtualBox kernel module [FAILED]
    (Look at /var/log/vbox-install.log to find out what went wrong)

    # cat /var/log/vbox-install.log
    Attempting to install using DKMS
    removing old DKMS module vboxdrv version 3.2.0

    ——————————
    Deleting module version: 3.2.0
    completely from the DKMS tree.
    ——————————
    Done.

    Creating symlink /var/lib/dkms/vboxdrv/3.2.0/source ->
    /usr/src/vboxdrv-3.2.0

    DKMS: add Completed.

    Error! Your kernel source for kernel 2.6.33.3-85.fc13.x86_64 cannot be found at
    /lib/modules/2.6.33.3-85.fc13.x86_64/build or /lib/modules/2.6.33.3-85.fc13.x86_64/source.
    You can use the –kernelsourcedir option to tell DKMS where it’s located.
    Failed to install using DKMS, attempting to install without
    Makefile:159: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.

    –Nasser

  • Derek@TheDailyLinux
    June 1st, 2010 at 5:42 pm

    I’m sort of at a loss here and I don’t know how to explain the issues you’re seeing. If you need the kernel sources for the current running kernel, you may be able to use the following untested commands:
    [bash]
    yum install kernel-source-`uname -r`
    yum install kernel-dev-`uname -r`
    [/bash]

  • Nasser M. Abbasi
    June 1st, 2010 at 8:40 pm

    Thank you for the suggestion. I tried your command, but no packages found:

    # yum install kernel-source-`uname -r`
    Loaded plugins: presto, refresh-packagekit
    Setting up Install Process
    No package kernel-source-2.6.33.5-112.fc13.x86_64 available.
    Nothing to do

    # yum install kernel-dev-`uname -r`
    Loaded plugins: presto, refresh-packagekit
    Setting up Install Process
    No package kernel-dev-2.6.33.5-112.fc13.x86_64 available.
    Nothing to do

  • Derek@TheDailyLinux
    June 1st, 2010 at 9:45 pm

    The only thing I could find in the Fedora 13 documentation for “kernel source” was this page:
    http://docs.fedoraproject.org/en-US/Fedora/13/html/Release_Notes/sect-Release_Notes-Linux_Kernel.html

    At this point, you’ll want to bring up any questions you have with the Fedora Forums.

  • Nasser M. Abbasi
    June 2nd, 2010 at 10:00 am

    Hello;

    Good news. Someone must have fixed something at the repository. I did an update now, and repeated the same steps you showed, and it all went ok ! Can start VirtualBox ok now.

    Thanks for your help.

    yum update; yum install -y VirtualBox-3.2 dkms gcc
    Loaded plugins: presto, refresh-packagekit
    virtualbox | 951 B 00:00
    ….
    Dependencies Resolved

    Total download size: 2.7 M
    Is this ok [y/N]: y
    Package dkms-2.1.0.1-1.fc12.noarch already installed and latest version
    Package gcc-4.4.4-2.fc13.x86_64 already installed and latest version
    Resolving Dependencies
    –> Running transaction check
    —> Package VirtualBox-3.2.x86_64 0:3.2.0_61806_fedora13-1 set to be updated
    –> Finished Dependency Resolution

    Dependencies Resolved

    Installing:
    VirtualBox-3.2 x86_64 3.2.0_61806_fedora13-1 virtualbox 42 M

    Downloading Packages:
    VirtualBox-3.2-3.2.0_61806_fedora13-1.x86_64.rpm | 42 MB 00:41
    Running rpm_check_debug
    Running Transaction Test
    Transaction Test Succeeded
    Running Transaction
    Installing : VirtualBox-3.2-3.2.0_61806_fedora13-1.x86_64 1/1

    Creating group ‘vboxusers’. VM users must be member of that group!

    No precompiled module for this kernel found — trying to build one. Messages
    emitted during module compilation will be logged to /var/log/vbox-install.log.

    Success!

    Installed:
    VirtualBox-3.2.x86_64 0:3.2.0_61806_fedora13-1

    Complete!

    #/etc/init.d/vboxdrv setup
    Stopping VirtualBox kernel module [ OK ]
    Removing old VirtualBox netadp kernel module [ OK ]
    Removing old VirtualBox netflt kernel module [ OK ]
    Removing old VirtualBox kernel module [ OK ]
    Recompiling VirtualBox kernel module [ OK ]
    Starting VirtualBox kernel module [ OK ]

  • Derek@TheDailyLinux
    June 2nd, 2010 at 10:43 am

    That’s great news! Thanks for coming back to share.

  • Mohaed talaat
    June 12th, 2010 at 2:50 pm

    i just run
    yum install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-devel

    dkms
    and update kernel

  • 249 designs
    June 26th, 2010 at 1:13 pm

    Awesome. Worked perfect.. I had to install wget (yum install -y wget) first but it worked perfect.

  • Derek@TheDailyLinux
    June 26th, 2010 at 5:27 pm

    That’s weird! The Fedora installation that I tested this on had ‘wget’ installed by default. Hmmm…

    You could’ve used ‘curl’ as well. Something like this would’ve done it:
    [bash]
    su -c ‘curl http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo -o /etc/yum.repos.d/virtualbox.repo; sed -i "s,enabled=0,enabled=1,g" /etc/yum.repos.d/virtualbox.repo’
    [/bash]

  • 249 Designs
    June 29th, 2010 at 5:03 am

    I install from the live CD, not the full DVD, so that could be why ‘wget’ wasn’t included.I have since installed from the DVD and ‘wget’ was installed… Strange, right.

  • Dado-PG-MNE
    July 8th, 2010 at 5:27 am

    Thank you for great help!!!
    These instructions were the best of all I could find!!!

  • Emilio Anaya
    July 23rd, 2010 at 5:56 pm

    download the rpm kernel-devel from

    # http://rpm.pbone.net/index.php3/stat/4/idpl/14000745/dir/fedora_13/com/kernel-devel-2.6.33.3-85.fc13.x86_64.rpm.html

    install the rpm

    # /etc/init.d/vboxdrv setup

  • Thomas Shores
    July 30th, 2010 at 8:36 pm

    Thank you! Thank you! Thank you!

    I’ve been using qemu, which has worked fine until Fedora 13, at which point I was unable to successfully install Windows XP as a guest — an unresolved bug is hanging around. So I followed your instructions to the letter and they worked perfectly. Installed guest Windows XP without a single hitch!

    I really appreciate tutorials like yours — they save rather ordinary users like myself an infinite amount of work. Thanks again!

  • Martin Grotzke
    August 6th, 2010 at 5:49 am

    Hi,

    just to share this: I’m running a PAE kernel (uname -r: 2.6.33.6-147.2.4.fc13.i686.PAE) and had to `yum install kernel-PAE-devel` instead of kernel-devel.

    Cheers,
    Martin

  • Peter
    August 18th, 2010 at 1:04 pm

    Thank you, Martin.

    Installing ‘kernel-PAE-devel’ instead of ‘kernel-devel’ worked for me too!!

    Peter

  • Tan
    August 27th, 2010 at 9:44 am

    Appreciate advice to resolve problem when running Virtual box driver script:

    su -c ‘/etc/init.d/vboxdrv setup’
    Stopping VirtualBox kernel module [ OK ]
    Recompiling VirtualBox kernel module [FAILED]

    Error message:
    ===========
    Attempting to install using DKMS
    removing old DKMS module vboxdrv version 3.2.8
    ——————————
    Deleting module version: 3.2.8
    completely from the DKMS tree.
    ——————————
    Done.

    Creating symlink /var/lib/dkms/vboxdrv/3.2.8/source ->
    /usr/src/vboxdrv-3.2.8
    DKMS: add Completed.

    Error! Your kernel source for kernel 2.6.33.6-147.fc13.i686 cannot be found at
    /lib/modules/2.6.33.6-147.fc13.i686/build or /lib/modules/2.6.33.6-147.fc13.i686/source.
    You can use the –kernelsourcedir option to tell DKMS where it’s located.
    Failed to install using DKMS, attempting to install without
    Makefile:159: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR= and run Make again. Stop.
    ================================================

  • Derek@TheDailyLinux
    August 30th, 2010 at 7:43 am

    It’s having a hard time finding your kernel source. Try installing kernel-devel or kernel-PAE-devel with ‘yum install kernel-devel’.

  • sae
    September 3rd, 2010 at 3:22 am

    Do this:
    export KERN_DIR=/usr/src/kernels/2.6.34.6-47.fc13.x86_64/

  • Shehan Mendis
    September 4th, 2010 at 6:38 am

    Thank you.. And installing Virtual Box worked.

  • Phillip Hall
    September 14th, 2010 at 11:36 pm

    I am having the exact same problem as Nasser M. Abbasi. Did this get resolved for you, Nasser M. Abbasi? And if so, what was the magic bullet.
    I have tried everything that was suggested to him with the exact same results. I am running Fedora 13 Kernel Linux 2.6.33.3-85.fc13.x86_64.

    Like I said I have followed everything and ended up with the exact same errors so there is no need to repost them. And I tried everything suggested here to date.

    Thank you for your support.

  • abhi
    September 23rd, 2010 at 12:33 am

    Thanks to all i had the same problem .
    But ‘yum install kernel-PAE-devel` instead of kernel-devel. solved it.

  • Ztirf
    September 29th, 2010 at 1:11 am

    I did step 1 and 2 but on step 3 i got this
    [root@alvin ~]# su -c ‘/etc/yum.repos.d/vboxdrv setup’
    bash: /etc/yum.repos.d/vboxdrv: No such file or directory

    I checked from step to see where the file is and execute this command
    [root@alvin ~]# su -c ‘/etc/yum.repos.d/virtualbox.repo setup’
    bash: /etc/yum.repos.d/virtualbox.repo: Permission denied

    Anybody to help me?
    Thanks

  • Derek@TheDailyLinux
    September 29th, 2010 at 7:35 am

    That seems really odd. I’m not sure why the vboxdrv file wouldn’t exist unless they changed something in a recent build. The virtualbox.repo is a repository file, so that wouldn’t help with the setup of the VirtualBox kernel modules. It’s probably giving you permission denied because it doesn’t have executable rights (chmod +x ). Were there any errors or strange things that happened during the last two steps?

  • xiao_haozi
    October 10th, 2010 at 10:59 am

    A lot of people seem to have the kernel location issue.
    It’s explained at the following link, but basically you are referencing two seperate kernels and you can see that by comparing what is installed as kernel-devel and what is running (uname -r).

    See here: http://blog.eduardovalle.com/2010/10/01/a-virtual-box-of-surprises/

  • sam
    October 25th, 2010 at 10:10 pm

    Thanks! Wonderful article!

    –Sam

  • jose inoa
    November 14th, 2010 at 7:09 pm

    Thanks for Everything, resolved my problem, I’m now on me, my English is not very good, I hope you understand

  • Mikel
    December 22nd, 2010 at 10:12 am

    This can be done just with one line command!

    rpm -Uvh http://download.virtualbox.org/virtualbox/4.0.0/VirtualBox-4.0-4.0.0_69151_fedora13-1.x86_64.rpm ; yum install kernel-devel kernel-headers ; /etc/init.d/vboxdrv setup
    :P

  • fouding
    March 21st, 2011 at 11:03 pm

    Thank xiao_haozi (a Chinese? me too)! I follow ur link http://blog.eduardovalle.com/2010/10/01/a-virtual-box-of-surprises/ and ran

    # yum install kernel-devel-`uname -r`

    – works like a charm~

  • T.J. Pfeifle
    November 22nd, 2011 at 11:38 am

    System>Administration>Add/Remove Software

    Search “kernel-PAE-devel”. If “kernel-PAE-devel-2.6.33.3-85.fc13″ does not show, install “kernel-PAE-devel-2.6.34.9-69.fc13″ first. Search “kernel-PAE-devel” again. Then install “kernel-PAE-devel-2.6.33.3-85.fc13″. Follow the same steps for “kernel-devel”. PAY ATTENTION TO VERSION NUMBERS! The command-line only picks up the latest version, so you will not get the version you need.

Who Linked To This Post?

  1. [翻译]在fedora 13里安装VirtualBox 3.2 | 无忧Perl | 中文Perl社区 | There's More Than One Way To Do It | 51perl.com
  2. Fedora安装VirtualBox 3.2.x - Centos教程

Share your thoughts, leave a comment!