Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby Installing a Ruby Development Environment Installing a Ruby Development Environment Installing the Treehouse VM on Windows

Alex Gustafson
Alex Gustafson
14,207 Points

Unexpected Behavior when following along with "Installing the Treehouse VM on Windows"

I'm following along with Jason on this video.

I don't seem to get the expected behavior for the commands "vagrant up" and "vagrant ssh" and I don't believe Cmdr is actually putting me into the Treehouse VM as a result.

Here's a screenshot of what I'm getting: Imgur

All other steps of this video seemed to go smoothly. Can anyone help point me in the right direction?

1 Answer

It looks like your Virtual Machine is starting perfectly. The SSH errors are normal while the VM is still booting - Vagrant is just waiting for SSH to start up in the VM. I cannot work out why "vagrant ssh" is not connecting. Do you have any other program on your PC currently listening on port 2222? It is not an uncommon port to use for SSH if port 22 cannot be used.

Here are my suggestions.

First shutdown the VM ("vagrant halt") and then edit the Vagrantfile file that you downloaded in the treehouse-vm.zip to add the following lines just after the line config.vm.synced_folder "./projects", "/home/treehouse/projects":

  config.vm.provider "virtualbox" do |v|
    v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
    v.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
  end

You do not need to re-install anything - the change in Vagrantfile just alters the NAT settings in Virtualbox used to run the VM.

I just installed the VM a few days ago and without this addition, my VM NAT could not connect to the internet and without a connection to the internet, I couldn't run "rails new testapp" as it needs to access the gem repository (I think).

Restart the VM using "vagrant up" and see if "vagrant ssh" now works. If it doesn't, try a manual ssh connection from the Cmder prompt. In the following, replace"MyUSerName" with your current Windows user name. If you are not sure what your Windows username is currently active, run "whoami" in the Cmder prompt to see what Windows user is currently active.

ssh -i c:\users\MyUserName\.vagrant.d\insecure_private_key -p 2222 treehouse@127.0.0.1

You can add an extra "-v" option if you want the verbose SSH connection information.

if the insecure_private_key file is missing, then something has gone wrong with Vagrant, or perhaps you installed vagrant as a different windows user. Without this key, you will need the password for the VM user "treehouse" to log in, and I do not know password.

Richard