Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot install Virtualbox #733

Closed
HeathNaylor opened this issue Aug 3, 2016 · 19 comments
Closed

Cannot install Virtualbox #733

HeathNaylor opened this issue Aug 3, 2016 · 19 comments

Comments

@HeathNaylor
Copy link

Description

I am able to sudo apt-get install virtualbox vagrant but when I attempt a vagrant up I am presented with an error. This ends at a Linux headers error, and since WSL is only the userspace and not the kernel am I correct in thinking that there is no current fix for this?

Expected results

Vagrant box comes up fine

Actual results

VirtualBox is complaining that the installation is incomplete. Please
run `VBoxManage --version` to see the error message which should contain
instructions on how to fix this error.

So then I run 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

And then I run sudo apt-get install linux-headers-3.4.0+

Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package linux-headers-3.4.0
E: Couldn't find any package by regex 'linux-headers-3.4.0'

Windows build number

Version 10.0.14393 Build 14393

@stehufntdev
Copy link
Collaborator

Thanks for reporting the issue. WSL does not currently provide Dynamic Kernel Module Support (DKMS) since it is emulating the Linux kernel interfaces exposed to user mode Linux binaries. We haven't investigated if WSL can also emulate the Linux kernel interfaces exposed to Linux kernel modules.

Check out the important links section on the main page to see what scenarios are being targeted for the current release.

@fpqc
Copy link

fpqc commented Aug 3, 2016

@HeathNaylor I wouldn't run virtualbox through WSL anyway. WSL does not have any display hardware, drivers, or really anything you might expect to exist on a real machine. However, since most of the output services for Linux (X, Pulseaudio, etc) are network-transparent, you can run the Win32-ported versions of their servers (vcXsrv, Pulseaudio) in TCP mode, and the Win32 ports have Windows driver support (which means you generally won't need to have WSL supporting Linux drivers). This is also why WSL doesn't support things like reading ext-filesystems, because the NT Kernel does not have drivers for them.

stehufntdev is on the NT kernel team (see his name!), and he is probably genuinely seeing what the demand is for this feature, but if you read some of the blog posts, it seems like this is beyond the scope of the WSL project for the foreseeable future. Right now, the idea is to implement the syscall interface (consisting mainly of calls from usermode to kernelmode) and parts of the kernel that are visible from userspace (/proc and /dev).

WSL supporting something like linux kernel-mode drivers could be practically impossible (think of how hard it would be to make a kernel-mode interface that let you use Windows device drivers seamlessly on Linux)

@dethoma dethoma closed this as completed Aug 3, 2016
@dethoma dethoma removed the feature label Aug 3, 2016
@HeathNaylor
Copy link
Author

@fpqc I understand all of that, makes perfect sense. However, how do I run vagrant up from my Ubuntu userspace then? I am fine with using Windows binaries but currently am unable to get this working.

@fpqc
Copy link

fpqc commented Aug 3, 2016

@HeathNaylor It says Vagrant supports cloud platforms. Couldn't you configure your Win32 instance of Virtualbox to appear like a cloud platform and then set Vagrant up to handle it like that?

@aseering
Copy link
Contributor

aseering commented Aug 3, 2016

@fpqc -- by "cloud platforms" I think it means "Amazon AWS" (and similar). Virtualbox isn't designed to work like AWS.

@aseering
Copy link
Contributor

aseering commented Aug 3, 2016

@HeathNaylor -- I haven't tried this, but one option (though a little clunky) would be to call the Windows version of Vagrant from Linux using cbwin.

@MikeTheCanuck
Copy link

MikeTheCanuck commented Aug 17, 2016

As an alternative/workaround, I have made peace with a hybrid Windows/Bash solution for running vagrant + virtualbox + ansible, relying on TCP/IP connectivity across the subsystems. Yes, it requires me having CMD and Bash open to interact with the different subsystems' tools, but it works for all usages I've tried so far.

@fpqc
Copy link

fpqc commented Aug 17, 2016

@MikeTheCanuck use @xilun 's cbwin project. It can call gui and console windows programs with wstart and wcmd (wcmd cmd for example) inside of the terminal emulator.

I highly suggest running outbash in --outbash-session mode, since this allows you to do things like multiplex cmd with tmux, which is pretty amazing. A few days ago, I tested running powershell, cmd, bash, and zsh each in their own tmux windows it was pretty nifty.

@ricardowong
Copy link

What about running a fake WSL VBoxManage that redirects input/output to the real VBoxManage on the windows installed Virtualbox?

@ricardowong
Copy link

With the new build you can run Windows executables so I propose the following to run Vagrant on WSL.

First, remove any previous VirtualBox from your WSL.
Next Check if you can run windows excecutables by adding the path export PATH=$PATH:/mnt/c/Windows/System32, then try opening notepad.exe

If successful go ahead.

  1. Install Vagrant and check if you can run the windows native VirtualBox cli tool.
    sudo apt-get install Vagrant export PATH=$PATH:"/mnt/c/Program Files/Oracle/VirtualBox" VBoxManage.exe

  2. Since vagrant requires the executable to be called VBoxManage, I've linked it at /usr/bin
    sudo ln -s "/mnt/c/Program Files/Oracle/VirtualBox/VBoxManage.exe" /usr/bin/VBoxManage VBoxManage

  3. Patch the vagrant drivers to include virtual box 5.0 and 5.1 as per the following instructions
    VirtualBox 5.0 not supported - Add Greater Than or Ignore Option hashicorp/vagrant#5572 (comment)
    Instructions taken from this comment by @PhilipeLouchtch.

At /usr/share/vagrant/plugins/providers/virtualbox/driver/
Copy version_4_3.rb > version_5_0.rb
Edit the class to be called version_5_0 and the log a few lines under
Repeat for version_5_1

Modify /usr/share/vagrant/plugins/providers/virtualbox/driver/meta.rb
find the hashmap on line 48, add after "4.3" => Version_4_3
,"5.0" => Version_5_0,
"5.1" => Version_5_0

Modify /usr/share/vagrant/plugins/providers/virtualbox/plugin.rb
find the module Driver and add the following lines
autoload :Version_5_0, File.expand_path("../driver/version_5_0", FILE)
autoload :Version_5_1, File.expand_path("../driver/version_5_0", FILE)

  1. Enjoy.

@antmerlino
Copy link

@ricardowong Thanks for your guide, it definitely works well. I would suggest people to not install vagrant from the package manager but rather from vagrant using wget and dpkg -i
The package manager has a pretty outdated version of vagrant.

I'm having an issue running vagrant up with this setup. Vagrant invokes the VBoxManage import command. The problem is that the path is for inside of WSL, not windows. VBoxManage tries to prepend D:\ (at least for me) which means the command fails because that path does not exist. Does this mean that we can only use vagrant inside of WSL only after provisioning boxes?

@odannyc
Copy link

odannyc commented Feb 11, 2017

@ricardowong @antmerlino

Same thing happens for me. This is the exact error when I run vagrant up:

There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["import", "-n", "/home/odannyc/.vagrant.d/boxes/scotch-VAGRANTSLASH-box/2.5/virtualbox/box.ovf"]

Stderr: 0%...
Progress state: VBOX_E_IPRT_ERROR
VBoxManage.exe: error: Appliance read failed
VBoxManage.exe: error: Failed to open OVF file 'D:\home\odannyc\.vagrant.d\boxes\scotch-VAGRANTSLASH-box\2.5\virtualbox\box.ovf' (VERR_PATH_NOT_FOUND)
VBoxManage.exe: error: Details: code VBOX_E_IPRT_ERROR (0x80bb0005), component ApplianceWrap, interface IAppliance
VBoxManage.exe: error: Context: "enum RTEXITCODE __cdecl handleImportAppliance(struct HandlerArg *)" at line 307 of file VBoxManageAppliance.cpp

any fixes or workarounds anyone can think of?

@odannyc
Copy link

odannyc commented Feb 11, 2017

Actually, putting my home folder in the D:\ drive and symlinking my home folder in ubuntu to the D mount might just work, testing...

EDIT: Didn't work

Results:

Stderr: VBoxManage.exe: error: Shared folder path '/mnt/d/home/odannyc/foo' is not absolute

Looks like VBoxManage is trying to open the mount on the WSL structure

@matbrgz
Copy link

matbrgz commented Jun 12, 2017

@odannyc same error here. did you discover a solution?

as we could see VBoxManager is trying to open the same folder as $PATH instead of Linux.

_____ UPDATE ___

Just update via wget and dkpg -i [...] vagrant to 1.9.5 use the comand export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1" than run vagrant

@marcvroom
Copy link

@MatheusRV the fix you did doesn't seem to fix mine. Did the export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1" then vagrant up but same error is showing.

@matbrgz
Copy link

matbrgz commented Jun 20, 2017

@marcvroom hello, did you updated your vagrant?
Which version is your WSL version, your vagrant, and VirtualBox?

@marcvroom
Copy link

Hi @MatheusRV, my vagrant is 1.9.5 and my WSL version is 16.04(this is the ubuntu version, right?) and my VirtualBox is 5.1.22. I think all is updated.

@vzezzos
Copy link

vzezzos commented Jul 29, 2017

@odannyc Same issue here

@hafah
Copy link

hafah commented Mar 12, 2018

@marcvroom @vzezzos

Probably vagrant is trying to use ubuntu's virtualbox. Maybe this will fix it.

export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
sudo apt-get purge virtualbox
sudo apt-get remove virtualbox-dkms

Also your VagrantFile might need this

v.customize ["modifyvm", :id, "--uartmode1", "disconnected"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests