After installing the VirtualBox software from Oracle start it up. Depending on your distribution and window manager it will be in the “System’ start menu or it may be somewhere else.
Create a new Virtual Machine (e.g. another Linux box with Fedora – select these from the ‘OS Type’ drop-down boxes). You may select an existing virtual disk (.vdi file) or create a new one. If selecting an existing vdi file, try to match the ‘hardware’ of your new VM as best you can with the one that was previously used with this .vdi image or you may run into problems.
When you first start up your newly created VM it may complain about the VBox kernel driver not being installed, in which case it will give you a command line to run (as root) to compile and install the driver. Just copy that command to your terminal window and execute it as root (prepend sudo). If this is the source of the problem you should also see vboxdrv driver fail at kernel startup (on your real, non-virtual PC), so that’s yet another indication that this is the problem.
The command that VirtualBox wants you to execute should look something like /etc/init.d/vboxdrv setup
It will print something like:
root@ae-fc9 ~> /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 ]
It may look like it hung at the “Trying to register…” line but just give it time, it will finish. If this procedure fails it most likely means that the installer was unable to find your kernel headers. Use the appropriate for your distribution means to get the kernel-headers package. Below are some examples (all need root permissions):
Fedora yum install kernel-headers.i386
Debian/Ubuntu: apt-get install kernel-headers.i386
Slackware: slackpkg install kernel-headers.i386
The suffix i386 may be different on your machine, e.g. if you’re running 64-bit Linux. You can usually omit this suffix and let the package installer figure it out.
Once you got the header the ‘/etc/init.d/vboxdrv setup’ command should work out. Of course, you must have gcc installed on your machine, but that’s kinda assumed.. (what are you doing with a Linux box that’s got no gcc on it anyways? 🙂 )
Things may often go wrong if you upgrade your kernel or if you are running an older Linux version and you did not bother to constantly upgtrade it and by the time you decide you want to install VB, the latest VB packages has gotten ahead and want to install a newer kernel version (and possibly other stuff as well).
If that’s the case go to
https://www.virtualbox.org/wiki/Download_Old_Builds_4_0 and try and find an older version of Virtual box that will work with you kernel.
An error which may happen after you have successfully installed Virtual Box and are now booting up one of your virtual machines and which looks like this:
—————————————————
Failed to open a session for the virtual machine WinXP.
Failed to load VMMR0.r0 (VERR_SUPLIB_OWNER_NOT_ROOT).Unknown error creating VM (VERR_SUPLIB_OWNER_NOT_ROOT)
Details:
Result Code: NS_ERROR_FAILURE (0x80004005)
Component: Console
Interface: IConsole {515e8e8d-f932-4d8e-9f32-79a52aead882}
—————————————————
This is a permission-related error – the following directories must be owned by root.root:
/opt
/usr
/usr/lib
Make sure they are and if necessary fix the issues, e.g.:
$ sudo chown root.root /usr/lib