Vagrant up hangs on waiting for ssh

问题描述 投票:0回答:0

我正在与

libvirt
提供商一起运行 vagrant,试图运行一个
arch
框 (
archlinux/archlinux
)。 运行
vagrant up
时,命令在等待 ssh 可用时挂起。 请注意,如果我从另一个窗口运行
vagrant ssh
,它会成功并且我有一个有效的 ssh 会话。 运行
vagrant up --debug
时,我可以看到以下问题:

DEBUG ssh: Checking whether SSH is ready...
DEBUG ssh: Checking key permissions: /home/user/.vagrant.d/insecure_private_key
 INFO ssh: Attempting SSH connection...
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 192.168.121.35
 INFO ssh:   - Port: 22
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/home/user/.vagrant.d/insecure_private_key"]
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=>22, :timeout=>15, :user_known_hosts_file=>[], :verbose=>:debug, :encryption=>["aes256-ctr", "aes192-ctr", "aes128-ctr", "aes256-cbc", "aes192-cbc", "aes128-cbc", "[email protected]"
, "blowfish-ctr", "blowfish-cbc", "cast128-ctr", "cast128-cbc", "3des-ctr", "3des-cbc", "idea-cbc", "arcfour256", "arcfour128", "arcfour", "none"], :logger=>#<Logger:0x0000556be9229048 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter:0x0000556be9228f58 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x0000556be9228ee0 @shift_period_suffix=nil, @shift_size=nil,
 @shift_age=nil, @filename=nil, @dev=#<StringIO:0x0000556be92290c0>, @binmode=false, @mon_data=#<Monitor:0x0000556be9228eb8>, @mon_data_owner_object_id=335760>>, :keys=>["/home/user/.vagrant.d/insecure_private_key"], :remote_user=>"vagrant"}
DEBUG ssh: == Net-SSH connection debug-level log START ==
DEBUG ssh: D, [2023-05-10T16:53:37.961548 #1115770] DEBUG -- net.ssh.transport.session[51fa4]: establishing connection to 192.168.121.35:22
D, [2023-05-10T16:53:37.962412 #1115770] DEBUG -- net.ssh.transport.session[51fa4]: connection established
I, [2023-05-10T16:53:37.962478 #1115770]  INFO -- net.ssh.transport.server_version[51fb8]: negotiating protocol version
D, [2023-05-10T16:53:37.962494 #1115770] DEBUG -- net.ssh.transport.server_version[51fb8]: local is `SSH-2.0-Ruby/Net::SSH_5.2.0 x86_64-linux-gnu'
D, [2023-05-10T16:53:37.976104 #1115770] DEBUG -- net.ssh.transport.server_version[51fb8]: remote is `SSH-2.0-OpenSSH_9.3'
I, [2023-05-10T16:53:37.976371 #1115770]  INFO -- net.ssh.transport.algorithms[51fcc]: sending KEXINIT
D, [2023-05-10T16:53:37.976563 #1115770] DEBUG -- socket[51fe0]: queueing packet nr 0 type 20 len 1324
D, [2023-05-10T16:53:37.976685 #1115770] DEBUG -- socket[51fe0]: sent 1328 bytes
D, [2023-05-10T16:53:37.978750 #1115770] DEBUG -- socket[51fe0]: read 1080 bytes
D, [2023-05-10T16:53:37.978823 #1115770] DEBUG -- socket[51fe0]: received packet nr 0 type 20 len 1076
I, [2023-05-10T16:53:37.978863 #1115770]  INFO -- net.ssh.transport.algorithms[51fcc]: got KEXINIT from server
I, [2023-05-10T16:53:37.978942 #1115770]  INFO -- net.ssh.transport.algorithms[51fcc]: negotiating algorithms
D, [2023-05-10T16:53:37.979021 #1115770] DEBUG -- net.ssh.transport.algorithms[51fcc]: negotiated:
* kex: ecdh-sha2-nistp521
* host_key: ssh-ed25519
* encryption_server: aes256-ctr
* encryption_client: aes256-ctr
* hmac_client: hmac-sha2-512
* hmac_server: hmac-sha2-512
* compression_client: none
* compression_server: none
* language_client:
* language_server:
D, [2023-05-10T16:53:37.979035 #1115770] DEBUG -- net.ssh.transport.algorithms[51fcc]: exchanging keys
D, [2023-05-10T16:53:37.979863 #1115770] DEBUG -- socket[51fe0]: queueing packet nr 1 type 30 len 148
D, [2023-05-10T16:53:37.979989 #1115770] DEBUG -- socket[51fe0]: sent 152 bytes
D, [2023-05-10T16:53:37.983267 #1115770] DEBUG -- socket[51fe0]: read 312 bytes
D, [2023-05-10T16:53:37.983347 #1115770] DEBUG -- socket[51fe0]: received packet nr 1 type 31 len 292
D, [2023-05-10T16:53:37.984471 #1115770] DEBUG -- socket[51fe0]: queueing packet nr 2 type 21 len 20
D, [2023-05-10T16:53:37.984561 #1115770] DEBUG -- socket[51fe0]: sent 24 bytes
D, [2023-05-10T16:53:37.984636 #1115770] DEBUG -- socket[51fe0]: received packet nr 2 type 21 len 12
D, [2023-05-10T16:53:37.984844 #1115770] DEBUG -- net.ssh.authentication.session[51ff4]: beginning authentication of `vagrant'
D, [2023-05-10T16:53:37.984943 #1115770] DEBUG -- socket[51fe0]: queueing packet nr 3 type 5 len 28
D, [2023-05-10T16:53:37.984968 #1115770] DEBUG -- socket[51fe0]: sent 96 bytes
D, [2023-05-10T16:53:38.026842 #1115770] DEBUG -- socket[51fe0]: read 96 bytes
D, [2023-05-10T16:53:38.027017 #1115770] DEBUG -- socket[51fe0]: received packet nr 3 type 6 len 28
D, [2023-05-10T16:53:38.027108 #1115770] DEBUG -- net.ssh.authentication.session[51ff4]: trying none
D, [2023-05-10T16:53:38.027709 #1115770] DEBUG -- socket[51fe0]: queueing packet nr 4 type 50 len 44
D, [2023-05-10T16:53:38.027963 #1115770] DEBUG -- socket[51fe0]: sent 112 bytes
D, [2023-05-10T16:53:38.035112 #1115770] DEBUG -- socket[51fe0]: read 112 bytes
D, [2023-05-10T16:53:38.035201 #1115770] DEBUG -- socket[51fe0]: received packet nr 4 type 51 len 44
D, [2023-05-10T16:53:38.035252 #1115770] DEBUG -- net.ssh.authentication.session[51ff4]: allowed methods: publickey,password
D, [2023-05-10T16:53:38.035289 #1115770] DEBUG -- net.ssh.authentication.methods.none[52008]: none failed
D, [2023-05-10T16:53:38.035329 #1115770] DEBUG -- net.ssh.authentication.session[51ff4]: trying publickey
D, [2023-05-10T16:53:38.036018 #1115770] DEBUG -- net.ssh.authentication.agent[5201c]: connecting to ssh-agent
E, [2023-05-10T16:53:38.036216 #1115770] ERROR -- net.ssh.authentication.agent[5201c]: could not connect to ssh-agent: Agent not configured
D, [2023-05-10T16:53:38.036362 #1115770] DEBUG -- net.ssh.authentication.methods.publickey[52044]: trying publickey (dd:3b:b8:2e:85:04:06:e9:ab:ff:a8:0a:c0:04:6e:d6)
D, [2023-05-10T16:53:38.036491 #1115770] DEBUG -- socket[51fe0]: queueing packet nr 5 type 50 len 348
D, [2023-05-10T16:53:38.036606 #1115770] DEBUG -- socket[51fe0]: sent 416 bytes
D, [2023-05-10T16:53:38.043689 #1115770] DEBUG -- socket[51fe0]: read 112 bytes
D, [2023-05-10T16:53:38.043785 #1115770] DEBUG -- socket[51fe0]: received packet nr 5 type 51 len 44
D, [2023-05-10T16:53:38.043829 #1115770] DEBUG -- net.ssh.authentication.session[51ff4]: allowed methods: publickey,password
E, [2023-05-10T16:53:38.043850 #1115770] ERROR -- net.ssh.authentication.session[51ff4]: all authorization methods failed (tried none, publickey)

DEBUG ssh: == Net-SSH connection debug-level log END ==
 INFO ssh: SSH not up: #<Vagrant::Errors::SSHAuthenticationFailed: SSH authentication failed! This is typically caused by the public/private
keypair for the SSH user not being properly set on the guest VM. Please
verify that the guest VM is setup with the proper public key, and that
the private key path for Vagrant is setup properly as well.>

可疑行是

could not connect to ssh-agent: Agent not configured
,但ssh-agent确实已配置并正在运行。

我的 Vagrantfile 是

  Vagrant.configure("2") do |config|
    config.vm.box = "archlinux/archlinux"

    config.vm.provider :libvirt do |domain|
      domain.memory = 2048
      domain.cpus = 4
    end

  end

我尝试

eval $(ssh-agent) -s
启动它并运行
ssh-add
,但它没有帮助。 还尝试了How do I add my own public key to Vagrant VM?中的解决方案,但它也不起作用。

vagrant
© www.soinside.com 2019 - 2024. All rights reserved.