无法通过“ vagrant ssh”连接到使用“ vagrant package”创建的vagrant box

时间:2019-09-04 02:10:38

标签: vagrant qemu libvirt

使用“ vagrant package”创建的vagrant box无法使用“ vagrant ssh”连接。

注意-我正在使用libvirt和QEMU,而不是Virtualbox。

我使用了一个正在工作的无业游民实例,并使用以下内容创建了一个无业游民框 vagrant package --output abc.box vagrant box add abc.box --name abc

然后我创建一个空目录并使用以下命令生成Vagrantfile vagrant init

我编辑了Vagrantfile并设置config.vm.box =“ abc” 然后,我尝试了一个“无用功”,它挂在SSH连接上

我运行了一个“ vagrant -ssh-config”,它返回设置。我能够使用那里列出的IP和密钥连接到实例。

有人能告诉我正确启动这种实例的正确过程是什么吗?是设计使不安全的访问不保留在包装盒中吗?我是否应该只安装自己的SSH密钥并使用“ ssh”而不是“ vagrant ssh”登录?

我希望“无所作为”能够完成,但是它从未返回提示。尝试使用另一个终端上的“ vagrant ssh”连接到它无效。

我打开调试,看到下面列出的日志条目。

DEBUG ssh: == Net-SSH connection debug-level log START ==
DEBUG ssh: D, [2019-09-03T18:00:51.803268 #4837] DEBUG -- net.ssh.transport.session[1ae7be8]: establishing connection to 192.168.121.230:22
D, [2019-09-03T18:00:51.804016 #4837] DEBUG -- net.ssh.transport.session[1ae7be8]: connection established
I, [2019-09-03T18:00:51.804202 #4837]  INFO -- net.ssh.transport.server_version[1ae6e64]: negotiating protocol version
D, [2019-09-03T18:00:51.804260 #4837] DEBUG -- net.ssh.transport.server_version[1ae6e64]: local is `SSH-2.0-Ruby/Net::SSH_4.2.0 x86_64-linux'
D, [2019-09-03T18:00:51.814838 #4837] DEBUG -- net.ssh.transport.server_version[1ae6e64]: remote is `SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.3'
I, [2019-09-03T18:00:51.815157 #4837]  INFO -- net.ssh.transport.algorithms[1adcbe4]: sending KEXINIT
D, [2019-09-03T18:00:51.815403 #4837] DEBUG -- socket[1ae792c]: queueing packet nr 0 type 20 len 1156
D, [2019-09-03T18:00:51.815504 #4837] DEBUG -- socket[1ae792c]: sent 1160 bytes

DEBUG ssh: == Net-SSH connection debug-level log END ==
 INFO retryable: Retryable exception raised: #<Errno::ECONNRESET: Connection reset by peer - recvfrom(2)>
 INFO ssh: Attempting to connect to SSH...
 INFO ssh:   - Host: 192.168.XXX.XXX
 INFO ssh:   - Port: 22
 INFO ssh:   - Username: vagrant
 INFO ssh:   - Password? false
 INFO ssh:   - Key Path: ["/home/XXXXX/.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=>false, :password=>nil, :port=>22, :timeout=>15, :user_known_hosts_file=>[], :verbose=>:debug, :encryption=>["aes128-cbc", "3des-cbc", "blowfish-cbc", "cast128-cbc", "aes192-cbc", "aes256-cbc", "rijndael-cbc@lysator.liu.se", "idea-cbc", "arcfour128", "arcfour256", "arcfour", "aes128-ctr", "aes192-ctr", "aes256-ctr", "cast128-ctr", "blowfish-ctr", "3des-ctr", "none"], :logger=>#<Logger:0x00000000034d08c0 @level=0, @progname=nil, @default_formatter=#<Logger::Formatter:0x00000000034d0848 @datetime_format=nil>, @formatter=nil, @logdev=#<Logger::LogDevice:0x00000000034d07f8 @shift_period_suffix=nil, @shift_size=nil, @shift_age=nil, @filename=nil, @dev=#<StringIO:0x00000000034d0938>, @mon_owner=nil, @mon_count=0, @mon_mutex=#<Thread::Mutex:0x00000000034d07a8>>>, :keys=>["/home/XXXXXX/.vagrant.d/insecure_private_key"]}```

0 个答案:

没有答案