-
-
Save davetapley/7902362 to your computer and use it in GitHub Desktop.
Vagrant failing to run Puppet if first `vagrant up` fails because another virtual box already has port 3000 (see: a.sh). Then succeeding after `destroy` then `up` again (see: b.sh).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# CLONE | |
dave@lexi:~/projects$ git clone https://github.com/rails/rails-dev-box.git | |
Cloning into 'rails-dev-box'... | |
remote: Counting objects: 267, done. | |
remote: Compressing objects: 100% (185/185), done. | |
remote: Total 267 (delta 79), reused 222 (delta 52) | |
Receiving objects: 100% (267/267), 80.74 KiB, done. | |
Resolving deltas: 100% (79/79), done. | |
# FIRST ATTEMPT | |
dave@lexi:~/projects$ cd rails-dev-box/ | |
dave@lexi:~/projects/rails-dev-box$ vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
[default] Box 'precise32' was not found. Fetching box from specified URL for | |
the provider 'virtualbox'. Note that if the URL does not have | |
a box for this provider, you should interrupt Vagrant now and add | |
the box yourself. Otherwise Vagrant will attempt to download the | |
full box prior to discovering this error. | |
Downloading or copying the box... | |
Extracting box...te: 5794k/s, Estimated time remaining: 0:00:01) | |
Successfully added box 'precise32' with provider 'virtualbox'! | |
[default] Importing base box 'precise32'... | |
[default] Matching MAC address for NAT networking... | |
[default] Setting the name of the VM... | |
[default] Clearing any previously set forwarded ports... | |
[default] Fixed port collision for 22 => 2222. Now on port 2200. | |
Vagrant cannot forward the specified ports on this VM, since they | |
would collide with some other application that is already listening | |
on these ports. The forwarded port to 3000 is already in use | |
on the host machine. | |
To fix this, modify your current projects Vagrantfile to use another | |
port. Example, where '1234' would be replaced by a unique host port: | |
config.vm.network :forwarded_port, guest: 3000, host: 1234 | |
Sometimes, Vagrant will attempt to auto-correct this for you. In this | |
case, Vagrant was unable to. This is usually because the guest machine | |
is in a state which doesn't allow modifying port forwarding. | |
# WHOOPS! | |
# Halt the other VirtualBox which is already using port 3000 | |
# Try again: | |
dave@lexi:~/projects/rails-dev-box$ vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
[default] Clearing any previously set forwarded ports... | |
[default] Creating shared folders metadata... | |
[default] Clearing any previously set network interfaces... | |
[default] Preparing network interfaces based on configuration... | |
[default] Forwarding ports... | |
[default] -- 22 => 2222 (adapter 1) | |
[default] -- 3000 => 3000 (adapter 1) | |
[default] Booting VM... | |
[default] Waiting for machine to boot. This may take a few minutes... | |
[default] Machine booted and ready! | |
[default] Setting hostname... | |
[default] Mounting shared folders... | |
[default] -- /vagrant | |
[default] -- /tmp/vagrant-puppet/manifests | |
[default] -- /tmp/vagrant-puppet/modules-0 | |
dave@lexi:~/projects/rails-dev-box$ | |
# NEW VAGRANT BOX IS UP | |
# Let's see if we can bundle: | |
dave@lexi:~/projects/rails-dev-box$ vagrant ssh | |
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686) | |
* Documentation: https://help.ubuntu.com/ | |
Welcome to your Vagrant-built virtual machine. | |
Last login: Fri Sep 14 06:22:31 2012 from 10.0.2.2 | |
vagrant@rails-dev-box:~$ | |
vagrant@rails-dev-box:~$ | |
vagrant@rails-dev-box:~$ | |
vagrant@rails-dev-box:~$ cd /vagrant/ | |
vagrant@rails-dev-box:/vagrant$ ll | |
total 36 | |
drwxr-xr-x 1 vagrant vagrant 4096 Dec 10 23:12 ./ | |
drwxr-xr-x 23 root root 4096 Dec 10 23:18 ../ | |
drwxrwxr-x 1 vagrant vagrant 4096 Dec 10 23:12 .git/ | |
-rw-rw-r-- 1 vagrant vagrant 14 Dec 10 23:12 .gitignore | |
-rw-rw-r-- 1 vagrant vagrant 1058 Dec 10 23:12 MIT-LICENSE | |
drwxrwxr-x 1 vagrant vagrant 4096 Dec 10 23:12 puppet/ | |
-rw-rw-r-- 1 vagrant vagrant 3072 Dec 10 23:12 README.md | |
drwxrwxr-x 1 vagrant vagrant 4096 Dec 10 23:12 .vagrant/ | |
-rw-rw-r-- 1 vagrant vagrant 382 Dec 10 23:12 Vagrantfile | |
vagrant@rails-dev-box:/vagrant$ cd rails/ | |
vagrant@rails-dev-box:/vagrant/rails$ | |
vagrant@rails-dev-box:/vagrant/rails$ bundle | |
The program 'bundle' is currently not installed. You can install it by typing: | |
# FAIL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DESTROY | |
dave@lexi:~/projects/rails-dev-box$ vagrant destroy | |
Are you sure you want to destroy the 'default' VM? [y/N] y | |
[default] Forcing shutdown of VM... | |
[default] Destroying VM and associated drives... | |
[default] Running cleanup tasks for 'puppet' provisioner... | |
# TRY AGAIN | |
# Having made sure port 3000 isn't already in use! | |
dave@lexi:~/projects/rails-dev-box$ vagrant up | |
Bringing machine 'default' up with 'virtualbox' provider... | |
[default] Importing base box 'precise32'... | |
[default] Matching MAC address for NAT networking... | |
[default] Setting the name of the VM... | |
[default] Clearing any previously set forwarded ports... | |
[default] Creating shared folders metadata... | |
[default] Clearing any previously set network interfaces... | |
[default] Preparing network interfaces based on configuration... | |
[default] Forwarding ports... | |
[default] -- 22 => 2222 (adapter 1) | |
[default] -- 3000 => 3000 (adapter 1) | |
[default] Booting VM... | |
[default] Waiting for machine to boot. This may take a few minutes... | |
[default] Machine booted and ready! | |
[default] Setting hostname... | |
[default] Mounting shared folders... | |
[default] -- /vagrant | |
[default] -- /tmp/vagrant-puppet/manifests | |
[default] -- /tmp/vagrant-puppet/modules-0 | |
[default] Running provisioner: puppet... | |
Running Puppet with default.pp... | |
stdin: is not a tty | |
warning: Could not retrieve fact fqdn | |
notice: /Stage[preinstall]/Apt_get_update/Exec[apt-get -y update]/returns: executed successfully | |
notice: /Stage[main]//Package[build-essential]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]//Package[libxslt1-dev]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]//Package[libsqlite3-dev]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Memcached/Package[memcached]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]//Package[sqlite3]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Install_postgres/Package[libpq-dev]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]//Package[nodejs]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Mysql::Server/Package[mysql-server]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]//Package[curl]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]//Exec[install_rvm]/returns: executed successfully | |
notice: /Stage[main]//Exec[install_ruby]/returns: executed successfully | |
notice: /Stage[main]//Package[git-core]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Mysql/Package[mysql_client]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Install_mysql/Package[libmysqlclient15-dev]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Install_mysql/Database_user[rails@localhost]/ensure: created | |
notice: /Stage[main]/Install_mysql/Database[activerecord_unittest2]/ensure: created | |
notice: /Stage[main]/Install_mysql/Database[activerecord_unittest]/ensure: created | |
notice: /Stage[main]/Install_mysql/Database_grant[rails@localhost/activerecord_unittest]/privileges: privileges changed '' to 'all' | |
notice: /Stage[main]/Postgresql::Server/Package[postgresql-server-9.1]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Postgresql::Server/File[postgresql-server-hba-config-9.1]/content: content changed '{md5}7694a77a71d01d43944f0ec2aa3fb165' to '{md5}17645e6222916aa1e4554e9ad1607038' | |
notice: /Stage[main]/Postgresql::Server/File[postgresql-server-config-9.1]/content: content changed '{md5}5b9755510f68c05f186faa477cf3fb58' to '{md5}b8d0fb15b77aca35b26d9deeb9e55619' | |
notice: /Stage[main]/Postgresql::Server/Service[postgresql-system-9.1]: Triggered 'refresh' from 3 events | |
notice: /Stage[main]/Install_postgres/Package[postgresql-contrib]/ensure: ensure changed 'purged' to 'present' | |
notice: /Stage[main]/Install_postgres/Pg_database[activerecord_unittest2]/ensure: created | |
notice: /Stage[main]/Install_postgres/Pg_user[rails]/ensure: created | |
notice: /Stage[main]/Install_postgres/Pg_database[activerecord_unittest]/ensure: created | |
notice: /Stage[main]/Install_postgres/Pg_user[vagrant]/ensure: created | |
notice: /Stage[main]/Install_mysql/Database_grant[rails@localhost/activerecord_unittest2]/privileges: privileges changed '' to 'all' | |
notice: /Stage[main]/Memcached/File[/etc/memcached.conf]/content: content changed '{md5}58c9e04b29e08c2e9b3094794d3ebd0e' to '{md5}16c49164edef89725fd3853440dd3ebc' | |
notice: /Stage[main]/Memcached/Service[memcached]: Triggered 'refresh' from 1 events | |
notice: /Stage[main]/Mysql::Config/File[/etc/mysql/my.cnf]/content: content changed '{md5}77f15d6c87f9c136c4efcda072017f71' to '{md5}31067e9939d7d1c7e5bb7a02cf11f0f4' | |
notice: /Stage[main]/Mysql::Config/File[/root/.my.cnf]/ensure: defined content as '{md5}1a632000ff7bfcbfb2921f81930d0698' | |
notice: /Stage[main]/Mysql::Config/Exec[mysqld-restart]: Triggered 'refresh' from 2 events | |
notice: Finished catalog run in 130.13 seconds | |
dave@lexi:~/projects/rails-dev-box$ | |
# LOOKS GOOD | |
# Puppet definitely did something that time, let's see: | |
dave@lexi:~/projects/rails-dev-box$ vagrant ssh | |
Welcome to Ubuntu 12.04 LTS (GNU/Linux 3.2.0-23-generic-pae i686) | |
* Documentation: https://help.ubuntu.com/ | |
Welcome to your Vagrant-built virtual machine. | |
Last login: Fri Sep 14 06:22:31 2012 from 10.0.2.2 | |
vagrant@rails-dev-box:~$ cd /vagrant/rails/ | |
vagrant@rails-dev-box:/vagrant/rails$ bundle | |
Fetching gem metadata from https://rubygems.org/.. | |
# SUCCESS! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment