<p>One possible but kind of ugly and very brittle workaround could be to use winrm to launch the vagrant commands on windows from linux 'remotely'.</p>

<p>This need a networking setup for the VM so it can talk to the host through tcp/ip (configuration done on the virtualization you use), <a href="https://github.com/diyan/pywinrm#enabling-winrm-on-remote-host" rel="nofollow noreferrer">configuring winrm</a> on the windows host (if your company allows it) and then using something like <a href="https://github.com/diyan/pywinrm" rel="nofollow noreferrer">pywinrm</a> (first found with a quick search) or any other tool in your language of choice.</p>

CC BY-SA 3.0
2018-01-05T08:34:52.943Z
2018-01-05T08:34:52.943Z
Tensibai
<p>Is the answer as simple as setting up a dual-booted machine? Linux partitions for development tasks and as the VM host, Windows partitions for normal computing use.</p>

<ul>
<li>Laptop

<ul>
<li>Windows partition</li>
<li>Linux Partition

<ul>
<li>Vagrant VM</li>
</ul></li>
</ul></li>
</ul>

CC BY-SA 3.0
2017-12-05T18:05:39.437Z
Thanks for the suggestion, but that is not possible.
AnoE
CC BY-SA 3.0
2017-12-05T17:33:36.927Z
2017-12-05T17:33:36.927Z
HaydenFromIT
<p>I also wish to know this answer. Did you come up with anything yet? The only way I can think of is to install/create a proxy like service on the host that exposes the virtualbox/vmware command line for vagrant to use.  Might also be possible for a small service on the host that listens/reads from a socket/file for incoming commands while the vm writes the commands to the socket/file.  This socket/file would be in the shared directory.  You would probably need 2 sockets (one for read, one for write). This could be turned into a vagrant plugin that would initially extend virtualbox plugin.</p>

<p>I am literally just spitballing here though.   You probably can't stand up adhoc tcp servcies on you laptop but you might be able to get by with  a socket/file based mechanism.</p>

CC BY-SA 4.0
2019-04-06T11:11:36.253Z
No, I did not... although I did not look into it anymore either.
AnoE
CC BY-SA 4.0
2019-04-05T16:36:16.380Z
2019-04-05T16:36:16.380Z
Corey Osman
<h1>Background</h1>

<p>I have an application which comes with a Vagrant setup that is designed for this usage scenario:</p>

<pre><code>Laptop (Windows, Virtualbox host) =&gt; edit source code
+----&gt; Vagrant VM (Linux) =&gt; build and run
</code></pre>

<p>Plain, default, simple, works. The sources are on a shared/synced directory, i.e., they are usually edited on the Windows host and then compiled and ran inside the VM.</p>

<p>Unfortunately, I prefer to use Linux development tools myself. Right now, I have this setup:</p>

<pre><code>Laptop (Windows)
+----&gt; Vagrant VM
+----&gt; My personal VM (Linux, non-vagrant)
</code></pre>

<p>So my editor etc. run in the personal VM, and I have a common directory shared through Virtualbox. Again, everything works just fine. </p>

<p>Here is the problem: </p>

<p>To control the vagrant stuff, I need to enter the <code>vagrant</code> commands in the Windows shell, which is slowing me down. For example, to run the build inside the vagrant VM, I would prefer to use a hotkey in my editor to start <code>vagrant ssh build.sh</code> instead of switching to the CMD.EXE and entering that command. Unneccessary context switch.</p>

<h1>Question</h1>

<p>I don't wish to open the can of worms that is "virtualization inside virtualization" (i.e., I won't run Linux Virtualbox inside a Windows-hosted VM); so this keeps me with these two alternatives:</p>

<p>Is there a way to control the "Windows-Vagrant" that is running on the Windows host from inside a Linux VM (which itself is not under Vagrant control), i.e., to use <code>vagrant up</code> or <code>vagrant ssh</code>?</p>

<p>Alternatively, is it possible to install "Linux-Vagrant" in my existing VM right away (i.e. the Debian version) and have it create its VM in the <em>Windows</em> host?</p>

<p>Or is there a completely different way to solve this problem in an elegant fashion?</p>

CC BY-SA 3.0
2018-01-04T20:42:08.233Z
Why do you need this setup? Do you use the right tool for the job?
030
CC BY-SA 3.0
2018-01-04T21:16:00.110Z
@030, I must use a Windows laptop issued by my company. But as mentioned in the question, I much prefer a Linux environment for development work. Hence I usually develop in a Linux VM, with a tight workflow (Emacs etc., lots of hotkeys for starting compilations etc.).
AnoE
CC BY-SA 3.0
2018-01-04T21:38:46.327Z
`The actual source files are on a NTFS directory`. Why? What VCS is used in the company?
030
CC BY-SA 3.0
2018-01-04T22:03:10.330Z
It is not about the VCS, but about using Vagrant here. Vagrant is running on the host OS (Windows), and the question is about trying to control Vagrant from inside the VM (to be able to do quick keyboard-based `vagrant up` etc. from my editor inside the Linux VM instead of switching back to a Windows `cmd` shell all the time. This point actually is not of importance for the question, I have removed it.
AnoE
<vagrant><virtualbox>
Vagrant inside a VM to control the VM host
AnoE
# Vagrant inside a VM to control the VM host

(Asked by: username_0 on 2017-12-04)

Background
I have an application which comes with a Vagrant setup that is designed for this usage scenario:
Laptop (Windows, Virtualbox host) => edit source code
+----> Vagrant VM (Linux) => build and run

Plain, default, simple, works. The sources are on a shared/synced directory, i.e., they are usually edited on the Windows host and then compiled and ran inside the VM.
Unfortunately, I prefer to use Linux development tools myself. Right now, I have this setup:
Laptop (Windows)
+----> Vagrant VM
+----> My personal VM (Linux, non-vagrant)

So my editor etc. run in the personal VM, and I have a common directory shared through Virtualbox. Again, everything works just fine. 
Here is the problem: 
To control the vagrant stuff, I need to enter the vagrant commands in the Windows shell, which is slowing me down. For example, to run the build inside the vagrant VM, I would prefer to use a hotkey in my editor to start vagrant ssh build.sh instead of switching to the CMD.EXE and entering that command. Unneccessary context switch.
Question
I don't wish to open the can of worms that is "virtualization inside virtualization" (i.e., I won't run Linux Virtualbox inside a Windows-hosted VM); so this keeps me with these two alternatives:
Is there a way to control the "Windows-Vagrant" that is running on the Windows host from inside a Linux VM (which itself is not under Vagrant control), i.e., to use vagrant up or vagrant ssh?
Alternatively, is it possible to install "Linux-Vagrant" in my existing VM right away (i.e. the Debian version) and have it create its VM in the Windows host?
Or is there a completely different way to solve this problem in an elegant fashion?

**Tags:** vagrant, virtualbox

> **Comments:**
> **username_1**: Why do you need this setup? Do you use the right tool for the job?  
> **username_0**: @username_1, I must use a Windows laptop issued by my company. But as mentioned in the question, I much prefer a Linux environment for development work. Hence I usually develop in a Linux VM, with a tight workflow (Emacs etc., lots of hotkeys for starting compilations etc.).  
> **username_1**: `The actual source files are on a NTFS directory`. Why? What VCS is used in the company?  
> **username_0**: It is not about the VCS, but about using Vagrant here. Vagrant is running on the host OS (Windows), and the question is about trying to control Vagrant from inside the VM (to be able to do quick keyboard-based `vagrant up` etc. from my editor inside the Linux VM instead of switching back to a Windows `cmd` shell all the time. This point actually is not of importance for the question, I have removed it.  

---

## 3 answers

### Answer by username_2 on 2018-01-05. Score: 1

One possible but kind of ugly and very brittle workaround could be to use winrm to launch the vagrant commands on windows from linux 'remotely'.

This need a networking setup for the VM so it can talk to the host through tcp/ip (configuration done on the virtualization you use), [configuring winrm](https://github.com/diyan/pywinrm#enabling-winrm-on-remote-host) on the windows host (if your company allows it) and then using something like [pywinrm](https://github.com/diyan/pywinrm) (first found with a quick search) or any other tool in your language of choice.


---

### Answer by username_3 on 2017-12-05. Score: 1

Is the answer as simple as setting up a dual-booted machine? Linux partitions for development tasks and as the VM host, Windows partitions for normal computing use.

* Laptop
  + Windows partition
  + Linux Partition
    - Vagrant VM

> **Comments:**
> **username_0**: Thanks for the suggestion, but that is not possible.  

---

### Answer by username_4 on 2019-04-05. Score: 0

I also wish to know this answer. Did you come up with anything yet? The only way I can think of is to install/create a proxy like service on the host that exposes the virtualbox/vmware command line for vagrant to use. Might also be possible for a small service on the host that listens/reads from a socket/file for incoming commands while the vm writes the commands to the socket/file. This socket/file would be in the shared directory. You would probably need 2 sockets (one for read, one for write). This could be turned into a vagrant plugin that would initially extend virtualbox plugin.

I am literally just spitballing here though. You probably can't stand up adhoc tcp servcies on you laptop but you might be able to get by with a socket/file based mechanism.

> **Comments:**
> **username_0**: No, I did not... although I did not look into it anymore either.  

---

