Closed yasin-amadmia-mck closed 10 years ago
@geek876 Thanks for reporting this issue.
A couple quick questions:
1.6.2 Centos x64, not tried on another version but could try it.
@geek876: I've been trying to replicate this, but the only CentOS 6.2 image I see in LON is for first-gen servers, and vagrant-rackspace 0.1.7 can only boot second-gen ones. Are you sure that's the image you're using? If I use your Vagrantfile
, I launch a CentOS 6.5 box, and it completes without hanging for me. Maybe give a newer CentOS image a shot.
My best guess at the moment is that puppet is installing a newer sshd
rpm, which is killing the ssh connection that Vagrant is using to provision the server. That's just a guess, though. I'll keep looking :mag: :footprints:
I tried it with few other images (centos 5.10, Centos 6.5 and Centos 6.5 PVHVM) and all of them exhibit same behavior. Not sure if it is my connection that is dropping off and causing this issue. I am going to try this from a different connection and see if it improves.
One interesting observation. When I do vagrant up --no-provision and then after the VM is up and running, If i do vagrant provision, it never hangs. It is only when I do provisioning and booting the VM at the same time, it hangs.
This looks related: mitchellh/vagrant#603. If I'm reading it correctly, there's a chance that the root cause is a Net::SSH bug! I also find it interesting that the original poster there was also installing Puppet on a CentOS image.
Did you install Vagrant with one of the installers? Is there a chance that there's an older, gem-installed version of Vagrant hanging around, using an older Ruby? Try running which vagrant
and vagrant --version
to check your Vagrant install.
It would also be helpful if you could post the full output of running Vagrant with debugging mode enabled to a gist.
I'm going to close this now; I suspect it's an upstream problem, and I can't seem to reproduce it myself to be able to track things down. Please re-open if you run into this again and have that debugging output for us!
I was getting a similar problem with (insert any) provisioners when i was installing an app that blew up on installation. My specific case was postgres.
I resolved the issue by putting MUCH more memory on the base instance.
@tacoben that's useful info. Can you share a Vagrantfile that reproduces the problem, and capture vagrant provision --debug
to see if it shows what vagrant is doing when SSH hangs?
We use shell provisioner script to install puppet and some other packages via Yum. We noticing that vagrant is able to create/boot a cloud server correctly, RSYNC is also fine and it is able to launch the shell provisioner script. However, it appeared initially that the provisioner script is hanging. On further investigations we found that the script is actually completing fine on the cloud server but due to some reason, vagrant output (from the script) seems to be hanging and vagrant not returning correctly (error or success).
Our vagrant file is as below
ENV['VAGRANT_DEFAULT_PROVIDER'] = 'rackspace' Vagrant.configure("2") do |config|
config.vm.box = "dummy" config.vm.hostname = "web" config.ssh.private_key_path = "/root/id_rsa" config.ssh.username = "root" config.ssh.pty = "true"
config.vm.provider "rackspace" do |rs, override| rs.username = "xxx" rs.api_key = "xxx" rs.flavor = /512MB/ rs.image = /CentOS/ rs.rackspace_region = "lon" rs.server_name = "web1.domain.com" rs.public_key_path = "/root/id_rsa.pub" override.ssh.username = "root" end
config.vm.provision "shell", path: "boot.sh", args: "-r webserver -e production"
config.ssh.shell = "bash -l"
config.ssh.keep_alive = true
config.ssh.forward_agent = false config.ssh.forward_x11 = false
config.vagrant.host = :detect
end
boot.sh is simply a shell file with couple of yum commands.
!/bin/bash
set -x
Install PUPPET from puppetlabs.com repo
yum install -y http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm yum install -y puppet yum install -y git ... ...
The output from Vagrant is as below (just the bottom bit where it hangs)
yum install -y puppet ... ... ... ... Total download size: 6.0 M Installed size: 20 M Downloading Packages: (1/18): augeas-libs-1.0.0-5.el6_5.1.x86_64.rpm | 309 kB 00:00 (2/18): compat-readline5-5.2-17.1.el6.x86_64.rpm | 130 kB 00:00 (3/18): dmidecode-2.11-2.el6.x86_64.rpm | 71 kB 00:00 (4/18): facter-1.7.5-1.el6.x86_64.rpm | 87 kB 00:00 (5/18): hiera-1.3.2-1.el6.noarch.rpm | 23 kB 00:00 (6/18): libselinux-ruby-2.0.94-5.3.el6_4.1.x86_64.rpm | 99 kB 00:00 (7/18): pciutils-3.1.10-2.el6.x86_64.rpm | 85 kB 00:00 (8/18): puppet-3.4.3-1.el6.noarch.rpm | 1.1 MB 00:01 (9/18): ruby-1.8.7.352-13.el6.x86_64.rpm | 534 kB 00:00 (10/18): ruby-augeas-0.4.1-3.el6.x86_64.rpm | 21 kB 00:00 (11/18): ruby-irb-1.8.7.352-13.el6.x86_64.rpm | 314 kB 00:00 (12/18): ruby-libs-1.8.7.352-13.el6.x86_64.rpm | 1.6 MB 00:00 (13/18): ruby-rdoc-1.8.7.352-13.el6.x86_64.rpm | 377 kB 00:00 (14/18): ruby-rgen-0.6.5-2.el6.noarch.rpm | 237 kB 00:00 (15/18): ruby-shadow-2.2.0-2.el6.x86_64.rpm | 13 kB 00:00 (16/18): rubygem-json-1.5.5-1.el6.x86_64.rpm | 763 kB 00:00 (17/18): rubygems-1.3.7-5.el6.noarch.rpm | 207 kB 00:00 (18/18): virt-what-1.11-1.2.el6.x86_64.rpm | 24 kB 00:00
Total 1.5 MB/s | 6.0 MB 00:03 warning: rpmts_HdrFromFdno: Header V4 RSA/SHA512 Signature, key ID 4bd6ec30: NOKEY Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs Importing GPG key 0x4BD6EC30: Userid : Puppet Labs Release Key (Puppet Labs Release Key) info@puppetlabs.com Package: puppetlabs-release-6-10.noarch (@/puppetlabs-release-el-6.noarch) From : /etc/pki/rpm-gpg/RPM-GPG-KEY-puppetlabs Running rpm_check_debug Running Transaction Test <- Here is where it hangs and sits for ages...
The strange thing is that it won't always hang here. Sometime it will hang at a stage where yum is downloading the packages. And as mentioned above, the script completes successfully on the destination server, it is just that it is not able to display full output and status via vagrant.
I tried setting / unsetting SSH Keep alive within Vagrant file but no avail.
config.ssh.keep_alive = true