# Can you run both a .sh file and chef\_solo?

**URL:** <https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533>\
**Category:** Chef Infra (archive)\
**Created:** [October 9, 2013, 4:03pm UTC](https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533 "2013-10-09T16:03:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [October 9, 2013, 4:03pm UTC](https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533/1 "2013-10-09T16:03:54Z")

</div>

I’m guessing the answer is no because that is what I am experiencing, but I  
am trying to do this:

config.vm.provision :shell, :path =\> “[bootstrap.sh](http://bootstrap.sh)”

config.vm.provision :chef\_solo do |chef|  
chef.cookbooks\_path = [“cookbooks”]  
chef.roles\_path = "roles"  
chef.add\_role "base"  
chef.add\_role "webserver"  
end

I am using a bootstrap script for simple thing like:

sudo apt-get update -y && sudo apt-get upgrade -y  
sudo apt-get install -y wget build-essential  
sudo apt-get install -y htop tree  
sudo apt-get install -y apache2-utils sysstat

But it seems the cookbooks part isn’t running, actually when I do run this  
using:

vagrant up

By the end of it, my screen has what looks like chinese script on it and I  
have to close and open a new terminal.

Anyhow, just wondering if you guys run a bootstrap type script before chef  
in your vagrant testing etc.

---

<div class="post-metadata">

**Author:** ![werebus](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/werebus/32/24_2.png) [@werebus](https://discourse.chef.io/u/werebus)\
**Post date:** [October 9, 2013, 4:11pm UTC](https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533/2 "2013-10-09T16:11:29Z")

</div>

You definitely _can_ run more than one provisioner (see “Multiple  
Provisioners” here), and you’re defining them correctly as far as I can  
tell. There must be some other issue. Do you have some output you could  
share?

Matt Moretti

On Wed, Oct 9, 2013 at 12:03 PM, S Ahmed [sahmed1020@gmail.com](mailto:sahmed1020@gmail.com) wrote:

> I'm guessing the answer is no because that is what I am experiencing, but  
> I am trying to do this:
> 
> config.vm.provision :shell, :path =\> "bootstrap.sh"
> 
> config.vm.provision :chef\_solo do |chef|  
> chef.cookbooks\_path = ["cookbooks"]  
> chef.roles\_path = "roles"  
> chef.add\_role "base"  
> chef.add\_role "webserver"  
> end
> 
> I am using a bootstrap script for simple thing like:
> 
> sudo apt-get update -y && sudo apt-get upgrade -y  
> sudo apt-get install -y wget build-essential  
> sudo apt-get install -y htop tree  
> sudo apt-get install -y apache2-utils sysstat
> 
> But it seems the cookbooks part isn't running, actually when I do run this  
> using:
> 
> vagrant up
> 
> By the end of it, my screen has what looks like chinese script on it and I  
> have to close and open a new terminal.
> 
> Anyhow, just wondering if you guys run a bootstrap type script before chef  
> in your vagrant testing etc.

---

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [October 9, 2013, 4:22pm UTC](https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533/3 "2013-10-09T16:22:41Z")

</div>

I'm running this on precise32 (mac osx, vagrant)

This is what happends to my terminl during a 'vagrant up' run, and it seems  
chef doesn't run at all.

> **[ImageShack - Best place for all of your image hosting and image sharing needs](https://imageshack.com/)**
>
> Unlimited space to host images, easy to use image uploader, albums, photo hosting, sharing, dynamic image resizing on web and mobile.

config.vm.provision :shell, :path =\> "bootstrap.sh"

config.vm.provision :chef\_solo do |chef|  
chef.cookbooks\_path = ["cookbooks"]  
chef.add\_recipe "graphite"  
end

bootstrap.sh is:

sudo apt-get update -y && sudo apt-get upgrade -y  
sudo apt-get install -y wget build-essential  
sudo apt-get install -y htop tree  
sudo apt-get install -y apache2-utils sysstat

On Wed, Oct 9, 2013 at 12:11 PM, Matthew Moretti [werebus@gmail.com](mailto:werebus@gmail.com) wrote:

> You definitely _can_ run more than one provisioner (see “Multiple  
> Provisioners” here), and you’re defining them correctly as far as I can  
> tell. There must be some other issue. Do you have some output you could  
> share?
> 
> Matt Moretti
> 
> On Wed, Oct 9, 2013 at 12:03 PM, S Ahmed [sahmed1020@gmail.com](mailto:sahmed1020@gmail.com) wrote:
> 
> > I'm guessing the answer is no because that is what I am experiencing, but  
> > I am trying to do this:
> > 
> > config.vm.provision :shell, :path =\> "bootstrap.sh"
> > 
> > config.vm.provision :chef\_solo do |chef|  
> > chef.cookbooks\_path = ["cookbooks"]  
> > chef.roles\_path = "roles"  
> > chef.add\_role "base"  
> > chef.add\_role "webserver"  
> > end
> > 
> > I am using a bootstrap script for simple thing like:
> > 
> > sudo apt-get update -y && sudo apt-get upgrade -y  
> > sudo apt-get install -y wget build-essential  
> > sudo apt-get install -y htop tree  
> > sudo apt-get install -y apache2-utils sysstat
> > 
> > But it seems the cookbooks part isn't running, actually when I do run  
> > this using:
> > 
> > vagrant up
> > 
> > By the end of it, my screen has what looks like chinese script on it and  
> > I have to close and open a new terminal.
> > 
> > Anyhow, just wondering if you guys run a bootstrap type script before  
> > chef in your vagrant testing etc.

---

<div class="post-metadata">

**Author:** ![werebus](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/werebus/32/24_2.png) [@werebus](https://discourse.chef.io/u/werebus)\
**Post date:** [October 9, 2013, 6:19pm UTC](https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533/4 "2013-10-09T18:19:42Z")

</div>

Interesting. I just tried it out and I got similar results. What appears to  
be happening is that you've encountered two issues. Running apt-get  
upgrade attempts  
to upgrade the package "grub-pc" among others which complains about the  
virtual machine disk's UUID changing for some reason. This complaint does  
two things:

1. Prompts for your input which pauses your shell provisioner
2. Messes up your terminal somehow (perhaps with its pinkness?)

Following advice from  
here[http://serverfault.com/questions/479571/running-apt-get-upgrade-with-chef-solo](http://serverfault.com/questions/479571/running-apt-get-upgrade-with-chef-solo)  
I  
was able to get it to work by replacing the first line of your bootstrap.sh to  
the rather frightening:

sudo apt-get update && sudo DEBIAN\_FRONTEND=noninteractive apt-get -y  
-o Dpkg::Options::="--force-confdef" -o  
Dpkg::Options::="--force-confold" upgrade

But you might consider filing a bug with regard to the console mangling  
with Vagrant.

Matt Moretti

On Wed, Oct 9, 2013 at 12:22 PM, S Ahmed [sahmed1020@gmail.com](mailto:sahmed1020@gmail.com) wrote:

> I'm running this on precise32 (mac osx, vagrant)
> 
> This is what happends to my terminl during a 'vagrant up' run, and it  
> seems chef doesn't run at all.
> 
> [ImageShack - Best place for all of your image hosting and image sharing needs](http://imageshack.us/a/img29/7233/vpea.png)
> 
> config.vm.provision :shell, :path =\> "bootstrap.sh"
> 
> config.vm.provision :chef\_solo do |chef|  
> chef.cookbooks\_path = ["cookbooks"]  
> chef.add\_recipe "graphite"  
> end
> 
> bootstrap.sh is:
> 
> sudo apt-get update -y && sudo apt-get upgrade -y  
> sudo apt-get install -y wget build-essential  
> sudo apt-get install -y htop tree  
> sudo apt-get install -y apache2-utils sysstat
> 
> On Wed, Oct 9, 2013 at 12:11 PM, Matthew Moretti [werebus@gmail.com](mailto:werebus@gmail.com)wrote:
> 
> > You definitely _can_ run more than one provisioner (see “Multiple  
> > Provisioners” here), and you’re defining them correctly as far as I can  
> > tell. There must be some other issue. Do you have some output you could  
> > share?
> > 
> > Matt Moretti
> > 
> > On Wed, Oct 9, 2013 at 12:03 PM, S Ahmed [sahmed1020@gmail.com](mailto:sahmed1020@gmail.com) wrote:
> > 
> > > I'm guessing the answer is no because that is what I am experiencing,  
> > > but I am trying to do this:
> > > 
> > > config.vm.provision :shell, :path =\> "bootstrap.sh"
> > > 
> > > config.vm.provision :chef\_solo do |chef|  
> > > chef.cookbooks\_path = ["cookbooks"]  
> > > chef.roles\_path = "roles"  
> > > chef.add\_role "base"  
> > > chef.add\_role "webserver"  
> > > end
> > > 
> > > I am using a bootstrap script for simple thing like:
> > > 
> > > sudo apt-get update -y && sudo apt-get upgrade -y  
> > > sudo apt-get install -y wget build-essential  
> > > sudo apt-get install -y htop tree  
> > > sudo apt-get install -y apache2-utils sysstat
> > > 
> > > But it seems the cookbooks part isn't running, actually when I do run  
> > > this using:
> > > 
> > > vagrant up
> > > 
> > > By the end of it, my screen has what looks like chinese script on it and  
> > > I have to close and open a new terminal.
> > > 
> > > Anyhow, just wondering if you guys run a bootstrap type script before  
> > > chef in your vagrant testing etc.

---

<div class="post-metadata">

**Author:** ![S\_Ahmed](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.chef.io/s_ahmed/32/289_2.png) [@S\_Ahmed](https://discourse.chef.io/u/S_Ahmed)\
**Post date:** [October 9, 2013, 6:46pm UTC](https://discourse.chef.io/t/can-you-run-both-a-sh-file-and-chef-solo/4533/5 "2013-10-09T18:46:41Z")

</div>

Thanks Matt!

On Wed, Oct 9, 2013 at 2:19 PM, Matthew Moretti [werebus@gmail.com](mailto:werebus@gmail.com) wrote:

> Interesting. I just tried it out and I got similar results. What appears  
> to be happening is that you've encountered two issues. Running apt-get  
> upgrade attempts to upgrade the package "grub-pc" among others which  
> complains about the virtual machine disk's UUID changing for some reason.  
> This complaint does two things:
> 
> 1. Prompts for your input which pauses your shell provisioner
> 2. Messes up your terminal somehow (perhaps with its pinkness?)
> 
> Following advice from here[http://serverfault.com/questions/479571/running-apt-get-upgrade-with-chef-solo](http://serverfault.com/questions/479571/running-apt-get-upgrade-with-chef-solo) I  
> was able to get it to work by replacing the first line of your  
> bootstrap.sh to the rather frightening:
> 
> sudo apt-get update && sudo DEBIAN\_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" upgrade
> 
> But you might consider filing a bug with regard to the console mangling  
> with Vagrant.
> 
> Matt Moretti
> 
> On Wed, Oct 9, 2013 at 12:22 PM, S Ahmed [sahmed1020@gmail.com](mailto:sahmed1020@gmail.com) wrote:
> 
> > I'm running this on precise32 (mac osx, vagrant)
> > 
> > This is what happends to my terminl during a 'vagrant up' run, and it  
> > seems chef doesn't run at all.
> > 
> > [ImageShack - Best place for all of your image hosting and image sharing needs](http://imageshack.us/a/img29/7233/vpea.png)
> > 
> > config.vm.provision :shell, :path =\> "bootstrap.sh"
> > 
> > config.vm.provision :chef\_solo do |chef|  
> > chef.cookbooks\_path = ["cookbooks"]  
> > chef.add\_recipe "graphite"  
> > end
> > 
> > bootstrap.sh is:
> > 
> > sudo apt-get update -y && sudo apt-get upgrade -y  
> > sudo apt-get install -y wget build-essential  
> > sudo apt-get install -y htop tree  
> > sudo apt-get install -y apache2-utils sysstat
> > 
> > On Wed, Oct 9, 2013 at 12:11 PM, Matthew Moretti [werebus@gmail.com](mailto:werebus@gmail.com)wrote:
> > 
> > > You definitely _can_ run more than one provisioner (see “Multiple  
> > > Provisioners” here), and you’re defining them correctly as far as I can  
> > > tell. There must be some other issue. Do you have some output you could  
> > > share?
> > > 
> > > Matt Moretti
> > > 
> > > On Wed, Oct 9, 2013 at 12:03 PM, S Ahmed [sahmed1020@gmail.com](mailto:sahmed1020@gmail.com) wrote:
> > > 
> > > > I'm guessing the answer is no because that is what I am experiencing,  
> > > > but I am trying to do this:
> > > > 
> > > > config.vm.provision :shell, :path =\> "bootstrap.sh"
> > > > 
> > > > config.vm.provision :chef\_solo do |chef|  
> > > > chef.cookbooks\_path = ["cookbooks"]  
> > > > chef.roles\_path = "roles"  
> > > > chef.add\_role "base"  
> > > > chef.add\_role "webserver"  
> > > > end
> > > > 
> > > > I am using a bootstrap script for simple thing like:
> > > > 
> > > > sudo apt-get update -y && sudo apt-get upgrade -y  
> > > > sudo apt-get install -y wget build-essential  
> > > > sudo apt-get install -y htop tree  
> > > > sudo apt-get install -y apache2-utils sysstat
> > > > 
> > > > But it seems the cookbooks part isn't running, actually when I do run  
> > > > this using:
> > > > 
> > > > vagrant up
> > > > 
> > > > By the end of it, my screen has what looks like chinese script on it  
> > > > and I have to close and open a new terminal.
> > > > 
> > > > Anyhow, just wondering if you guys run a bootstrap type script before  
> > > > chef in your vagrant testing etc.
