After I installed Ubuntu to my Laptop, I began to install my favorite applications. Everything went smooth. One of my favorite application is VirtualBox. I’m big fan of it, and I use it on both Windows and Linux systems. All of my virtual machines are created on VirtualBox. So I installed VirtualBox, copied a virtual machine from my backup storage and just before run the virtual machine, I remembered that I need to set up IP address of the host-only network. I opened the network tab in VirtualBox settings and I couldn’t see any Host-Only networks (there should be one in default). So I clicked to “Add Host-Only Network” button and got a strange error:
Failed to create the host-only network interface. VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory. Result Code: NS_ERROR_FAILURE (0x80004005) Component: HostNetworkInterface Interface: IHostNetworkInterface {87a4153d-6889-4dd6-9654-2e9ff0ae8dec}
I haven’t seen this error before. I have checked if “/dev/vboxnetctl” exists, and unfortunately it doesn’t. It’s obvious that the “vboxnetctl” file should be a part of VirtualBox software but it wasn’t there. One of the good thing of VirtualBox is, you can do everything using command line. So I tried to add host-only network using command line, and this time I see “a warning message” before the error:
gokhan@genesis:~/Desktop$ sudo VBoxManage hostonlyif create WARNING: The vboxdrv kernel module is not loaded. Either there is no module available for the current kernel (3.5.0-26-generic) 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. 0%... Progress state: NS_ERROR_FAILURE VBoxManage: error: Failed to create the host-only adapter VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
As you see, vboxdrv kernel module is not loaded because it doesn’t work with the current kernel of my system. So I need to recompile vboxdrv kernel modules. When I run the “/etc/init.d/vboxdrv setup”, I get another error because the kernel headers for my current kernel are not installed:
* Stopping VirtualBox kernel modules [ OK ] * Uninstalling old VirtualBox DKMS kernel modules [ OK ] * Trying to register the VirtualBox kernel modules using DKMS Error! Your kernel headers for kernel 3.5.0-26-generic cannot be found. Please install the linux-headers-3.5.0-26-generic package, or use the --kernelsourcedir option to tell DKMS where it's located * Failed, trying without DKMS * Recompiling VirtualBox kernel modules * Look at /var/log/vbox-install.log to find out what went wrong
So I installed the kernel headers and re-compile VirtualBox kernel modules:
gokhan@genesis:~/Desktop$ sudo apt-get install linux-headers-3.5.0-26-generic ... gokhan@genesis:~/Desktop$ sudo /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 ]
After the kernel modules started, I re-tried to add “Add Host-Only Network” and it worked successfully.