bosh-lite vagrant up fails with no error - vagrant

I am trying to setup a local cloud foundry instance using bosh-lite on my mac osx laptop V 10.9.4.
sh-3.2# vagrant -v
Vagrant 1.7.1
sh-3.2#
I unzipped the contents of bosh-lite-master
ran the following command
see below
sh-3.2#vagrant up --provider=virtualbox
Error Message I got
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'cloudfoundry/bosh-lite' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: 2776
The box 'cloudfoundry/bosh-lite' could not be found or
could not be accessed in the remote catalog. If this is a private
box on HashiCorp's Atlas, please verify you're logged in via
`vagrant login`. Also, please double-check the name. The expanded
URL and error message are shown below:
URL: ["https://atlas.hashicorp.com/cloudfoundry/bosh-lite"]
Error:
sh-3.2#
The error part is empty and I am completely clue less as this is the first time I am working with vagrant
Content of the vagrant file
Vagrant.configure('2') do |config|
config.vm.box = 'cloudfoundry/bosh-lite'
config.vm.box_version = '2776'
config.vm.provider :virtualbox do |v, override|
# To use a different IP address for the bosh-lite director, uncomment this line:
# override.vm.network :private_network, ip: '192.168.59.4', id: :local
end
[:vmware_fusion, :vmware_desktop, :vmware_workstation].each do |provider|
config.vm.provider provider do |v, override|
# To use a different IP address for the bosh-lite director, uncomment this line:
# override.vm.network :private_network, ip: '192.168.54.4', id: :local
override.vm.box_version = '388'
end
end
config.vm.provider :aws do |v, override|
# To turn off public IP echoing, uncomment this line:
# override.vm.provision :shell, id: "public_ip", run: "always", inline: "/bin/true"
# To turn off CF port forwarding, uncomment this line:
# override.vm.provision :shell, id: "port_forwarding", run: "always", inline: "/bin/true"
end
end

Please read https://github.com/mitchellh/vagrant/issues/3589
commenting out this block from /opt/vagrant/embedded/gems/gems/vagrant-1.7.1/lib/vagrant/util/subprocess.rb made it work like a charm
if #command[0].downcase.include?(installer_dir)
#logger.info("Command in the installer. Specifying DYLD_LIBRARY_PATH...")
process.environment["DYLD_LIBRARY_PATH"] =
"#{installer_dir}/lib:#{ENV["DYLD_LIBRARY_PATH"]}"
#logger.info("process.environment")
#logger.info(process.environment["DYLD_LIBRARY_PATH"])
#logger.info("end process.environment")
else
#logger.debug("Command not in installer, not touching env vars.")
end

Related

Vagrantbox with Hyper-V not starting

I'm trying to setup a vagrantbox with Hyper-V on my local windows-10 mashine. My Workstation is running behind a proxy, but I configured a local cntlm proxy to get around these limitations. Proxy settings work fine since I was able to install a vagrant plugin and downloan a box image.
But now my guest linux does not start up and I am running out of ideas.
My vagrant file
Vagrant.configure("2") do |config|
config.vm.box = "bento/ubuntu-18.04" # ubuntu 18.04 image with support for virtual box and Hyper-V
config.vm.hostname = "skywalker"
config.vm.provider "virtualbox" do |vb|
vb.memory = "2048"
end
config.vm.provider "hyperv" do |hv|
hv.memory = "2048"
end
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'" # prevent tty errors
# install the vagrant plugin "vagrant-cachier" to cache downloaded artifacts
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
# vagrant behing local cntlm proxy if plugin exists (= provinzial win10 workstation)
if !Vagrant.has_plugin?("vagrant-proxyconf")
config.proxy.http = "http://localhost:3128/"
config.proxy.https = "http://localhost:3128/"
config.proxy.no_proxy = "localhost, 127.0.0.1"
end
# --------------------------------------------------------------------------
# provision virtual mashine (basic setup) and install applications in VM
#config.vm.provision "shell", path: "scripts/install-ansible.sh"
config.vm.provision "shell", path: "scripts/install-ncdu.sh"
config.vm.provision "shell", path: "scripts/install-git.sh"
config.vm.provision "shell", path: "scripts/install-openjdk-11.sh"
config.vm.provision "shell", path: "scripts/install-maven.sh"
config.vm.provision "shell", path: "scripts/install-node-npm.sh"
config.vm.provision "shell", path: "scripts/install-docker.sh"
config.vm.provision "shell", path: "scripts/install-docker-compose.sh"
# npm webserver
config.vm.provision "shell", path: "apps/install-npm-apps.sh"
config.vm.network "forwarded_port", guest: 8000, host: 8000
# artifactory setup (start artifactory after vm startup)
config.vm.network "forwarded_port", guest: 8081, host: 8081 # artifactory from docker
config.vm.network "forwarded_port", guest: 8082, host: 8082 # artifactory from docker
# See README.md for Artifactory in Docker
end
Starting the box with this settings results in
C:\home\work\workspace\vagrant-boxes\skywalker (master -> origin)
λ vagrant up
Bringing machine 'default' up with 'hyperv' provider...
==> default: Verifying Hyper-V is enabled...
==> default: Verifying Hyper-V is accessible...
==> default: Importing a Hyper-V instance
default: Creating and registering the VM...
default: Successfully imported VM
default: Configuring the VM...
==> default: Starting the machine...
==> default: Waiting for the machine to report its IP address...
default: Timeout: 120 seconds
default: IP: fe80::215:5dff:fe02:8b01
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: fe80::215:5dff:fe02:8b01:22
default: SSH username: vagrant
default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.
If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.
If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.
If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.
On a different mashine with VirtualBox as VM provider this Vagrantfile works fine. Sadly I cannot use any VM provider other than Hyper-V on my windows mashine due to limitations which are out of my control ...
I set up Hyper-V using Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All.
Any ideas? Thanks in advance and best regards. Sebastian
I went through this exercise last week and saw similar problems. I made lot of progress following these steps and the vm's get spun up at a reasonable time under windows 10 hyper-v. This is what i did.
Followed this blog and tried creating a vm successfully first.
https://win32.io/posts/Vagrant-Install-HyperV
Then i created a simple vagrantfile and got it to work successfully. Here is mine ,
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/bionic64"
config.vm.hostname = 'utility-server-1'
config.vm.network 'public_network', bridge: 'Internet'
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.provider "hyperv" do |vb|
vb.memory = "4024"
vb.cpus = 2
vb.vmname = 'utility-server-1'
end
end
Once this works, add more complex steps from your vagrantfile, like shell scripts and forwarded ports.

Vagrant Vagrantfile config

I have this vagranfile for box "centos/7"
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.synced_folder ".", "/home/vagrant"
config.vm.provision "shell", path: "./conf/bitrix-env.sh"
config.vm.boot_timeout = 100
config.vm.provider :virtualbox do |vb|
vb.gui = true
vb.memory = "1024"
end
end
vagrant up - command works clear, but scripts in provision don't install
after i tried to start vagrant provision, but had an error:
SSH is getting permission denied errors when attempting to connect
to the IP for SSH. This is usually caused by network rules and not being
able to connect to the specified IP. Please try changing the IP on
which the guest machine binds to for SSH.
How can i fix this and install all provisions?
The problem is due to the below line in your vagrantfile
config.vm.synced_folder '.', '/home/vagrant'
The authorized_keys file for the vagrant user is located in /home/vagrant/.ssh inside the vagrant machine, which enables to ssh into the vagrant box.
As you are mounting your current directory to /home/vagrant, all the contents of /home/vagrant are over-written and there is no authorized key file.
Change the mount path to anything except /home/vagrant, and you will able to ssh into the machine. As example
config.vm.synced_folder '.', '/home/vagrant/somepath'

I am trying to setup the vagrant environment but this error occurs default: VM not created. Moving on

I am working on to setup the vagrant environment on the mac. I have done the following steps.
Installed the virtualbox
Clone my project to local disk
Downloaded the box and added the box successfully
I have also edit the vagrant file and add the name of box to the vagrant file.
Now when i run the command "vagrant provision" this error occurs
default: VM not created. Moving on...
I have google it a lot but no idea that what to do.
sudo vagrant box list
Result:
bpc_box (virtualbox, 0)
new_box (virtualbox, 0)
Vagrant file
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "bpc_box"
config.vm.synced_folder "workspace/", "/vagrant"
config.vm.network "forwarded_port", guest: 8080, host: 8085
config.vm.network "forwarded_port", guest: 80, host: 8090
config.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 2048
end
config.vm.provider "parallels" do |prl|
prl.cpus = 2
prl.memory = 2048
end
config.ssh.forward_agent = true
config.vm.provision "ansible" do |ansible|
ansible.playbook = "provisioning/main.yml"
end
end
You need to spin the VM first, the first command to run is
$ vagrant up
this will bring your VM up and provision it if this is the first time this particular VM has been started.
once the VM is up and running you can run vagrant provision to force the (re)provisioning of the running VM.
You can read more about vagrant cli option at https://www.vagrantup.com/docs/cli/

Access django server in vagrant virtualbox on host machine?

I am using windows and putty to ssh to vagrant virtualbox.I cannot access the django server running in vagrant virtualbox using http://localhost:9991
I have disabled my firewall as well
here's my vagrant file:
VAGRANTFILE_API_VERSION = "2"
def command?(name)
`which #{name}`
$?.success?
end
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# For LXC. VirtualBox hosts use a different box, described below.
config.vm.box = "fgrehm/trusty64-lxc"
# The Zulip development environment runs on 9991 on the guest.
config.vm.network "forwarded_port", guest: 9991, host: 9991, host_ip: "127.0.0.1"
config.vm.synced_folder ".", "/vagrant", disabled: true
config.vm.synced_folder ".", "/srv/zulip"
# Specify LXC provider before VirtualBox provider so it's preferred.
config.vm.provider "lxc" do |lxc|
if command? "lxc-ls"
LXC_VERSION = `lxc-ls --version`.strip unless defined? LXC_VERSION
if LXC_VERSION >= "1.1.0"
# Allow start without AppArmor, otherwise Box will not Start on Ubuntu 14.10
# see https://github.com/fgrehm/vagrant-lxc/issues/333
lxc.customize 'aa_allow_incomplete', 1
end
end
end
config.vm.provider "virtualbox" do |vb, override|
override.vm.box = "ubuntu/trusty64"
# 2GiB seemed reasonable here. The VM OOMs with only 1024MiB.
vb.memory = 2048
end
$provision_script = <<SCRIPT
set -x
set -e
sudo apt-get update
sudo apt-get install -y python-pbs
/usr/bin/python /srv/zulip/provision.py
SCRIPT
config.vm.provision "shell",
# We want provision.py to be run with the permissions of the vagrant user.
privileged: false,
inline: $provision_script
end
How do i access the server from host(Windows)?
I would suggest (on the Guest):
sudo netstat -lnutp
and having a look at what ports are open, and the process which owns them. If the one you want is missing, make sure the service which is responsible for it has been started, or start it yourself. From the looks of your Vagrantfile, this would be the "Zulip development environment".

Failing to create SMB shared folder using Vagrant on Windows host with linux guest

I'm using Vagrant to create an Ubuntu 14.04 guest on my Windows 7 SP 1 PC. This has been working ok, but the performance of the guest is poor when accessing files that have been synchronized from the host. After doing some reading, I'm trying to make the synchronized folder an SMB share, however this is failing when I run 'vagrant up'
Note that I've upgraded to powershell 3.0, as documented in https://docs.vagrantup.com/v2/synced-folders/smb.html. I've also ensured that my guest has cifs-util installed as pointed out in https://github.com/mitchellh/vagrant/issues/4642. I'm using Vagrant 1.7.4 and VirtualBox 4.3.28
My Vagrantfile looks like this:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "npt"
config.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpuexecutioncap", "90"]
v.customize ["modifyvm", :id, "--memory", "4096"]
v.customize ["modifyvm", :id, "--cpus", 2]
end
config.vm.synced_folder "\\", "/npt_root", type: "smb"
config.vm.provision :shell do |shell|
shell.inline = "puppet module install puppetlabs/vcsrepo --force"
end
config.vm.provision "puppet" do |puppet|
puppet.manifests_path = "puppet"
puppet.manifest_file = "basic_build_reqs.pp"
end
config.ssh.username = 'root'
config.ssh.password = 'vagrant'
config.ssh.insert_key = 'true'
end
And the output I am seeing is:
Z:\npt\vagrant>vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'npt'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vagrant_default_1442502969737_66801
==> default: Preparing SMB shared folders...
default: You will be asked for the username and password to use for the SMB
default: folders shortly. Please use the proper username/password of your
default: Windows account.
default:
default: Username: tdj#DCL
default: Password (will be hidden):
Exporting an SMB share failed! Details about the failure are shown
below. Please inspect the error message and correct any problems.
Host path: Z:/
Stderr: System error 123 has occurred.
The filename, directory name, or volume label syntax is incorrect.
Error:
Stdout:
It looks like Vagrant has interpreted the relative path "\" I've given it and is coming up with "Z:/", with unix style slashes, which Windows is then failing to parse.
Note that I've tried replacing the relative path with the absolute path "Z:\", but I still see the same output on the "Host path" line
I suspect "\\" is the problem in the following line:
config.vm.synced_folder "\\", "/npt_root", type: "smb"
Could you try to put in a concrete foldername that you would like to share with your VM and test if it works?

Resources