5

I am trying to install VirtualBox inside Windows Bash (Beta) but I got following the persistent error message:

somasundaram@host:~/kernel34$ VBoxManage --version
WARNING: The character device /dev/vboxdrv does not exist.
         Please install the virtualbox-dkms package and the appropriate
         headers, most likely linux-headers-3.4.0+.

         You will not be able to start VMs until this problem is fixed.

4.3.36_Ubuntur105129

I also tried installing the linux headers for 3.4.1 and reconfigure with

somasundaram@host:~/kernel34$ sudo dpkg-reconfigure virtualbox-dkms

but to no avail.

5
  • 4
    The Linux version of VirtualBox has kernel drivers that will not work on Windows. The Unix command line tools expect to talk to those drivers. You should install the windows version of virtualbox and use those tools.
    – Stephen Harris
    Aug 24, 2016 at 17:04
  • 1
    Installing VirtualBox on Ubuntu on Windows seems convoluted to me. Are there good reasons for doing this?
    – edwinksl
    Aug 24, 2016 at 17:11
  • @edwinksl wanted to run vagrant with ansible in a more native way.
    – Somasundaram Sekar
    Aug 24, 2016 at 17:17
  • @StephenHarris is it possible to install ansible in wsl and run with virtual box and vagrant installed in windows with that ansible?
    – Somasundaram Sekar
    Aug 24, 2016 at 17:18
  • 1
    Why aren't you installing virtual box directly in Windows?
    – Anwar
    Aug 24, 2016 at 17:29

4 Answers 4

8

VirtualBox relies a lot on the hardware it is running on and it does not understand Bash on Windows. Running Vbox on BoW is never have been the intention of either Canonical, Microsoft or Oracle.

As explained by Microsoft:

This is a developer toolset to help you write and build all your code for all your scenarios and platforms.” It’s not a full Ubuntu virtual machine. You can’t use it to host servers, as you could on Linux.

It is a developer toolset; nothing more.

You will need changes on the hardware level to get this working. Probably from both Oracle and Microsoft.

With the current technology I say impossible.


By the way if you think you are capable enough to get hacking this together: the notice you posted are about 2 things

  • The character device /dev/vboxdrv does not exist. Please install the virtualbox-dkms package
  • and the appropriate headers, most likely linux-headers-3.4.0+.

You probably can install virtualbox-dkms with apt. Plus you need to check what headers you have. In general you install these with:

apt-get install linux-headers-`uname -r`
dpkg-reconfigure virtualbox-{numbers}

if uname -r shows 3.4. Otherwise you need to insert the numbers yourself.

If you can get those 2 working you might be a long way into the direction you need to go. Though I doubt you can get the 2nd working (vBox does not install on system it was not meant for).

1
  • Issue is still present on WSL 2, however the statement about the toolkit does not really make sense - why use WSL if it is not fully compatible, then you could just use VirtualBox in virtualbox and that works
    – serup
    Oct 24, 2020 at 23:25
3

Windows Bash is not Linux. Windows Bash is basically an API emulation that lets you run some Linux binaries, provided that they don't do anything special. In other terms, Windows emulates the more commonly used parts of the Linux ABI, enough for simple things like opening a file, reading and writing stuff and doing network I/O to work. However, things like interacting with hardware (which is what VirtualBox normally does) or even interacting with some sort of framebuffer(needed for X and therefore for e.g. Unity, however you can get around this) are not emulated and will fail. VirtualBox wants to build a device driver - which is simply not possible using this emulation model, as there is no kernel you could build it for. Therefore the installation of kernel headers or dkms modules will fail.

TLDR: Windows Bash on Windows is to Linux as wine on Linux is to Windows.

3

Bash on Windows doesn't have a Linux Kernel, which is required by the Virtual Box. All it does is, it provides similar functionalities that bash like tools expect from a Linux Kernel.

More especially Bash on Windows just provide some GNU tools to be run on top of a Windows Subsystem emulating Linux Kernel.

Since there is no kernel, there will be no modules for Virtual Box. So, It'll fail, won't install.

0

I realize this is an old question, but it seems there is a workaround if you use Vagrant. According to Vagrant, if you install Vagrant within the WSL it can work with your regular Windows Virtualbox install. Specifically, they state

Vagrant will detect when it is being run within the WSL and adjust how it locates and executes third party executables. For example, when using the VirtualBox provider Vagrant will interact with VirtualBox installed on the Windows system, not within the WSL. It is important to ensure that any required Windows executable is available within your PATH to allow Vagrant to access them.

The article I linked has much more detail.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .