Search code examples
linuxmakefilelinux-kernelvirtualizationvirtualbox

make: *** No targets specified and no makefile found. When trying to do dpkg-reconfigure virtualbox-dkms


I'm trying to get VirtualBox to work on ElementaryOS with kernel 3.2.0-49-generic. I've been getting this error :

WARNING: The character device /dev/vboxdrv does not exist.
     Please install the virtualbox-ose-dkms package and the appropriate
     headers, most likely linux-headers-generic.

     You will not be able to start VMs until this problem is fixed.
No protocol specified
No protocol specified
Failed to open the X11 display!

I've searched and found that running :

sudo dpkg-reconfigure virtualbox-dkms
sudo dpkg-reconfigure virtualbox

Solves the problem.

But when i do sudo dpkg-reconfigure virtualbox-dkms. I get this error :

------------------------------
Deleting module version: 4.1.12
completely from the DKMS tree.
------------------------------
Done.
Loading new virtualbox-4.1.12 DKMS files...
Building only for 3.2.0-49-generic
Building initial module for 3.2.0-49-generic
ERROR (dkms apport): kernel package linux-headers-3.2.0-49-generic is not supported
Error! Bad return status for module build on kernel: 3.2.0-49-generic (x86_64)
Consult /var/lib/dkms/virtualbox/4.1.12/build/make.log for more information.

Now I've checked the make.log file i found this error :

DKMS make.log for virtualbox-4.1.12 for kernel 3.2.0-49-generic (x86_64)
Thu Jul 18 05:57:58 EET 2013
make: Entering directory `/lib/modules/3.2.0-49-generic/build'
make: *** No targets specified and no makefile found.  Stop.
make: Leaving directory `/lib/modules/3.2.0-49-generic/build

I have no idea what should be done from here. Any help will be appreciated.


Solution

  • if you do ls -l in /lib/modules/3.2.0-49-generic/ folder you will find that build is a symbolic link to the /usr/src/3.2.0-49-generic directory

    ex:

    sagar.sakre@sagar-vm /lib/modules/3.2.0-23-generic $ ls -l
    total 4412
    
    lrwxrwxrwx  1 root root 39 Aug  6  2012 build -> /usr/src/linux-headers-3.2.0-23-generic
    

    So make sure that you have the built source code in /usr/src/ directory. If still problem persists upgrade the kernel.