Vagrantfile configuration packaged with a box is not used in the vm

774 views
Skip to first unread message

Philip Rodrigues

unread,
Jul 18, 2013, 10:07:52 PM7/18/13
to vagra...@googlegroups.com
Hi all. 

When I package a box to include the Vagrantfile (and an other file) with: 
vagrant package --vagrantfile Vagrantfile --include bootstrap.sh
I see in the loglines that the two files are included. 
But when I add the package by: 

> vagrant box add "devbox" package.box

Create a new folder and do: 

> vagrant init "devbox" 
> vagrant up

The box starts with the settings in the box package not read and the bootstrap.sh file not deployed in the vm folder. 


Is there another step I need to take here? 

Version of Vagrant is 1.2.3, OS is Ubuntu 13.04 64-bits (updated to current)  

Cheers Philip 

Fábio Rehm

unread,
Jul 19, 2013, 12:31:18 PM7/19/13
to vagra...@googlegroups.com
Hey Philip,

When you say that the file has not been deployed you mean you don't see the file on the guest VM or it is not present on the corresponding `~/.vagrant.d/boxes` folder?
Would you be able to gist the Vagrantfile you are using?

Philip Rodrigues

unread,
Jul 19, 2013, 5:37:25 PM7/19/13
to vagra...@googlegroups.com
Hi Fabio thanks for your reply, 

Both, however the main issue I have is that the settings I have set in the Vagrantfile for that box do not show in the VM (For instance the setting to use the gui is not set) I can set it in the Vagrantfile that is created in the folder after an init, but that defies the purpose of creating the box with minimum tweaking by the users. :) 

When creating the package, the log tells me that they have added the two files (bootstrap.sh and Vagrantfile) to the package, so it would appear the package does have the two files, so what do I do to actually get them deployed? 

Philip Rodrigues

unread,
Aug 1, 2013, 9:25:59 PM8/1/13
to vagra...@googlegroups.com
No one else has this issue ?

José Pedro Correia

unread,
Aug 23, 2013, 5:58:36 AM8/23/13
to vagra...@googlegroups.com
Hi all,

I have a similar problem. I am trying to package a base box to be reused by other environments. My Vagrantfile contains the following line:

  > config.vm.provision :shell, :path => 'initialize-machine.sh'

I package the box using the following command:

  > vagrant package --output=somewhere/base.box --vagrantfile Vagrantfile --include initialize-machine.sh

If I do:

  > mkdir /tmp/box
  > cd /tmp/box
  > vagrant init base somewhere/base.box
  > vagrant up

I get the following output:

  > There are errors in the configuration of this machine. Please fix the following errors and try again:
  > shell provisioner:
  > * `path` for shell provisioner does not exist on the host system: /tmp/box/initialize-machine.sh

So, my Vagrantfile is being processed, but the included file is not properly handled.

I'm running Vagrant 1.2.7 on Scientific Linux 6.1

I'm going to solve this problem by just inlining the shell script, but I would expect this to have worked...

Mauricio O

unread,
May 29, 2014, 5:30:17 PM5/29/14
to vagra...@googlegroups.com
I am running into the same issue

using Vagrant 1.5.4 on OSX

did you have any luck making it work as expected?

José Pedro Correia

unread,
May 30, 2014, 3:58:46 AM5/30/14
to vagra...@googlegroups.com, mauric...@gmail.com
Hi Mauricio,

The inlining "solution" worked for me, so I just stuck with that. Haven't looked into it ever since.

Maurício Otta

unread,
Jul 5, 2014, 8:12:12 PM7/5/14
to vagra...@googlegroups.com, mauric...@gmail.com
Thanks José

here's how I'm doing it:

Vagrant file:
# -*- mode: ruby -*-
# vi: set ft=ruby :
--------------------
Vagrant.configure(2) do |config|
  config.vm.provision :shell, :path => File.expand_path("../bootstrap.sh", __FILE__)
end
--------------------

and for my bootstrap.sh (I'm using archlinux)
--------------------
#!/usr/bin/env bash

pacman -Syy
pacman -S --noconfirm pacman
--------------------(have some extra stuff)

$ vagrant package --base BASE_VM --output BASE_VM.box --include=bootstrap.sh --vagrantfile VagrantFile

when I import/init the VM, those files are created under ~/.vagrant.d/boxes/BASE_VM/0/virtualbox/include/

and vagrant up --provision works as expected (at least for me)

Hope that helps
Mauricio
Reply all
Reply to author
Forward
0 new messages