Moving files between host and guest using the Vagrant implemetation

I am endeavouring to configure and test Bahmni using the Vagrant implementation on a Windows server host. It seems that much of the configuration work with Bahmni requires the editing of json files in the guest machine with vi. It would be far less error prone if I were able to do this in the host using using say notepad++ and then deposit the jso in the right bamni directory/folder.

The vagrantfile declarations for folder syncing are as distributed, but I do not seem able to get files to move between the declared directories. I guess i am missing some vital step eg mount?

Can anyone advise?

For this you may follow instructions given here to create soft link-

Hello @mafrica

I would recommend watching this video where Bindu shows how you can link the files and then modify them on your host system – and changes automatically reflect inside the Vagrant (guest) box.

Thanks for the help. I have watched video and read the wiki. However it seems that the configuration of the Vagrant Box that I downloaded must be different in some way from that described in the video.

At the point in the console output where the mount takes place an error is thrown and the shared folder listing does not show. Below is the console output. I followed the advice on the wiki tips page to install Guest additions which also throws an error which I have reproduced at the foot of this reply together with a copy of my vagrantfile:

c:\Bahmni\bahmni-vagrant>vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'bahmni-team/bahmni' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: bridged
==> default: Forwarding ports...
    default: 8080 (guest) => 8081 (host) (adapter 1)
    default: 443 (guest) => 8082 (host) (adapter 1)
    default: 80 (guest) => 8083 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address:
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Configuring and enabling network interfaces...
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

# Down the interface before munging the config file. This might
# fail if the interface is not actually set up yet so ignore
# errors.
/sbin/ifdown 'eth1'
# Move new config into place
mv -f '/tmp/vagrant-network-entry-eth1-1493025933-0' '/etc/sysconfig/network-scripts/ifcfg-eth1'
# attempt to force network manager to reload configurations
nmcli c reload || true

# Restart network
service network restart

Stdout from the command:

Shutting down interface eth0:  [  OK  ]
Shutting down loopback interface:  [  OK  ]
Bringing up loopback interface:  [  OK  ]
Bringing up interface eth0:
Determining IP information for eth0... done.
[  OK  ]
Bringing up interface eth1:
Determining IP information for eth1... done.
[  OK  ]
Bringing up interface eth2:  Device eth2 does not seem to be present, delaying initialization.

Stderr from the command:

bash: line 11: nmcli: command not found

[vagrant@localhost /]$ sudo /etc/init.d/vboxadd setup Building Guest Additions kernel modules. You should restart your guest to make sure the new modules are actually used. Starting the VirtualBox Guest Additions.

Could not find the X.Org or XFree86 Window System, skipping.
[vagrant@localhost /]$

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure(2) do |config|
# Paul Chinn
# For public_network forwarded_port from the static ip of the server :forwarded_port, guest: 8080, host: 8081, host_ip: "" :forwarded_port, guest: 443, host: 8082, host_ip: "" :forwarded_port, guest: 80, host: 8083, host_ip: "" "public_network"
# Paul Chinn end = "bahmni-team/bahmni"
  config.vm.box_check_update = true
  config.ssh.insert_key = false
# Paul Chinn commented out "private_network",ip: ""
  config.vm.synced_folder "..", "/bahmni", :owner => "vagrant"
# Paul Chinn increased memory fro 3092 to 4096
  config.vm.provider "virtualbox" do |v|
     v.customize ["modifyvm", :id, "--memory", 4096, "--cpus", 2, "--name", "Bahmni-RPM"]

Hello @mafrica, Were you able to resolve the issue?

I still have the problem and I am afraid I have run out of ideas. Help would be much appreciated.

Hi @mafrica,

From the above log I can say that its not the issue with Guest machine setup but its the issue with network interfaces. Did you try this workaround in the same vagrant tips wiki page. If not can you try now and let us know if the issue still persist.

Many thanks you have solved it. A couple of comments for the future from a relatively low skilled implementer:

  1. I had assumed the network errors were a norm as my network stuff seemed to be OK and the vagrant box was pretty much straight “out of the box”.
  2. The first line of the tip errors with message: [vagrant@localhost /]$ sudo rm -f /etc/udev/rules.d/70-persistent-net.rules rm: cannot remove `/etc/udev/rules.d/70-persistent-net.rules’: Is a directory
  3. The following error also occurs during vagrant up: C:/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.9.3/lib/vagrant/action/builtin/mixin_synced_folders.rb:100:in `initialize’: Permission denied @ rb_sysopen - c:/Bahmni/bahmni-vagrant/.vagrant/machines/default/virtualbox/synced_folders (Errno::EACCES)

However the folders bahmni and bahmni- vagrant appear to be synced

Thanks again

Hi @mafrica, Good to hear that the issue got solved. Thanks for the comments.