Vagrant General solution for initial logon failure

Source: Internet
Author: User

If it is a downloaded box file, vagrant box add and init after the up, there may be a long time unable to login via vagrant SSH

==> localvm2:importing Base Box'BIGDATAVM'...==> localvm2:matching MAC Address forNAT Networking ...==>localvm2:setting The name of the VM:LOCALVM2==> localvm2:fixed Port Collision for  A=2222. Now on port2200.==>localvm2:clearing Any previously set network interfaces ...==>localvm2:preparing Network interfaces based on configuration ... localvm2:adapter1: Nat Localvm2:adapter2: Hostonly==>localvm2:forwarding ports ... localvm2: A(Guest) =2200(host) (Adapter1)==> localvm2:running'Pre-Boot'VM Customizations ...==>localvm2:booting VM ...==> localvm2:waiting forMachine to boot. This could take a few minutes ... localvm2:ssh address:127.0.0.1:2200localvm2:ssh username:vagrant localvm2:ssh auth method:private key Localvm2:Warning:Remote connection Disconnect. Retrying localvm2:Warning:Remote connection disconnect. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying. Localvm2:Warning:Authentication failure. Retrying ...

There are two possible ways

First, the virtual machine does fail to start, because the vagrant default does not display the virtual machine boot interface, so it is not very good to judge. Therefore, you need to add the Vb.gui = True option in the Vagrantfile configuration to see the startup process of the virtual machine. Frequently asked questions are vt-x support without turning on the PC, and the configuration can be changed into BIOS.

The second is the SSH authentication mechanism caused. Vagrant default to login with key, but the box file downloaded from the Internet, the KeyPair may not be configured properly.

Use vagrant ssh-config to view

D:\bigdata>vagrantSSH-confighost localvm1 HostName127.0.0.1User vagrant Port2222Userknownhostsfile/dev/NULLstricthostkeychecking no Passwordauthentication no identityfile D:/bigdata/.vagrant/machines/localvm1/virtualbox/private_key identitiesonly Yes LogLevel fatalthe provider forThis vagrant-managed Machine was reporting that itis not yet ready forSSH. Depending on your provider this can carrydifferent meanings. Make sure your machine is created and running andtry again. Additionally, check the output of ' vagrant status ' to VerifythatinchThe state and you expect. If you continue toget This error message, please view the documentation forThe provideryou're using.D:\bigdata>

The address of the private key is d:/bigdata/.vagrant/machines/localvm1/virtualbox/private_key, but the file is not actually present on this machine.

Modification Mode 1: Copy the native generated private key to the above path; with the user name password (General convention is vagrant/vagrant) through the shell login virtual machine, modify the public key file under the ~/.ssh for their native generated public key.

The next vagrant up can be landed successfully.

Modification Mode 2: Change SSH configuration to initial password login (add password and Insert_key configuration)

    CONFIG.VM.DEFINE:LOCALVM3 do |localvm3_config|        Localvm3_config.vm.hostname = "Localvm3.vagrant.internal"        localvm3_config.vm.network:p rivate_network, IP: " 192.168.66.33 "        Localvm3_config.ssh.password =" vagrant "        Localvm3_config.ssh.insert_key = False        Localvm3_config.vm.provider "VirtualBox" Do |vb|            Vb.gui = True            vb.name = "localvm3"            vb.customize ["MODIFYVM",: ID, "--cpuexecutioncap", "[]"]            vb.customize [ "MODIFYVM",: ID, "--memory", "2048"]        end    End

* Based on VirtualBox

Vagrant General solution for initial logon failure

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.