Vagrant hangs at "SSH auth method: Private key
Asked Answered
T

18

35

I am running VirtualBox 5.0.24 and Vagrant 1.8.5 on Digital Ocean VPS running on Ubuntu 14.04 LTS Precise I am using the box ubuntu/precise64 Everything works fine but when i do vagrant up it hangs at the

SSH auth method: Private key

and the exit out giving time out. Now, i can consider increasing the execution time but it already takes a fare amount of time before giving that error. I don't know what I am doing wrong. Here is my VAGRANTFILE

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|

  config.vm.box = "ubuntu/precise64"
  
  config.vm.provider :virtualbox do |vb|
    vb.customize ['modifyvm', :'1cf9e703-607e-4338-9162-20abbeca94b0', '--pae', 'on']
    vb.customize ['modifyvm', :'1cf9e703-607e-4338-9162-20abbeca94b0', '--hwvirtex', 'off']
    vb.customize ['modifyvm', :'1cf9e703-607e-4338-9162-20abbeca94b0', '--vtxvpid', 'off']
  end

end
Tracey answered 19/7, 2016 at 16:8 Comment(1)
did you check https://mcmap.net/q/142091/-vagrant-ssh-authentication-failureFerrer
S
21

I had this issue also and I fixed it by opening up the "Oracle Virtual Box Manager" GUI. Go to "Settings" -> "Network" and choose "Adapter 1" then expand the option by clicking on the arrow and make sure that "Cable Connected" is checked.

Snowball answered 8/1, 2017 at 13:31 Comment(5)
Thanks so much for this tip. I had been stuck on this issue for about a day and this solved it for me.Concertize
The option "Cable Connected" was checked by default. I'm still facing the same issue.Sweetheart
If you guys still have issues after doing this, I recommend you following this answer from a similar question: stackoverflow.com/a/57335407/1679112.Birck
After 4 hrs of being stuck, I found this comment. It was checked, but I simply unchecked it and checked it again and in the background the provisioning continued and unstuck. Thank you so much.Dineen
Thank you so much. But it was ticked & the same issue was there. However, the issue was fixed after I added config.vm.network "private_network", ip: "192.168.10.10", auto_config: false to the Vagrantfile and also tick the 'Cable connected' as well. Not sure both were necessary to fix the issue.Reasoning
A
16

Found the following solution on some arcane forum, it works by adding it to the bottom of your Vagrantfile just before the line that says end:

    config.vm.provider "virtualbox" do |vb|
        vb.customize ["modifyvm", :id, "--cableconnected1", "on"]
    end

Does the same as manually changing the setting in VirtualBox AFAIK, but I personally prefer infrastructure as code solutions. That way a colleague doesn't have to deal with the same problem somewhere down the line.

Alphabetic answered 1/2, 2019 at 14:27 Comment(1)
This works best! When sharing your vagrantfile (i.e. because you're working in a team) this is definitely the way to goWatts
H
7

enter image description here

I found that my WSL enabled on my Windows 10 so disabled it by using this command

bcdedit /set hypervisorlaunchtype off

but it didn't helped me so i went through Windows features and found that Virtual Machine Platform was turned ON so i look it up and it was linked to WSL so i turned it OFF and my ssh key problem solved.

Hegyera answered 15/3, 2020 at 15:14 Comment(5)
Same problem on my side. I think there's an incompatibility issue between Vagrant/VirtualBox & Windows Hypervisor Platform. The way I got Vagrant & WSL 2 working side was to enable/disable the following windows features: + Virtual Machine Platform: On - Windows Hypervisor Platform: Off + Windows Subsystem for Linux: OnHungry
Shoot, I need the Hypervisor. How do we get around this without disabling the Hypervisor? Using the virtual machine in a Hypervisor Win10 VM with the feature disabled is all I can think of but I think 2 layers of VM's might cause problems too.Articulation
@bean I had to disable Virtual Machine Platform feature, but after that vagrant works again (WSL does not). So, WSL2 breaks vagrant on Windows.Busby
Update 2021: Microsoft WSL 2 has fixed the issue where it broke VirtualBox Virtualization. Now you can run WSL and VirtualBox together without any issue.Hegyera
@Myster-Mayur what is the current setup? my windows 10 did an update recently and I'm back to vagrant not working. I have Virutal Machine Platform: On, Win Hypervisor Platform: Off, and Win Subsys for Linux: Off. What's the new correct config?Palestine
E
4

After spending weeks reading and testing all the answers I found, even the answers that were not marked as correct, I don't remember where, someone mentioned something about Guest Additions... I found the plugin and installed it:

    vagrant plugin install vagrant-vbguest

It works like a charm. Problem solved.

Stack: Virtualbox 6.0, Vagrant 2.2.7, OS Fedora 31

Elspet answered 23/5, 2020 at 14:56 Comment(0)
A
3

UPDATE AS OF MAY 2021: So I found that this was an actual bug in Vagrant. The solution comes directly from Hashicorps' GitHub.

Basically open the vagrantfile and add these lines under config.vm.provider :virtualbox do |v| and before end:

v.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
v.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]

If the line is config.vm.provider :virtualbox do |vb| then the code will be:

vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
vb.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]
Ankylostomiasis answered 17/5, 2021 at 18:27 Comment(0)
T
1

Seems like the latest versions are not working on a VPS. I had to choose the older versions of the softwares to run them on this ubuntu VPS The versions i chose was

VirtualBox >= 4.3.12

AND

Vagrant >= 1.5.3

This works but you will have to configure ssh

Tracey answered 20/7, 2016 at 9:26 Comment(1)
What was the solution?Sophocles
T
1

Be sure to look at the VM terminal on VirtualBox while vagrant is hanging. For me the issue was a broken file system.

I ran:

fsck -yf /dev/mapper/homestead--vg--root

from the VirtualBox terminal and the issue was resolved.

Toein answered 1/11, 2021 at 6:54 Comment(1)
THIS SORTED MY ISSUE>Exactly the same issue, but different file has been corrupted, by running above with proper filename in mapper folder it fixed file system errors and now it is again booting. Cheers!Bolero
G
0

I came across this issue when trying use virtualisation (virtualbox + vagrant) on an AWS EC2 Ubuntu 16.04 instance. Apparently, it seems it's not possible because Amazon decided to block that option - virtualbox installation will fail / you will get the message in the title when trying 'vagrant up'. As said in this article (a bit old, but convinced me):

http://cloudstacking.com.s3-website-us-east-1.amazonaws.com/posts/running-hyper-v-vmware-or-xen-on-an-aws-ec2-instance.html

A more complex solution can be found here - but I didn't try it to see if it works:

HVX: Virtual infrastructure for the cloud

Grog answered 18/12, 2016 at 7:24 Comment(0)
M
0

My version virtualbox(5.1.20), vagrant(1.9.3). I solve this error by deleting

v.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]

I´m newbie, hope this help.

Martlet answered 20/4, 2017 at 15:47 Comment(0)
L
0

In my case, I had gotten into a sort of an invalid state. Running this command before vagrant up did the trick.

Note: Use with caution, as this will clear all data on the vagrant instance.

vagrant destroy --force
Longitudinal answered 8/12, 2020 at 10:21 Comment(0)
T
0

I was getting stuck in Windows too at the same SSH auth method: Private key (trying to SSH to an Ubuntu box), and then I get a timeout after a few minutes.

Beware if you are running multiple SSH agents (maybe involuntary). For example, in Windows, you could have both Pageant and OpenSSH Authentication Agent (the ladder you can find under Windows Services). In my case, the private key was added under Pageant but OpenSSH Authentication Agent seems to have taken priority after an OS restart.

Ended up disabling the latter, restarting the OS, loading the key again in Pageant, and then vagrant ssh worked.

Tude answered 9/12, 2020 at 17:4 Comment(0)
P
0

I had this issue also and I fixed it by opening up the "Oracle Virtual Box Manager" GUI and go to "Settings" -> "Network" and choose "Adapter 1" then expand the option by clicking on the arrow and make sure that "Cable Connected" is checked.

I tried this answer and found that this was already enabled by default. I Tried disabling and re-enabling and this first gave me the following message Warning: Connection aborted. Retrying... after which vagrant continued the startup and did so successfully

Puny answered 17/2, 2021 at 12:35 Comment(1)
Welcome to SO Rick. Please notice that your post is not really an answer to the question. Once you have sufficient reputation, if you have a contribution that can improve an existing answer, please comment on it instead of answering again.Richly
A
0

Well, i faced similar issue and got the resolution in the below thread: https://forums.virtualbox.org/viewtopic.php?f=6&t=97578 This was caused by me running docker desktop on windows 10, which uses windows SubsystemLinux and utilized Hyper-v to launch the Virtual env. This does not allow or makes Virtual box too slow to respond that the ssh times out and also results in File system errors. you should specially focus on the "turtle" icon which means Virtualbox too slow and i if everything is fine then you will see the "V" icon on virtualbox console. follow the instruction to stop hyper-v reboot the machine and it will work. To turn Hyper-V off completely, do this:

  1. Shut down all programs. You will have to reboot your host.

  2. See I have a 64bit host, but can't install 64bit guests. This tutorial has a couple more things to look for in step 2. Be sure these are all turned off.

  3. Find the Command Prompt icon, right click it and choose Run As Administrator.

  4. Enter this command: bcdedit /set hypervisorlaunchtype off

  5. Enter this command: shutdown -s -t 2

  6. When the computer turns off, unplug it for 20 seconds. Then plug it in again and boot up Windows 10.

Arette answered 26/6, 2021 at 19:27 Comment(0)
T
0

Following the advice from user Kokokoko above I added the following lines to my vagrnt file.

vb.customize ["modifyvm", :id, "--uart1", "0x3F8", "4"]
vb.customize ["modifyvm", :id, "--uartmode1", "file", File::NULL]

installed the latest virtualbox, made sure the vm was halted properly and it worked for me.

using Virtualbox 6.1.32 with Vagrant 2.2.10 with Ubuntu/Xenial64

Traumatize answered 6/2, 2022 at 14:14 Comment(0)
C
0

Having recently run into this problem myself, I concluded that installing Docker Destkop for Windows caused a series of changes to my system that essentially broke VirtualBox with Vagrant.

I have concluded the following steps as my minimum viable resolution:

  1. Uninstall Docker Desktop Client
  2. Disable a series of Windows Features that are related to virtualization or containers
  3. Check CPU-Z and Intel Processor Identification Utility to verify that VT-x is now enabled
  4. Run a vagrant reload on my VM in question
  5. Uncheck cable connected and re-check cable connected
  6. vagrant ssh now works.

I will need to restore each feature one at a time to see how far I can go before breaking this again.

Here's a screenshot of the various tidbits, and the pointers:

(1) Disabled Containers in Windows (2) Disabled Hyper-V (3) Disabled Virtual Machine Platform (4) Disabled Windows Hypervisor Platform (5) Disabled WSL (6) Now VT-x shows up again (it was not showing up previously) (7) Now SLAT shows up again (it was not showing up previously) (8) CPU-Z sees VT-x as well

I now also note that Enable Nested VT-x is no longer greyed out on my CPU settings menu in VirtualBox.

enter image description here

Colon answered 2/4, 2022 at 12:37 Comment(0)
A
0

I had docker installed, this is why i had this issue. To solved it, i did the following:

systemctl stop docker.service
systemctl stop docker.socket
vagrant destroy
vagrant up

Now it works fine.

Archie answered 16/6, 2022 at 12:57 Comment(0)
C
0

Solved on Windows 11, Virtual Box Version 6.1.40 r154048 (Qt5.6.2), Vagrant 2.3.4

Let's first understand some basic DHCP concepts. If you open up Virtual Box and go to File > Host Network Manager OR type Ctrl + H you will see the following window.

enter image description here

What you need to understand is that a DHCP server simple allocates IPs to new virtual machines in this context.

Click on the DCHP Server tab to see the range of available IP addresses.

enter image description here

What this picture is telling us is that we can allocate IP's ranging from 101 < n < 254 where n is placed on 192.168.56.n

So in our Vagrant file we can do, I picked an arbitrary box:

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/xenial64"

  config.vm.define "web" do |web|
    web.vm.network "private_network", ip: "192.168.56.101", virtualbox__intnet: false

  end

  config.vm.define "db" do |db|
    db.vm.network "private_network", ip: "192.168.56.102", virtualbox__intnet: false
  end
end

If you want to see the progress of your VM, click on Show enter image description here

It will show you a command line displaying logs of the process

Once that is done, you can ping both of your machines from your host command line:

    ping 192.168.56.101

Pinging 192.168.56.101 with 32 bytes of data:
Request timed out.
Request timed out.
Reply from 192.168.56.101: bytes=32 time=1ms TTL=64
Reply from 192.168.56.101: bytes=32 time=1ms TTL=64

As you can see, oddly enough the first pings timed out but after that they start reaching the VM. For this, I don't have an explanation but it works afterwards.

The virtualbox__intnet: false option basically tells Vagrant to allow connectivity from the host to the VMs. Otherwise, the VMs would only be able to communicate between each other but not the outside world. Here's the doc reference for that

Conserve answered 21/12, 2022 at 16:23 Comment(0)
D
0

uninstall "open ssh server" & "open ssh client" from "apps => optional feautures", and reinstal "open ssh server" & "open ssh client" enter image description here

Darter answered 7/1, 2023 at 0:14 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.