custom box + public vagrant key, SSH timeout?

176 views
Skip to first unread message

Lito Kusnadi

unread,
Jun 25, 2015, 12:54:47 AM6/25/15
to vagra...@googlegroups.com
Hi,

I am trying to build a custom box: centos 6.6. I have to use my own build (cannot download from atlas repo).

I am trying to do the basic here (in fast mode):

Install Centos 6.6 minimal on Virtual Box from the ISO cd file
Install couple RPMS e.g. git and apache
Create user vagrant and make it part of "wheel" group
Visudo wheel group so that it requires no password when doing SUDO to be super user
Disable the requiretty in visudo entry
Create .ssh folder in vagrant home and download the vagrant public key from https://github.com/mitchellh/vagrant/tree/master/keys
Disable DNS lookup and make sure it looks at %h/.ssh/authorized_keys for sshd_config
chmod 0700 /home/vagrant/.ssh
chmod 0600 /home/vagrant/.ssh/authorized_keys
Package the box: vagrant package --base test-centos66
Add the box: vagrant box add test-centos66 package.box
Create a project dir, vagrant init test-centos66 and vagrant up

For some reason, I am having issue during boot at SSH login:
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
    ...
    default: Warning: Connection timeout. Retrying...
    default: Warning: Connection timeout. Retrying...
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within

I can telnet to port 2222, something is listening there, but can't get SSH from it (usually it shows an SSH string when you telnet to the port)

I cannot ssh manually to port 2222 or 22.

I checked no firewall rule is running on the base box.

The box is running, I can login via console of Virtual Box. But I just cannot login via SSH and the vagrant up process has issue as shown above.

I turned off the master box where the base came from. So I only have 1 vbox running.

Host is windows 7, vagrant is 1.7.2, virtual box 4.3.28 r 100309

I was wondering if the problem is with the public key of the SSH or the route of port forward from 2222 to 22?

Any hints? Many thanks.



Lito Kusnadi

unread,
Jun 25, 2015, 5:32:40 AM6/25/15
to vagra...@googlegroups.com
Found out that centos 6.6 is having problem with SSH connection during vagrant up.
Is there a way to debug during vagrant up?
Thanks.

dragon788

unread,
Jun 25, 2015, 2:02:24 PM6/25/15
to vagra...@googlegroups.com
Did you install openSSH and ensure that it is set to startup when the system starts up?

Lito Kusnadi

unread,
Jun 25, 2015, 8:45:13 PM6/25/15
to vagra...@googlegroups.com
Hi,
Yes I ran sshd and was able to login remotely before packaging the base.
After vagrant up, login via vbox console and check the sshd runs on port 22.
How do you debug vagrant up? I feel that the port forward on vbox for some reason interfere with something in the centos 66 minimal iso.

Thanks for the reply.

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/ghN9t600Ai8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/6387e386-bcd7-4887-88f5-7b4e8c46c3f9%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--
Kindly Regards,
Lito Kusnadi

dragon788

unread,
Jun 26, 2015, 2:00:17 PM6/26/15
to vagra...@googlegroups.com
You can run 'VAGRANT_LOG=debug vagrant up' and it will give you more verbose output. Sometimes it helps to set the ssh_hostname to localhost instead of letting it default to 127.0.0.1.

Alvaro Miranda Aguilera

unread,
Jun 29, 2015, 1:14:33 AM6/29/15
to vagra...@googlegroups.com
Hello,

Before packing the box, you need to ensure 2 things

1. You can connect

try ssh root@localhost and ssh vagrant@localhost

you get ssh prompt, all fine

2. you need to remove

/etc/udev/rules.d/70-persistent-net.rule file

Then you poweroff, and package the box

I will suggest use packer.io done by hashicorp to build the boxes from
packer template

there is an online tutorial and even packer build remotely on atlas

atlas.hashicorp.com/tutorial/packer-vagrant/0

Any question, please let me know

Thanks
Alvaro.
> --
> This mailing list is governed under the HashiCorp Community Guidelines -
> https://www.hashicorp.com/community-guidelines.html. Behavior in violation
> of those guidelines may result in your removal from this mailing list.
>
> GitHub Issues: https://github.com/mitchellh/vagrant/issues
> IRC: #vagrant on Freenode
> ---
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/vagrant-up/28184d35-7687-4427-822b-d0078691aad8%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages