Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot up after halt #17

Closed
andyshinn opened this issue Dec 12, 2014 · 12 comments
Closed

Cannot up after halt #17

andyshinn opened this issue Dec 12, 2014 · 12 comments

Comments

@andyshinn
Copy link

After halting and then upping, Vagrant can no longer authenticate:

$ vagrant halt
==> default: Attempting graceful shutdown of VM...
Connection to 127.0.0.1 closed by remote host.
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'yungsang/boot2docker' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 2375 => 2375 (adapter 1)
    default: 5000 => 5000 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: docker
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...
    default: Warning: Authentication failure. Retrying...

If I run vagrant ssh it prompts me for the docker user password. I can get into the VM with the tcuser password. The authorized_keys file does appear correct:

docker@boot2docker:~$ cat .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key

I can see that the VM is up in VirtualBox. Any idea what might be happening here?

@YungSang
Copy link
Owner

Thank you for reporting. Which version of Vagrant, VirtualBox, yungsang/boot2docker do you use?

@YungSang
Copy link
Owner

I tested it as same as yours with Vagrant v1.6.5, VirtualBox v4.3.20 and yungsang/boot2docker v1.3.6 with Docker v1.3.3.
It looks good at my side.

$ vagrant halt
==> boot2docker: Attempting graceful shutdown of VM...
$ vagrant up
Bringing machine 'boot2docker' up with 'virtualbox' provider...
==> boot2docker: Checking if box 'yungsang/boot2docker' is up to date...
==> boot2docker: Clearing any previously set forwarded ports...
==> boot2docker: Clearing any previously set network interfaces...
==> boot2docker: Preparing network interfaces based on configuration...
    boot2docker: Adapter 1: nat
==> boot2docker: Forwarding ports...
    boot2docker: 2375 => 2375 (adapter 1)
    boot2docker: 22 => 2222 (adapter 1)
==> boot2docker: Running 'pre-boot' VM customizations...
==> boot2docker: Booting VM...
==> boot2docker: Waiting for machine to boot. This may take a few minutes...
    boot2docker: SSH address: 127.0.0.1:2222
    boot2docker: SSH username: docker
    boot2docker: SSH auth method: private key
    boot2docker: Warning: Connection timeout. Retrying...
    boot2docker: Warning: Authentication failure. Retrying...
==> boot2docker: Machine booted and ready!
==> boot2docker: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> boot2docker: to force provisioning. Provisioners marked to run always will still run.

@andyshinn
Copy link
Author

I'm using Vagrant 1.7.0, VirtualBox 4.3.20, and yungsang/boot2docker 1.3.6.

I think I see what is going on. It looks like on first up, Vagrant replaces the insecure SSH key with a generated one. Then on halt / up again, that key is reverted back to the insecure key in the VM, but Vagrant is trying to use the newly generated public key to SSH.

Looks like this is because /home/docker/.ssh is part of the root mount on tmpfs. Maybe this could be changed to be persistent somehow?

@YungSang
Copy link
Owner

Vagrant replaces the insecure SSH key with a generated one.

!! Is it generated by Vagrant v1.7.0???

I will check it out. Thanks for the information.

@andyshinn
Copy link
Author

Yep! Looks like a new feature of 1.7.x:

If the default insecure keypair is used, Vagrant will automatically replace it with a randomly generated keypair on first vagrant up. [GH-2608]

@YungSang
Copy link
Owner

Oh!! Thanks again. I will figure this out.

@YungSang
Copy link
Owner

hashicorp/vagrant#2608 (comment)

It does appear that there's a directive 'config.ssh.insert_key' which allows you to disable the key insertion.

This may work at this time.
I will find a better solution.

@YungSang
Copy link
Owner

The generated private key locates ./.vagrant/machines/boot2docker/virtualbox/private_key.

@YungSang
Copy link
Owner

This affects my CoreOS boxes, too.

@YungSang
Copy link
Owner

It seems there isn't any good solution but config.ssh.insert_key = false for now...
I will make a new box with config.ssh.insert_key = false by default.

@YungSang
Copy link
Owner

@andyshinn I've just released yungsang/boot2docker v1.3.7.
Thank you so much for your support.

@andyshinn
Copy link
Author

Seems like a reasonable solution for now 👍. This is a really good solution over the official boot2docker for doing Mac Docker development with NFS support. The vboxsf driver is just way too slow to be useful. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants