Running first Atlas Linux Box under Windows

Posted in automation on April 25, 2017 by Adrian Wyssmann ‐ 3 min read

Vagrant is a cool tool to easily provide virtual machines and it works perfectly fine under Linux. But as me at work, you might be in a situation where you have or want to run vagrant on a Windows machine. This is per-se not more complicated as under Linux even thought I struggled over some pitfalls.

As already mentioned in a previous post the easiest way to get a working Linux vm is to use the templates for the Atlas Catalog.

> vagrant init ubuntu/yakketa64
...
> varant up
...

Per default the boxes are started headless so you might want to modify the created Vagrantfile and enable gui mode:

config.vm.provider "virtualbox" do |vb|
   vb.gui = true
end

Once done, when you launch the box you will see your vm starting up until it provides you the login dialog.

vagrant up logs
vagrant up logs

Now comes the question what is the username and password to be used. Looking at the log messages from vagrant you can see some hints:

> varant up
...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: ubuntu
    default: SSH auth method: password
...

So username is clear, but password? “ubuntu”? “vagrant”? I’ve tried several but none of them worked:

failed login in vagrant box
failed login in vagrant box

Searching around lead me to the conclusion that there the password was never revealed to public but user rather shall use ssh-key authentication. Well, the easiest way is obviously the vagrant up command but unfortunately this does not work under Windows as there is no ssh client shipped with it:

> vagrant ssh
`ssh` executable not found in any directories in the %PATH% variable. Is an
SSH client installed? Try installing Cygwin, MinGW or Git, all of which
contain an SSH client. Or use your favorite SSH client with the following
authentication information shown below:

Host: 127.0.0.1
Port: 2222
Username: ubuntu
Private key: D:/vagrant/ubuntu_16.10_x64_atlas/.vagrant/machines/default/virtualbox/private_key

So in order to use Vagrant ssh command you need to have an SSH client installed and the “PATH” environment variable set accordingly. I recommend to use the OpenSSH client which you canĀ  install by manually by downloading the installer at http://www.mls-software.com/opensshd.html or you can use a package manager like Chocolatey to achieve the task.

  1. Install ssh client

  2. Upadate environment variable PATH to point to ssh-client binary

    set PATH=%PATH%;" C:\Program Files\OpenSSH-Win64\"
    
  3. Set the PATH permanently as described at Stakcoverflow

Finally now I actually can login into the Ubuntu box.

> vagrant ssh
Welcome to Ubuntu 16.10 (GNU/Linux 4.8.0-49-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.

New release '17.04' available.
Run 'do-release-upgrade' to upgrade to it.
saltstack-archi

Last login: Tue Apr 25 12:20:23 2017 from 10.0.2.2

ubuntu@ubuntu-yakkety:~$