UtahDave / salt-vagrant-demo

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

Vagrant up results in error #47

Closed najamansari closed 4 years ago

najamansari commented 4 years ago

Hi,

When I run vagrant up, I get the below error(s):

$ git clone https://github.com/UtahDave/salt-vagrant-demo
Cloning into 'salt-vagrant-demo'...
remote: Enumerating objects: 113, done.
remote: Total 113 (delta 0), reused 0 (delta 0), pack-reused 113
Receiving objects: 100% (113/113), 54.90 KiB | 250.00 KiB/s, done.
Resolving deltas: 100% (41/41), done.
$ vagrant up
Bringing machine 'master' up with 'virtualbox' provider...
Bringing machine 'minion1' up with 'virtualbox' provider...
Bringing machine 'minion2' up with 'virtualbox' provider...
==> master: Box 'bento/ubuntu-18.04' could not be found. Attempting to find and install...
    master: Box Provider: virtualbox
    master: Box Version: >= 0
==> master: Loading metadata for box 'bento/ubuntu-18.04'
    master: URL: https://vagrantcloud.com/bento/ubuntu-18.04
==> master: Adding box 'bento/ubuntu-18.04' (v201906.18.0) for provider: virtualbox
    master: Downloading: https://vagrantcloud.com/bento/boxes/ubuntu-18.04/versions/201906.18.0/providers/virtualbox.box
    master: Download redirected to host: vagrantcloud-files-production.s3.amazonaws.com
==> master: Successfully added box 'bento/ubuntu-18.04' (v201906.18.0) for 'virtualbox'!
==> master: Importing base box 'bento/ubuntu-18.04'...
==> master: Matching MAC address for NAT networking...
==> master: Checking if box 'bento/ubuntu-18.04' version '201906.18.0' is up to date...
==> master: Setting the name of the VM: master
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> master: Clearing any previously set network interfaces...
==> master: Preparing network interfaces based on configuration...
    master: Adapter 1: nat
    master: Adapter 2: hostonly
==> master: Forwarding ports...
    master: 22 (guest) => 2222 (host) (adapter 1)
==> master: Running 'pre-boot' VM customizations...
==> master: Booting VM...
==> master: Waiting for machine to boot. This may take a few minutes...
    master: SSH address: 127.0.0.1:2222
    master: SSH username: vagrant
    master: SSH auth method: private key
    master: 
    master: Vagrant insecure key detected. Vagrant will automatically replace
    master: this with a newly generated keypair for better security.
    master: 
    master: Inserting generated public key within guest...
    master: Removing insecure key from the guest if it's present...
    master: Key inserted! Disconnecting and reconnecting using new SSH key...
==> master: Machine booted and ready!
==> master: Checking for guest additions in VM...
==> master: Setting hostname...
==> master: Configuring and enabling network interfaces...
==> master: Mounting shared folders...
    master: /vagrant => /home/saltdemo/salt-vagrant-demo
    master: /srv/salt => /home/saltdemo/salt-vagrant-demo/saltstack/salt
    master: /srv/pillar => /home/saltdemo/salt-vagrant-demo/saltstack/pillar
==> 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
najamansari commented 4 years ago

Consequently when I try to SSH into the master and list salt keys (as part of the Saltstack Fundamentals tutorial), I get this error:

$ vagrant ssh master
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-51-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Tue Sep  3 14:57:44 UTC 2019

  System load:  0.0               Processes:           89
  Usage of /:   2.5% of 61.80GB   Users logged in:     0
  Memory usage: 5%                IP address for eth0: 10.0.2.15
  Swap usage:   0%                IP address for eth1: 192.168.50.10

0 packages can be updated.
0 updates are security updates.

vagrant@saltmaster:~$ sudo su
root@saltmaster:/home/vagrant# salt-key list-all
bash: salt-key: command not found
root@saltmaster:/home/vagrant# 
jehrmi commented 4 years ago

I was able to fix my issue with running vagrant up by running bcdedit /set hypervisorlaunchtype off and rebooting.

UtahDave commented 4 years ago

What's the output of

vagrant version

and

virtualbox --help

@najamansari does @ITSchadenfreude 's fix work for you?

najamansari commented 4 years ago

The bcdedit command isn't available on my system (Fedora 30). Here are the details you requested:

$ 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
$ virtualbox --help
Oracle VM VirtualBox VM Selector v6.0.10_RPMFusion
(C) 2005-2019 Oracle Corporation
All rights reserved.

No special options.

If you are looking for --startvm and related options, you need to use VirtualBoxVM.

Note that I was able to get past this by SSH'ing into the machine and running the command manually:

$ vagrant ssh master
Welcome to Ubuntu 18.04.2 LTS (GNU/Linux 4.15.0-51-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  System information as of Fri Sep  6 11:54:55 UTC 2019

  System load:  0.12              Processes:           91
  Usage of /:   2.5% of 61.80GB   Users logged in:     0
  Memory usage: 5%                IP address for eth0: 10.0.2.15
  Swap usage:   0%                IP address for eth1: 192.168.50.10

0 packages can be updated.
0 updates are security updates.

vagrant@saltmaster:~$ sudo su - -c '/bin/sh /tmp/bootstrap_salt.sh -P -c /tmp -F -c /tmp -k /tmp/minion-seed-keys -M -N stable'
 *  INFO: Running version: 2019.05.20
...
# Installation output stripped
...
 *  INFO: Salt installed!