I installed VirtualBox through the Synaptic Package Manager using the instructions on the Downloads page of this site, and it installed fine, but I got this error when it tried to compile the kernal:
VirtualBox will not start until this problem is fixed. Please consult /var/log/vbox-install.log to find out why the kernel module does not compile. Most probably the kernel sources were not found. Install them (the package name is probably linux-headers-<version> whereby <version> can be determined by 'uname -r') and execute
/etc/init.d/vboxdrv setup
as root.
You need to get the kernel source from the vender of the OS. Typically this is installed when and if you chose to install the development packages that are provided by the OS supplier.
So it is possible that you only need to install the development packages from the OS vender and then run the setup as described in the error message.
The magic command you are looking for is sudo apt-get build-essential linux-headers-$(uname -r). The first of these is a collection of tools needed to rebuild device drivers and the kernel; you've probably got most of these already loaded but the system is clever enough only to load the extra bits.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
The place I bought my dedicated server from (ovh.co.uk) use their own version of the kernel: 2.6.27.10-grs (OVH) and seen as it's a custom kernel I can't run the commands you gave me. I have looked over their site and I can't seem to find a download for their kernel (I think that's what I'm looking for) so I'm well and truly stuck now.
Sorry my bad Chaosleet, I forgot the install as the first argument in the apt-get command. With this, the build essential will work.
Did you check your /var/log/vbox-install.log and if so that did it say?
As to the kernel, 2.6.28.1-xxxx-std-ipv4-32 sounds like a vendor specific custom kernel to me. From your later post it sounds like an ovh.co.uk kernel. However surely OVM have a support site where they have a repository for OVM specific distros. Kernels to need to get updated due to security vulnerabilities and users do have a valid reason (e.g. loading VBox) where they want to add their own device drivers. The headers package might have a slightly different name. Type doing an apt-cache search 2.6.28.1 | grep head so see if there are any plausible hits. Also post a Q on the OVM support site.
@orlandopasionjr, your commands are just the same as doing a sudo /etc/init.d/vboxdrv setup which is what the package install tries anyway. This will only fail if some dependencies are missing.
Read the Forum Posting Guide
Google your Q site:VirtualBox.org or search for the answer before posting.
I am having all of the same errors as previous users. I first tried to install virtualbox and got this log error:
Error! Your kernel source for kernel 2.6.27-11-generic cannot be found at
/lib/modules/2.6.27-11-generic/build or /lib/modules/2.6.27-11-generic/source.
You can use the --kernelsourcedir option to tell DKMS where it's located.
Failed to install using DKMS, attempting to install without
Makefile:140: *** Error: unable to find the sources of your current Linux kernel. Specify KERN_DIR=<directory> and run Make again. Stop.
I then tried;
sudo apt-get install build-essential dkms
sudo /etc/init.d/vboxdrv setup
Still received the same error. So I tried this;
sudo apt-get install build-essential linux-headers-$(uname -r)
After a confirmation that build-essential is already the newest version, I received this error:
Package linux-headers-2.6.27-11-generic is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
E: Package linux-headers-2.6.27-11-generic has no installation candidate
I'm not sure what else to try. I had a perfectly good working virtualbox on ubuntu 8.10. I then did an update to 9.04. Now I can not get virtualbox working. I'm trying and trying to install from the channel or the downloaded .deb package. I just can't get this to work. Any help?
Install linux-headers-generic. That is the Ubuntu meta package which will always depend on the latest kernel headers available. Something else I've seen here a lot is people with faulty or missing entries in their sources.list. Since the package linux-headers-2.6.27-11-generic should be installable on a default system, it seems you're missing an entry in your sources.list file. You can find it in /etc/apt.
Thanks for the help. I found the solution to my problem. Likely specific to me.
When I upgraded from 8.10 to 9.04 my GRUB menu was not updated properly. So it was booting to the 2.6.27.11 kernel, but had the 2.6.28.11-generic kernel and was actually setup for that. So I deleted the grub menu with rm menu.lst. Then recreated it with sudo update-grub. Then rebooted, and chose the option to use the 2.6.28-11-generic kernel, and I was able to install Virtualbox.
So, specific to me. Sorry, but thanks so much for the help!
I don't know if you will read this message or not, but anyway.
I think I've got exactly the same problem as you, and I'm about to do what you say you did, but I'm very new in Linux and I'm afraid of doing something wrong.. Is there any recommendation you can give me? Or just by following the steps you say I'll have everything solved?