UtahDave / salt-vagrant-demo

Demo of Salt in Vagrant. 1 master and 2 minions
Apache License 2.0
247 stars 192 forks source link

Can't provision the vagrant images #49

Closed ice3 closed 4 years ago

ice3 commented 4 years ago

Hello,

Thanks for the scripts :) There is an issue with the provisioning, on a fresh install.

salt-vagrant-demo:master ✓ ➭ vagrant up --provision
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Checking if box 'bento/ubuntu-18.04' version '201912.14.0' is up to date...
==> master: Running provisioner: salt...
Copying salt master config to vm.
Uploading minion keys.
Uploading master keys.
Checking if salt-master is installed
salt-master was not found.
Using Bootstrap Options: -P -c /tmp -F -c /tmp -k /tmp/minion-seed-keys -M -N stable
Bootstrapping Salt... (this may take a while)
bash: /tmp/bootstrap_salt.sh: /usr/bin/sh: bad interpreter: No such file or directory
The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

/tmp/bootstrap_salt.sh -P -c /tmp -F -c /tmp -k /tmp/minion-seed-keys -M -N stable

Stdout from the command:

Stderr from the command:

bash: /tmp/bootstrap_salt.sh: /usr/bin/sh: bad interpreter: No such file or directory

The salt provisioning seems to use /usr/bin/sh as a shell which doesn't exists on the machine.

I could run the provisioning adding this shell provisioning before the salt one.

    master_config.vm.provision "shell",
      inline: "ln -sf /bin/sh /usr/bin/sh"

The issue is with the bootstrap_salt for me, but it is fixable on the provisioning script.

UtahDave commented 4 years ago

vagrant up just worked for me.

here's the first line of the bootstrap_salt.sh file on my minion1:

vagrant@minion1:~$ head -n 1 /tmp/bootstrap_salt.sh
#!/bin/sh -

What's the output of the following?

vagrant version
UtahDave commented 4 years ago

@ice3 have you made any changes to your checkout of the repo?

ice3 commented 4 years ago

Hello,

I use Fedora 30

cat /etc/fedora-release
Fedora release 30 (Thirty)

I installed vagrant with the package manager :

dnf history userinstalled | grep vagrant
vagrant-2.2.5-1.fc30.noarch

Vagrant is version 2.2.5

 vagrant version 
Installed Version: 2.2.5

Vagrant was unable to check for the latest version of Vagrant.
Please check manually at https://www.vagrantup.com

The head of the bootstrap is :

head -n 1 /tmp/bootstrap_salt.sh
#!/usr/bin/sh -

I didn't change anything on the repo when the issue appeared, then I added the fix to make it work.

valentinesd commented 4 years ago

I had the same issue on Fedora 31 with vagrant 2.2.6 from the Fedora repositories and VirtualBox from the rpmfusion repositories

I installed vagrant 2.2.7 rpm from the vagrant site which worked fine.

UtahDave commented 4 years ago

OK, so it sounds like there was an issue with vagrant 2.2.6 as packaged by Fedora and the current fix is to install the latest vagrant directly from the Vagrant website.

Thanks, @valentinesd

I don't use Fedora. If a Fedora user has a better way to resolve this, please comment here and I'll reopen.

Thanks!

Keij0 commented 4 years ago

Why does that script have /usr/bin/sh? I don't think 18.04 implemented usrmerge and I ran into the same issue today. When I ssh'd into the master and executed "which sh" it returned /bin/sh instead of /usr/bin/sh @UtahDave