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

Command - vagrant up: Gets hung at "SSH auth method: private key" #13124

Closed
kramankishore opened this issue Apr 17, 2023 · 11 comments · Fixed by #13179
Closed

Command - vagrant up: Gets hung at "SSH auth method: private key" #13124

kramankishore opened this issue Apr 17, 2023 · 11 comments · Fixed by #13179

Comments

@kramankishore
Copy link

Issue

The command vagrant up gets hung at "SSH auth method: private key"

I've tried reading & implementing various suggestions I could find online on similar problems from Github issues & Stack Exchange but none of them seemed to work.

The relevant information about the OS, Vagrant version, VirtualBox version and the Vagrantfile are present in the Github Gist here.

Relevant specs

OS => MacOs Ventura 13.3.1 (22E261)
Vagrant version => 2.3.4
VirtualBox => Version 7.0.6 r155176 (Qt5.15.2)

Debug output

Please see the following Github gist:
https://gist.github.com/kramankishore/e9efdad152a143219777ca1a7ba9ebf1

Expected behaviour

vagrant up execution should have finished successfully and not get hung at "SSH auth method: private key"

Steps to reproduce

  1. You need MacOS Ventura 13.3.1 (22E261) (Not sure if this is a MacOS specific issue)
  2. Please install VirtualBox Version 7.0.6 r155176 (Qt5.15.2)
  3. Please install Vagrant version 2.3.4
  4. Please clone the Github gist mentioned above i.e. link to get the Vagrantfile and run the command vagrant up

Vagrantfile

# set up the default terminal
ENV["TERM"]="linux"

# set minimum version for Vagrant
Vagrant.require_version ">= 2.2.10"
Vagrant.configure("2") do |config|
  config.vm.provision "shell",
    inline: "sudo su - && zypper update && zypper install -y apparmor-parser"

  # Set the image for the vagrant box
  config.vm.box = "opensuse/Leap-15.4.x86_64"
  # Set the image version
  config.vm.box_version = "15.4.31.95"

  # Forward the ports from the guest VM to the local host machine
  config.vm.network "forwarded_port", guest: 8080, host: 8080
  config.vm.network "forwarded_port", guest: 6111, host: 6111
  config.vm.network "forwarded_port", guest: 6112, host: 6112

  # Set the static IP for the vagrant box
  config.vm.network "private_network", ip: "192.168.56.4"

  # Configure the parameters for VirtualBox provider
  config.vm.provider "virtualbox" do |vb|
    vb.memory = "4096"
    vb.cpus = 4
    vb.customize ["modifyvm", :id, "--ioapic", "on"]
  end
end

Thank you

I'm not sure if this is a bug related to Vagrant or MacOS or something else. I've tried various things based on the help available online but nothing seemed to work. If this is a bug (as it seems to be), then I would like to report it. If not, any help in solving this issue is greatly appreciated. Thanks a lot.

@matt-gaspar
Copy link

I'm now seeing this issue too having upgraded to MacOS 13.3.1 yesterday. Same Virtualbox/Vagrant versions. Was working fine prior to the OS update.

@ola-mattsson
Copy link

ola-mattsson commented May 14, 2023

Same problem, macOS 13.3.1, virtualbox 7.0.8,156879, vagrant 2.3.4, with Linux distro rhel9/rocky9/alma9. other distros works, tried rocky8 and fedora. this seems to be related to vagrant not able to ssh into the box after it is booted. Both macOS 13.3.1 and RedHat 9 has updated openssh deprecating/disabling old protocols, might be part of the problem?!.

I tested on macOS 13.0, their rocky9 booted successfully, no problem there.

VMware fusion works, but doesn't work with VPN, overall clunky networking so I prefer virtualbox.

Looking at the output from vagrant init generic/rocky9 && vagrant up --debug on macOS 13.0, it attempts to connect with ssh like OP describes, fails and tries something else. failures ends with the below message:

DEBUG ssh: == Net-SSH connection debug-level log END ==
 INFO ssh: SSH not ready: #<Vagrant::Errors::NetSSHException: An error occurred in the underlying SSH library that Vagrant uses.
The error message is shown below. In many cases, errors from this
library are caused by ssh-agent issues. Try disabling your SSH
agent or removing some keys and try again.

If the problem persists, please report a bug to the net-ssh project.

Attempts are made with different connect_opts, for example:

DEBUG ssh:   - connect_opts: {:auth_methods=>["none", "hostbased", "publickey"], :config=>false, :forward_agent=>false, :send_env=>false, :keys_only=>true, :verify_host_key=>:never, :password=>nil, :port=>2222, :timeout=>15, :user_known_hosts_file=>[], :verbose=>:debug, :logger=>#<Logger:0x00007fef235e50a0 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter:0x00007fef235e5050 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00007fef235e4f60 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<StringIO:0x00007fef235e5140>, @binmode=false, @mon_data=#<Monitor:0x00007fef235e4f10>, @mon_data_owner_object_id=116760>>, :keys=>["/Users/myuser/.vagrant.d/insecure_private_key"], :remote_user=>"vagrant"}

I hope this brings some light on the issue and I'm happy to try any suggestions.

@csuka
Copy link

csuka commented May 24, 2023

facing the same issue.
any solution?

@chrisroberts
Copy link
Member

I believe this can be worked around using the extra_args setting in the Vagrantfile's ssh settings:

Vagrant.configure("2") do |config|
  config.ssh.extra_args = ["-o", "PubkeyAcceptedKeyTypes=+ssh-rsa", "-o", "HostKeyAlgorithms=+ssh-rsa"]
end

@csuka
Copy link

csuka commented May 27, 2023

I believe this can be worked around using the extra_args setting in the Vagrantfile's ssh settings:

Vagrant.configure("2") do |config|
  config.ssh.extra_args = ["-o", "PubkeyAcceptedKeyTypes=+ssh-rsa", "-o", "HostKeyAlgorithms=+ssh-rsa"]
end

Didn't work, issue still persists.

@chrisroberts
Copy link
Member

So far I have been unable to reproduce this error. Would someone be able to provide a gist of the full debug output from running vagrant up --debug ?

@ola-mattsson
Copy link

ola-mattsson commented Jun 3, 2023

https://gist.github.com/ola-mattsson/da939e5d26d35016cca7a293fa13f9e8

Vagrant.configure("2") do |config|
  config.ssh.extra_args = ["-o", "PubkeyAcceptedKeyTypes=+ssh-rsa", "-o", "HostKeyAlgorithms=+ssh-rsa"]

  config.vm.box = "generic/alma9"
  config.vm.boot_timeout = 500
  config.vm.provider "virtualbox" do |vb|
     vb.gui = false
     vb.memory = "1024"
   end
end

@chrisroberts
Copy link
Member

@ola-mattsson Thank you for the debug log, it is very helpful! When the ssh connections are attempted, the result is always:

timeout during server version negotiating

if you open the guest in the VirtualBox GUI, does it show it as fully booted?

@csuka
Copy link

csuka commented Jun 5, 2023

if you open the guest in the VirtualBox GUI, does it show it as fully booted?

The VM has opened port 22 for SSH connections.
However, it does not show the login screen (username/password prompt). It is simply only showing kernel boot messages, even after e.g. 10 minutes.

^ I saw this behaviour for both alma 9 and rocky 9 vm's, and for both official and some other user-created boxes.

@ola-mattsson
Copy link

Yes, in VirtualBox VM, it just keeps scrolling some boot messages, I guess, can't read it, tried different graphics settings but it's not readable. Seems VirtualBox can't boot it.

@chrisroberts
Copy link
Member

Thanks for the confirmation. As this seems to be an issue with the specific boxes and Vagrant, I'm going to close this issue.

Cheers!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants