Vagrant ssh error

2,157 views
Skip to first unread message

STARFISH

unread,
Sep 13, 2016, 2:14:40 PM9/13/16
to Vagrant

Hi Here,

I created one vagrant file and from that I used to create the package box.

With the help of the package box, while I try to start the another vm, its having the below warning, its not starting.. I Have no idea how to fix this.

default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. 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...

Its started, but not connected and the vagrant ssh is not working


Rameshs-MacBook-Pro:vag_cent7_2 Ramesh$ vagrant ssh
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).

Below is my vagrant file.

Rameshs-MacBook-Pro:vag_cent7_2 Ramesh$ cat Vagrantfile

Vagrant.configure(2) do |config|

  config.vm.box = "/Users/Ramesh/lab_ansible/vag_cent7_1/package.box"
  config.vm.hostname = "server2"

end

Help me on fixing this.

Alvaro Miranda Aguilera

unread,
Sep 13, 2016, 6:46:52 PM9/13/16
to vagra...@googlegroups.com
the message is telling the ssh key on the guest have permissions issues

can you share your script?

this is what I use, just remove the    "    and    ",

"mkdir ~vagrant/.ssh",
"chmod 700 ~vagrant/.ssh",
"echo 'ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key' > ~vagrant/.ssh/authorized_keys",
"chmod 600 ~vagrant/.ssh/authorized_keys",
"chown -R vagrant: ~vagrant/.ssh",

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/6753486f-e67c-4f39-9a8e-6f6756a56eab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

STARFISH

unread,
Sep 13, 2016, 10:34:59 PM9/13/16
to Vagrant

I tried the same by generating the new ssh key, and then redirect to the authorized keys, still the same error.

ssh-keygen -t rsa -b 4096 -C "Vagrant"
cat vagrant.pub > ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys

-- Already its owned by vagrant, so skipped this step.

After vagrant reload, got the same error

vagrant reload
==> 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: Forwarding ports...
default: 22 (guest) => 2222 (host) (adapter 1)
==> 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: vagrant
default: SSH auth method: private key
default: Warning: Remote connection disconnect. Retrying...
default: Warning: Authentication failure. Retrying...
^C==> default: Waiting for cleanup before exiting...
Vagrant exited after cleanup due to external interrupt.


Alvaro Miranda Aguilera

unread,
Sep 14, 2016, 3:10:44 AM9/14/16
to vagra...@googlegroups.com
hello

you need:

- a known private/pub key, not just any key.
- The ssh is from the host to the guest, so adding a new pair guest-to-guest wont help.
- permissions need to be for all the content 0600 and folder 0700

If you could run my provided script and test `vagrant ssh` it will show more information.

--
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+unsubscribe@googlegroups.com.

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



--
Message has been deleted
Message has been deleted
Message has been deleted
Message has been deleted

SR

unread,
Sep 15, 2016, 12:11:23 PM9/15/16
to Vagrant

Additional information;


Rameshs-MacBook-Pro:.ssh Ramesh$ vagrant ssh-config
Host default
  HostName 127.0.0.1
  User vagrant
  Port 2222
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no
  PasswordAuthentication no
  IdentityFile /Users/Ramesh/lab_ansible/vag_cent7_1/.vagrant/.ssh/authorized_keys
  IdentitiesOnly yes
  LogLevel FATAL

Rameshs-MacBook-Pro:.ssh Ramesh$ cat /Users/Ramesh/lab_ansible/vag_cent7_1/.vagrant/.ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAQEA6NF8iallvQVp22WDkTkyrtvp9eWW6A8YVr+kz4TjGYe7gHzIw+niNltGEFHzD8+v1I2YJ6oXevct1YeS0o9HZyN1Q9qgCgzUFtdOKLv6IedplqoPkcmF0aYet2PkEDo3MlTBckFXPITAMzF8dJSIFo9D8HfdOV0IAdx4O7PtixWKn5y2hMNG0zQPyUecp4pzC6kivAIhyfHilFR61RGL+GPXQ2MWZWFYbAGjyiYJnAmCP3NOTd0jMZEnDkbUvxhMmBYSdETk1rRgm+R4LOzFUGaHqHDLKLX+FIPKcF96hrucXzcWyLbIbEgE98OHlnVYCzRdK8jlqm8tehUc9c9WhQ== vagrant insecure public key
Rameshs-MacBook-Pro:.ssh Ramesh$ ls -l /Users/Ramesh/lab_ansible/vag_cent7_1/.vagrant/.ssh/authorized_keys
-rw-------  1 Ramesh  staff  409 Sep 15 20:31 /Users/Ramesh/lab_ansible/vag_cent7_1/.vagrant/.ssh/authorized_keys
Rameshs-MacBook-Pro:.ssh Ramesh$ chown -R vagrant: /Users/Ramesh/lab_ansible/vag_cent7_1/.vagrant/.ssh/authorized_keys
chown: vagrant: illegal user name
Rameshs-MacBook-Pro:.ssh Ramesh$

Alvaro Miranda Aguilera

unread,
Sep 15, 2016, 6:01:18 PM9/15/16
to vagra...@googlegroups.com
hello

can we go slowly on this one?
in the commands you run the vagrant user doesnt exist in your host, seems you want to run those in the guest ?



by default, vagrant on first start will try to change the keys to a more secure one

what i could suggest is add config.ssh.insert_key = false  on the Vagrantfile you are using to create this new vagrant box

in this way, when you package the ssh part will be the vagrant default one

Can you work on a minimal test?

create a simple vgrant file
do some change on the guest
export the new vm as package.box
test the box in a new vm
profit

if you can put all this in a github repo, will be easier to review and comment

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+unsubscribe@googlegroups.com.

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



--

SR

unread,
Sep 16, 2016, 12:06:26 AM9/16/16
to Vagrant
As advised,  I removed all the boxes appeared on my host machine.  And created new box, and still the authentication failure happening.

https://gist.github.com/ramesh4f/0da12c1e45860733b80671aee2df6ade#file-vagrant-creation-txt

I added the below changes too  `config.ssh.insert_key = false` .

Please review the gist link


On Tuesday, 13 September 2016 23:44:40 UTC+5:30, SR wrote:

Alvaro Miranda Aguilera

unread,
Sep 16, 2016, 7:18:59 PM9/16/16
to vagra...@googlegroups.com
hello,

if you did something like yum update, that requires a reboot and recompile virtualbox guest modules

so is easier do

yum update --exclude kernel*


now, if your goal is create boxes that will be used later, at somepoint you should look into use packer with virtualbox-ovf

Alvaro

On Thu, Sep 15, 2016 at 6:25 AM, SR <rame...@gmail.com> wrote:

Hi Alvaro,

This is my full set of thing’s I worked.

I created one vagrant with ansible installed. I would like to use this for creating 2 more similar instances.

For that the after created first one, and for the second one, I created


Rameshs-MacBook-Pro:vag_cent7_1 Ramesh$ vagrant package
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...
==> default: Compressing package to: /Users/Ramesh/lab_ansible/vag_cent7_1/package.box

After that I created the new vagrant box


 vagrant box add --name server2 /Users/Ramesh/lab_ansible/vag_cent7_1/package.box --provider virtualbox

Rameshs-MacBook-Pro:boxes Ramesh$ mv server2 ansible_lab

Now I can connect without ssh password asking, but getting the shared file directory error.


Rameshs-MacBook-Pro:vag_cent7_2 Ramesh$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ansible_lab'...
==> default: Matching MAC address for NAT networking...
==> default: Setting the name of the VM: vag_cent7_2_default_1473912787464_34053
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> 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: vagrant
    default: SSH auth method: private key
    default: Warning: Remote connection disconnect. Retrying...
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: No guest additions were detected on the base box for this VM! Guest
    default: additions are required for forwarded ports, shared folders, host only
    default: networking, and more. If SSH fails on this machine, please install
    default: the guest additions and repackage the box to continue.
    default:
    default: This is not an error message; everything may continue to work properly,
    default: in which case you may ignore this message.
==> default: Setting hostname...
==> default: Mounting shared folders...
    default: /vagrant => /Users/Ramesh/lab_ansible/vag_cent7_2

^R

Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t vboxsf -o uid=`id -u vagrant`,gid=`getent group vagrant | cut -d: -f3` vagrant /vagrant
mount -t vboxsf -o uid=`id -u vagrant`,gid=`id -g vagrant` vagrant /vagrant

The error output from the last command was:

mount: unknown filesystem type 'vboxsf'
Help me on fixing this, as Im new to this one.
To unsubscribe from this group and stop receiving emails from it, send an email to vagrant-up+...@googlegroups.com.



--

--
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+unsubscribe@googlegroups.com.

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



--
Reply all
Reply to author
Forward
0 new messages