Problem with vagrant(in ubuntu) and coreos(Warning: Connection timeout. Retrying...)

328 views
Skip to first unread message

manishr

unread,
Apr 14, 2015, 5:43:53 AM4/14/15
to vagra...@googlegroups.com
Hi Experts,

I am new to vagrant/coreos and facing some problem. I am not able to resolve this issue from last 4-5 days. I am using Ubuntu 14.04 and on which I installed vagrant 1.6.2 and  virtual box 4.2 and I am trying to get coreos cluster up and running but I am getting this error "Warning: Connection timeout. Retrying..." when I try to do vagrant up/vagrant ssh. You will get all the details below

root@whitesnake:~# dpkg --get-selections | awk '/[v]irtualbox/ || /[v]agrant/'
vagrant                                         install
virtualbox-4.2                                  install
root@whitesnake:~# vagrant -v
Vagrant 1.6.2

root@whitesnake:~/coreos-vagrant# ls
config.rb         CONTRIBUTING.md  LICENSE      NOTICE     user-data         Vagrantfile
config.rb.sample  DCO              MAINTAINERS  README.md  user-data.sample

root@whitesnake:~/coreos-vagrant# pwd
/root/coreos-vagrant

root@whitesnake:~/coreos-vagrant# cat config.rb
$new_discovery_url='https://discovery.etcd.io/new'

# To automatically replace the discovery token on 'vagrant up', uncomment
# the lines below:
#
#if File.exists?('user-data') && ARGV[0].eql?('up')
#  require 'open-uri'
#  require 'yaml'
#
#  token = open($new_discovery_url).read
#
#  data = YAML.load(IO.readlines('user-data')[1..-1].join)
#  data['coreos']['etcd']['discovery'] = token
#
#  yaml = YAML.dump(data)
#  File.open('user-data', 'w') { |file| file.write("#cloud-config\n\n#{yaml}") }
#end
#

#
# coreos-vagrant is configured through a series of configuration
# options (global ruby variables) which are detailed below. To modify
# these options, first copy this file to "config.rb". Then simply
# uncomment the necessary lines, leaving the $, and replace everything
# after the equals sign..

# Size of the CoreOS cluster created by Vagrant
$num_instances=3

# Change basename of the VM
# The default value is "core", which results in VMs named starting with
# "core-01" through to "core-${num_instances}".
#$instance_name_prefix="core"

# Official CoreOS channel from which updates should be downloaded
$update_channel='stable'

# Log the serial consoles of CoreOS VMs to log/
# Enable by setting value to true, disable with false
# WARNING: Serial logging is known to result in extremely high CPU usage with
# VirtualBox, so should only be used in debugging situations
#$enable_serial_logging=false

# Enable port forwarding of Docker TCP socket
# Set to the TCP port you want exposed on the *host* machine, default is 2375
# If 2375 is used, Vagrant will auto-increment (e.g. in the case of $num_instances > 1)
# You can then use the docker tool locally by setting the following env var:
#   export DOCKER_HOST='tcp://127.0.0.1:2375'
#$expose_docker_tcp=2375

# Enable NFS sharing of your home directory ($HOME) to CoreOS
# It will be mounted at the same path in the VM as on the host.
# Example: /Users/foobar -> /Users/foobar
#$share_home=false

# Customize VMs
#$vm_gui = false
#$vm_memory = 1024
#$vm_cpus = 1

# Share additional folders to the CoreOS VMs
# For example,
# $shared_folders = {'/path/on/host' => '/path/on/guest', '/home/foo/app' => '/app'}
# or, to map host folders to guest folders of the same name,
# $shared_folders = Hash[*['/home/foo/app1', '/home/foo/app2'].map{|d| [d, d]}.flatten]
#$shared_folders = {}

# Enable port forwarding from guest(s) to host machine, syntax is: { 80 => 8080 }, auto correction is enabled by default.
#$forwarded_ports = {}

root@whitesnake:~/coreos-vagrant# cat user-data
#cloud-config

coreos:
  etcd:
    # generate a new token for each unique cluster from https://discovery.etcd.io/new
    # WARNING: replace each time you 'vagrant destroy'
    addr: $public_ipv4:4001
    peer-addr: $public_ipv4:7001
  fleet:
    public-ip: $public_ipv4
  flannel:
    interface: $public_ipv4
  units:
    - name: etcd.service
      command: start
    - name: fleet.service
      command: start

root@whitesnake:~/coreos-vagrant# cat Vagrantfile
# -*- mode: ruby -*-
# # vi: set ft=ruby :

require 'fileutils'

Vagrant.require_version ">= 1.6.0"

CLOUD_CONFIG_PATH = File.join(File.dirname(__FILE__), "user-data")
CONFIG = File.join(File.dirname(__FILE__), "config.rb")

# Defaults for config options defined in CONFIG
$num_instances = 1
$instance_name_prefix = "core"
$update_channel = "alpha"
$enable_serial_logging = false
$share_home = false
$vm_gui = false
$vm_memory = 1024
$vm_cpus = 1
$shared_folders = {}
$forwarded_ports = {}

# Attempt to apply the deprecated environment variable NUM_INSTANCES to
# $num_instances while allowing config.rb to override it
if ENV["NUM_INSTANCES"].to_i > 0 && ENV["NUM_INSTANCES"]
  $num_instances = ENV["NUM_INSTANCES"].to_i
end

if File.exist?(CONFIG)
  require CONFIG
end

# Use old vb_xxx config variables when set
def vm_gui
  $vb_gui.nil? ? $vm_gui : $vb_gui
end

def vm_memory
  $vb_memory.nil? ? $vm_memory : $vb_memory
end

def vm_cpus
  $vb_cpus.nil? ? $vm_cpus : $vb_cpus
end

Vagrant.configure("2") do |config|
  # always use Vagrants insecure key
  config.ssh.insert_key = false

  config.vm.box = "coreos-%s" % $update_channel
  config.vm.box_version = ">= 308.0.1"
  config.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant.json" % $update_channel

  ["vmware_fusion", "vmware_workstation"].each do |vmware|
    config.vm.provider vmware do |v, override|
      override.vm.box_url = "http://%s.release.core-os.net/amd64-usr/current/coreos_production_vagrant_vmware_fusion.json" % $update_channel
    end
  end

  config.vm.provider :virtualbox do |v|
    # On VirtualBox, we don't have guest additions or a functional vboxsf
    # in CoreOS, so tell Vagrant that so it can be smarter.
    v.check_guest_additions = false
    v.functional_vboxsf     = false
  end

  # plugin conflict
  if Vagrant.has_plugin?("vagrant-vbguest") then
    config.vbguest.auto_update = false
  end

  (1..$num_instances).each do |i|
    config.vm.define vm_name = "%s-%02d" % [$instance_name_prefix, i] do |config|
      config.vm.hostname = vm_name

      if $enable_serial_logging
        logdir = File.join(File.dirname(__FILE__), "log")
        FileUtils.mkdir_p(logdir)

        serialFile = File.join(logdir, "%s-serial.txt" % vm_name)
        FileUtils.touch(serialFile)

        ["vmware_fusion", "vmware_workstation"].each do |vmware|
          config.vm.provider vmware do |v, override|
            v.vmx["serial0.present"] = "TRUE"
            v.vmx["serial0.fileType"] = "file"
            v.vmx["serial0.fileName"] = serialFile
            v.vmx["serial0.tryNoRxLoss"] = "FALSE"
          end
        end

        config.vm.provider :virtualbox do |vb, override|
          vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
          vb.customize ["modifyvm", :id, "--uartmode1", serialFile]
        end
      end

      if $expose_docker_tcp
        config.vm.network "forwarded_port", guest: 2375, host: ($expose_docker_tcp + i - 1), auto_correct: true
      end

      $forwarded_ports.each do |guest, host|
        config.vm.network "forwarded_port", guest: guest, host: host, auto_correct: true
      end

      ["vmware_fusion", "vmware_workstation"].each do |vmware|
        config.vm.provider vmware do |v|
          v.gui = vm_gui
          v.vmx['memsize'] = vm_memory
          v.vmx['numvcpus'] = vm_cpus
        end
      end

      config.vm.provider :virtualbox do |vb|
        vb.gui = vm_gui
        vb.memory = vm_memory
        vb.cpus = vm_cpus
      end

      ip = "172.17.8.#{i+100}"
      config.vm.network :private_network, ip: ip

      # Uncomment below to enable NFS for sharing the host machine into the coreos-vagrant VM.
      #config.vm.synced_folder ".", "/home/core/share", id: "core", :nfs => true, :mount_options => ['nolock,vers=3,udp']
      $shared_folders.each_with_index do |(host_folder, guest_folder), index|
        config.vm.synced_folder host_folder.to_s, guest_folder.to_s, id: "core-share%02d" % index, nfs: true, mount_options: ['nolock,vers=3,udp']
      end

      if $share_home
        config.vm.synced_folder ENV['HOME'], ENV['HOME'], id: "home", :nfs => true, :mount_options => ['nolock,vers=3,udp']
      end

      if File.exist?(CLOUD_CONFIG_PATH)
        config.vm.provision :file, :source => "#{CLOUD_CONFIG_PATH}", :destination => "/tmp/vagrantfile-user-data"
        config.vm.provision :shell, :inline => "mv /tmp/vagrantfile-user-data /var/lib/coreos-vagrant/", :privileged => true
      end

    end
  end
end

root@whitesnake:~/coreos-vagrant# vagrant up
Bringing machine 'core-01' up with 'virtualbox' provider...
Bringing machine 'core-02' up with 'virtualbox' provider...
Bringing machine 'core-03' up with 'virtualbox' provider...
==> core-01: Importing base box 'coreos-stable'...
==> core-01: Matching MAC address for NAT networking...
==> core-01: Checking if box 'coreos-stable' is up to date...
==> core-01: Setting the name of the VM: coreos-vagrant_core-01_1429003163873_29418
==> core-01: Clearing any previously set network interfaces...
==> core-01: Preparing network interfaces based on configuration...
    core-01: Adapter 1: nat
    core-01: Adapter 2: hostonly
==> core-01: Forwarding ports...
    core-01: 22 => 2222 (adapter 1)
==> core-01: Running 'pre-boot' VM customizations...
==> core-01: Booting VM...
==> core-01: Waiting for machine to boot. This may take a few minutes...
    core-01: SSH address: 127.0.0.1:2222
    core-01: SSH username: core
    core-01: SSH auth method: private key
    core-01: Warning: Connection timeout. Retrying...
    core-01: Warning: Connection timeout. Retrying...
    core-01: Warning: Connection timeout. Retrying...
^C==> core-01: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.
root@whitesnake:~/coreos-vagrant# vagrant up
Bringing machine 'core-01' up with 'virtualbox' provider...
Bringing machine 'core-02' up with 'virtualbox' provider...
Bringing machine 'core-03' up with 'virtualbox' provider...
==> core-01: Checking if box 'coreos-stable' is up to date...
==> core-01: VirtualBox VM is already running.
==> core-02: Importing base box 'coreos-stable'...
==> core-02: Matching MAC address for NAT networking...
==> core-02: Checking if box 'coreos-stable' is up to date...
==> core-02: Setting the name of the VM: coreos-vagrant_core-02_1429003254505_11668
==> core-02: Fixed port collision for 22 => 2222. Now on port 2200.
==> core-02: Clearing any previously set network interfaces...
==> core-02: Preparing network interfaces based on configuration...
    core-02: Adapter 1: nat
    core-02: Adapter 2: hostonly
==> core-02: Forwarding ports...
    core-02: 22 => 2200 (adapter 1)
==> core-02: Running 'pre-boot' VM customizations...
==> core-02: Booting VM...
==> core-02: Waiting for machine to boot. This may take a few minutes...
    core-02: SSH address: 127.0.0.1:2200
    core-02: SSH username: core
    core-02: SSH auth method: private key
    core-02: Warning: Connection timeout. Retrying...
    core-02: Warning: Connection timeout. Retrying...
    core-02: Warning: Connection timeout. Retrying...
    core-02: Warning: Connection timeout. Retrying...
    core-02: Warning: Connection timeout. Retrying...
    core-02: Warning: Connection timeout. Retrying...
^C==> core-02: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.
root@whitesnake:~/coreos-vagrant#
root@whitesnake:~/coreos-vagrant#
root@whitesnake:~/coreos-vagrant# vagrant up
Bringing machine 'core-01' up with 'virtualbox' provider...
Bringing machine 'core-02' up with 'virtualbox' provider...
Bringing machine 'core-03' up with 'virtualbox' provider...
==> core-01: Checking if box 'coreos-stable' is up to date...
==> core-01: VirtualBox VM is already running.
==> core-02: Checking if box 'coreos-stable' is up to date...
==> core-02: VirtualBox VM is already running.
==> core-03: Importing base box 'coreos-stable'...
==> core-03: Matching MAC address for NAT networking...
==> core-03: Checking if box 'coreos-stable' is up to date...
==> core-03: Setting the name of the VM: coreos-vagrant_core-03_1429003391353_55088
==> core-03: Fixed port collision for 22 => 2222. Now on port 2201.
==> core-03: Clearing any previously set network interfaces...
==> core-03: Preparing network interfaces based on configuration...
    core-03: Adapter 1: nat
    core-03: Adapter 2: hostonly
==> core-03: Forwarding ports...
    core-03: 22 => 2201 (adapter 1)
==> core-03: Running 'pre-boot' VM customizations...
==> core-03: Booting VM...
==> core-03: Waiting for machine to boot. This may take a few minutes...
    core-03: SSH address: 127.0.0.1:2201
    core-03: SSH username: core
    core-03: SSH auth method: private key
    core-03: Warning: Connection timeout. Retrying...
    core-03: Warning: Connection timeout. Retrying...
^C==> core-03: Waiting for cleanup before exiting...
    core-03: Warning: Connection timeout. Retrying...
Vagrant exited after cleanup due to external interrupt.
root@whitesnake:~/coreos-vagrant#
root@whitesnake:~/coreos-vagrant#
root@whitesnake:~/coreos-vagrant#

root@whitesnake:~/coreos-vagrant# vagrant status
Current machine states:

core-01                   running (virtualbox)
core-02                   running (virtualbox)
core-03                   running (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.

root@whitesnake:~/coreos-vagrant# vagrant ssh-config
Host core-01
  HostName 127.0.0.1
  User core
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /root/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

Host core-02
  HostName 127.0.0.1
  User core
  Port 2200
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /root/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

Host core-03
  HostName 127.0.0.1
  User core
  Port 2201
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /root/.vagrant.d/insecure_private_key
  IdentitiesOnly yes
  LogLevel FATAL

root@whitesnake:~/coreos-vagrant# netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1275/sshd
tcp        0      0 127.0.0.1:2200          0.0.0.0:*               LISTEN      32556/VBoxHeadless
tcp        0      0 127.0.0.1:2201          0.0.0.0:*               LISTEN      35256/VBoxHeadless
tcp        0      0 10.0.1.4:16001          0.0.0.0:*               LISTEN      903/python
tcp        0      0 0.0.0.0:3306            0.0.0.0:*               LISTEN      9810/mysqld
tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      5038/redis-server 0
tcp        0      0 127.0.0.1:2222          0.0.0.0:*               LISTEN      30788/VBoxHeadless
tcp6       0      0 :::80                   :::*                    LISTEN      1047/docker.io
tcp6       0      0 :::22                   :::*                    LISTEN      1275/sshd
root@whitesnake:~/coreos-vagrant#


root@whitesnake:~/coreos-vagrant# ifconfig
docker0   Link encap:Ethernet  HWaddr 56:84:7a:fe:97:99
          inet addr:172.17.42.1  Bcast:0.0.0.0  Mask:255.255.0.0
          inet6 addr: fe80::5484:7aff:fefe:9799/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:536 (536.0 B)  TX bytes:648 (648.0 B)

eth0      Link encap:Ethernet  HWaddr 00:0d:3a:80:3c:c2
          inet addr:10.0.1.4  Bcast:10.0.1.31  Mask:255.255.255.224
          inet6 addr: fe80::20d:3aff:fe80:3cc2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:78848 errors:0 dropped:0 overruns:0 frame:0
          TX packets:23149 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:96752977 (96.7 MB)  TX bytes:3439993 (3.4 MB)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:102 errors:0 dropped:0 overruns:0 frame:0
          TX packets:102 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:5432 (5.4 KB)  TX bytes:5432 (5.4 KB)

vboxnet1  Link encap:Ethernet  HWaddr 0a:00:27:00:00:01
          inet addr:172.17.8.1  Bcast:172.17.8.255  Mask:255.255.255.0
          inet6 addr: fe80::800:27ff:fe00:1/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:648 (648.0 B)

veth50a5  Link encap:Ethernet  HWaddr 86:cf:b5:1b:d4:cf
          inet6 addr: fe80::84cf:b5ff:fe1b:d4cf/64 Scope:Link
          UP BROADCAST RUNNING  MTU:1500  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:14 errors:0 dropped:2 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:648 (648.0 B)  TX bytes:1116 (1.1 KB)

root@whitesnake:~/coreos-vagrant# ls -lh /root/.vagrant.d/insecure_private_key
-rw------- 1 root root 1.7K Apr 13 10:13 /root/.vagrant.d/insecure_private_key

root@whitesnake:~/coreos-vagrant# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.2 LTS
Release:        14.04
Codename:       trusty

--manishr

manishr

unread,
Apr 17, 2015, 4:06:08 AM4/17/15
to vagra...@googlegroups.com
Hello Guys,

Anybody.

--manishr

Alvaro Miranda Aguilera

unread,
Apr 18, 2015, 5:25:03 PM4/18/15
to vagra...@googlegroups.com
Hello,

I saw that the coreos vm did start fine..

so, can go more simple and tell what is not working?
> --
> You received this message because you are subscribed to the Google Groups
> "Vagrant" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to vagrant-up+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

manishr

unread,
Apr 22, 2015, 2:04:41 AM4/22/15
to vagra...@googlegroups.com
Hi Aguiera,

Thanks of the reply and sorry for replying you late.

The problem was the coreos VM's did start but I am not able to login/ssh to that VM's. As you can see below I am getting "Warning: Connection timeout. Retrying..." error marked in bold. So can you tell me how should I troubleshoot this? I think almost all the details I have pasted in my first post. If you need anything else just let me know

--manishr

dragon788

unread,
Apr 22, 2015, 2:15:23 PM4/22/15
to vagra...@googlegroups.com
Manishr, please try adding config.ssh.insert_key = false to your Vagrantfile in the vm.configure block. If you are using Vagrant 1.7.x it will replace the default insecure key, and unless Vagrant is correctly accounting for that when going to SSH into the VMs, it will be using the wrong key.

...

manishr

unread,
Apr 23, 2015, 6:26:34 AM4/23/15
to vagra...@googlegroups.com
Hi Dragonr,

I am using vagrant 1.6.2. Let me try your suggestion and get back to you with the answer.

--manishr

root@whitesnake:~# vagrant -v
Vagrant 1.6.2

On Tuesday, April 14, 2015 at 3:13:53 PM UTC+5:30, manishr wrote:
Reply all
Reply to author
Forward
0 new messages