Vagrant under windows reports an error, always prompting Warning: Authentication failure. Retrying…, and there is no shared folder after running, depressed…
Find information online, visit forums, and finally have a solution, at least it works, post it and share it.
No nonsense, here is the error code and solution:
Local environment win7, vagrant version 1.8.5, virtualbox version 5.0.4
vagrant box add centos71 vagrant-centos-7.1.box
vagrant init centos71
Error code:
1 f:\box>vagrant up 2 ==> default: Attempting graceful shutdown of VM... 3 default: Guest communication could not be established! This is 4 se 5 default: SSH is not running, the authentication information was 6 default: or some other networking issue. Vagrant will force hal 7 default: capable. 8 ==> default: Forcing shutdown of VM... 9 ==> default: Clearing any previously set forwarded ports... 10 ==> default: Fixed port collision for 22 => 2222. Now on port 2200. 11 ==> default: Clearing any previously set network interfaces... 12 ==> default: Preparing network interfaces based on configuration... 13 default: Adapter 1: nat 14 ==> default: Forwarding ports... 15 default: 22 (guest) => 2200 (host) (adapter 1) 16 ==> default: Booting VM... 17 ==> default: Waiting for machine to boot. This may take a few minut 18 default: SSH address: 127.0.0.1:2200 19 default: SSH username: vagrant 20 default: SSH auth method: private key 21 default: Warning: Authentication failure. Retrying... 22 default: Warning: Authentication failure. Retrying... 23 default: Warning: Authentication failure. Retrying... 24 default: Warning: Authentication failure. Retrying... 25 default: Warning: Authentication failure. Retrying... 26 default: Warning: Authentication failure. Retrying... 27 default: Warning: Authentication failure. Retrying... 28 default: Warning: Authentication failure. Retrying... 29 The guest machine entered an invalid state while waiting for it 30 to boot. Valid states are 'starting, running'. The machine is in th 31 'paused' state. Please verify everything is configured 32 properly and try again. 33 34 If the provider you're using has a GUI that comes with it, 35 it is often helpful to open that and watch the machine, since the 36 GUI often has more helpful error messages than Vagrant can retrieve 37 For example, if you're using VirtualBox, run `vagrant up` while the 38 VirtualBox GUI is open. 39 40 The primary issue for this error is that the provider you're using 41 is not properly configured. This is very rarely a Vagrant issue.
Solution:
1 # -*- mode: ruby -*- 2 # vi: set ft=ruby : 3 4 # All Vagrant configuration is done below. The "2" in Vagrant.configure 5 # configures the configuration version (we support older styles for 6 # backwards compatibility). Please don't change it unless you know what 7 # you're doing. 8 9 Vagrant.configure("2") do |config| 10 # The most common configuration options are documented and commented below. 11 # For a complete reference, please see the online documentation at 12 # https://docs.vagrantup.com. 13 14 # Every Vagrant development environment requires a box. You can search for 15 # boxes at https://atlas.hashicorp.com/search. 16 config.vm.box = "centos71" 17 18 config.vm.boot_timeout = 360 19 config.ssh.username = "vagrant" 20 config.ssh.password = "vagrant" 21 22 # Disable automatic box update checking. If you disable this, then 23 # boxes will only be checked for updates when the user runs 24 # `vagrant box outdated`. This is not recommended. 25 # config.vm.box_check_update = false 26 27 # Create a forwarded port mapping which allows access to a specific port 28 # within the machine from a port on the host machine. In the example below, 29 # accessing "localhost:8080" will access port 80 on the guest machine. 30 # config.vm.network "forwarded_port", guest: 80, host: 8080 31 32 # Create a private network, which allows host-only access to the machine 33 # using a specific IP. 34 # config.vm.network "private_network", ip: "192.168.33.10" 35 36 # Create a public network, which generally matched to bridged network. 37 # Bridged networks make the machine appear as another physical device on 38 # your network. 39 # config.vm.network "public_network" 40 41 # Share an additional folder to the guest VM. The first argument is 42 # the path on the host to the actual folder. The second argument is 43 # the path on the guest to mount the folder. And the optional third 44 # argument is a set of non-required options. 45 # config.vm.synced_folder "../data", "/vagrant_data" 46 47 # Provider-specific configuration so you can fine-tune various 48 # backing providers for Vagrant. These expose provider-specific options. 49 # Example for VirtualBox: 50 # 51 # config.vm.provider "virtualbox" do |vb| 52 # # Display the VirtualBox GUI when booting the machine 53 # vb.gui = true 54 # 55 # # Customize the amount of memory on the VM: 56 # vb.memory = "1024" 57 # end 58 # 59 # View the documentation for the provider you are using for more 60 # information on available options. 61 62 # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies 63 # such as FTP and Heroku are also available. See the documentation at 64 # https://docs.vagrantup.com/v2/push/atlas.html for more information. 65 # config.push.define "atlas" do |push| 66 # push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME" 67 # end 68 69 # Enable provisioning with a shell script. Additional provisioners such as 70 # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the 71 # documentation for more information about their specific syntax and use. 72 # config.vm.provision "shell", inline: <<-SHELL 73 # apt-get update 74 # apt-get install -y apache2 75 # SHELL 76 end
Two lines of code are added to the Vagrantfile configuration file, using clear text username and password
config.ssh.username = “vagrant”
config.ssh.password = “vagrant”
save
vagrant reload
done!
Well done and Good Luck!