vagrant報錯,提示Warning: Authentication failure. Retrying...,重試多次後失敗, 並且執行完畢後沒有共享資料夾
提示資訊如下:
default: Waiting for machine to boot. This may take a few minutes... default: SSH address: 127.0.0.1:2200 default: SSH username: vagrant default: SSH auth method: private key 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... default: Warning: Authentication failure. Retrying... default: Warning: Authentication failure. Retrying... Timed out while waiting for the machine to boot. This means that Vagrant was unable to communicate with the guest machine within the configured ("config.vm.boot_timeout" value) time period. If you look above, you should be able to see the error(s) that Vagrant had when attempting to connect to the machine. These errors are usually good hints as to what may be wrong. If you're using a custom box, make sure that networking is properly working and you're able to connect to the machine. It is a common problem that networking isn't setup properly in these boxes. Verify that authentication configurations are also setup properly, as well. If the box appears to be booting properly, you may want to increase the timeout ("config.vm.boot_timeout") value.
透過上面的錯誤資訊,我們發現並不是config.vm.boot_timeout的問題, 因為我們已經可以連線虛擬機器了。 Authentication failure說明認證失敗, 猜測可能是ssh預設登陸問題, 簡單的處理方法:
在Vagrantfile配置檔案中新增了兩行程式碼,使用明文使用者名稱密碼
注意: 如果你改過vagrant的密碼,那麼請填寫改後的正確密碼。
config.ssh.username = "vagrant" config.ssh.password = "vagrant"
儲存
vagrant reload
發現問題解決啦!證明我的猜測是對的