2016-08-01 23 views
3

Ich bin vagrant up ausgeführt und ich bin mit einem Problem konfrontiert, dass es schien, als wäre es dieses zu Beginn Vagrant stuck connection timeout retrying. Ich habe alle Lösungen dort versucht, ich habe auch eine vagrant destroy, aber sobald ich tun vagrant suspend, dann funktioniert die vagrant up Befehl nicht, ich muss beenden und tun vagrant reload, um die VM zu arbeiten. Es ist sehr nervig und frustrierend.Vagrant verklemmt

Ich benutze vagrant Homestead Version 0.4.4 im Moment und ein Teil dieses Problems funktioniert alles perfekt, sobald die VM gestartet wird.

Mein derzeitiges System ist OSX El Captain.

Lassen Sie mich wissen, wenn Sie weitere Informationen benötigen.

Mein Vagrantfile:

require 'json' 
require 'yaml' 

VAGRANTFILE_API_VERSION ||= "2" 
confDir = $confDir ||= File.expand_path("vendor/laravel/homestead", File.dirname(__FILE__)) 

homesteadYamlPath = "Homestead.yaml" 
homesteadJsonPath = "Homestead.json" 
afterScriptPath = "after.sh" 
aliasesPath = "aliases" 

require File.expand_path(confDir + '/scripts/homestead.rb') 

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| 
    if File.exists? aliasesPath then 
     config.vm.provision "file", source: aliasesPath, destination: "~/.bash_aliases" 
    end 

    if File.exists? homesteadYamlPath then 
     Homestead.configure(config, YAML::load(File.read(homesteadYamlPath))) 
    elsif File.exists? homesteadJsonPath then 
     Homestead.configure(config, JSON.parse(File.read(homesteadJsonPath))) 
    end 

    if File.exists? afterScriptPath then 
     config.vm.provision "shell", path: afterScriptPath 
    end 
end 

Befehl up output wenn Fehler:

~/Projects/credentialsApi (feature/10)$vagrant up 
Bringing machine 'default' up with 'virtualbox' provider... 
==> default: Checking if box 'laravel/homestead' is up to date... 
==> default: A newer version of the box 'laravel/homestead' is available! You currently 
==> default: have version '0.4.4'. The latest is version '0.5.0'. Run 
==> default: `vagrant box update` to update. 
==> default: Resuming suspended VM... 
==> default: Booting VM... 
==> default: Waiting for machine to boot. This may take a few minutes... 
    default: SSH address: 127.0.0.1:2222 
    default: SSH username: vagrant 
    default: SSH auth method: private key 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. Retrying... 
    default: Warning: Remote connection disconnect. 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. 
~/Projects/credentialsApi (feature/10)$ 

vagrant ssh-config Befehlsausgabe:

~/Projects/credentialsApi (development)$vagrant ssh-config 
Host default 
    HostName 127.0.0.1 
    User vagrant 
    Port 2204 
    UserKnownHostsFile /dev/null 
    StrictHostKeyChecking no 
    PasswordAuthentication no 
    IdentityFile "/Users/pabloleone/Projects/credentialsApi/.vagrant/machines/default/virtualbox/private_key" 
    IdentitiesOnly yes 
    LogLevel FATAL 
    ForwardAgent yes 
+0

Können Sie Ihren Befehl, Vagrantfile Inhalt und die Ausgabe einfügen? Präfix auch Ihren Befehl mit 'VAGRANT_LOG = debug 'und fügen Sie den relevanten Teil ein. – kenorb

+0

Ich lief diesen Befehl Vagrant up --debug und die Ausgabe ist riesig, ich denke nicht, ist nützlich. –

+0

Können Sie den Timeout-Fehler für die Verbindung einfügen? Zwischen "Booten der VM" und dem Fehler selbst? Was hast du schon aus den anderen Antworten probiert und was war das Ergebnis? – kenorb

Antwort

0

Ich reparierte schließlich das Problem. Es war aufgrund von Versionen. Ich habe gerade Vagrant und die VM aktualisiert.

0

Zunächst einmal versuchen vagrant mit VAGRANT_LOG=debug Variable zu debuggen laufen Das Thema.


Wenn das nicht helfen wird, während es Sie Timeout-Nachrichten ist zeigt, in einem anderen Terminal laufen: vagrant status, um zu sehen, ob die VM richtig läuft oder nicht. Oder führen Sie VirtualBox direkt von der GUI aus und überprüfen Sie den Maschinenzustand.


Wenn es läuft, überprüfen, ob SSH-Anmeldeinformationen korrekt sind, durch den folgenden Befehl ein:

vagrant ssh-config 

um:

  • Prüfung der Hostname und Port (zB 127.0.0.1:2222),
  • Ihr privater Schlüssel (IdentityFile).

finden Sie in die VM manuell, indem Sie:

vagrant ssh 

oder durch this command (ändern default zu richtigen Host von oben ssh-config-Befehl):

vagrant ssh-config > vagrant-ssh && ssh -F vagrant-ssh default 

Da funktioniert es für Sie nach vagrant reload (so Ihre Virtualisierungsunterstützung im BIOS ist wahrscheinlich aktiviert), möglicherweise, dass Ihr SSH-Server aufgrund einiger Probleme nicht standardmäßig im Lebenslauf gestartet wird.Sie sollten dann die SSH-Protokolle überprüfen, indem es über vagrant reload && vagrant ssh und prüfen, ob die Protokolle durch die Festsetzung:

sudo tail /var/log/secure 

Wenn das der Fall ist, für Abhilfe zu prüfen, ob der SSH-Dienst ausgeführt wird, fügen Sie die folgende Zeile wie:

config.vm.provision :shell, run: "always", path: "scripts/check_ssh_service.sh" 

ähnliche Ausgabe: Apache doesn't start after Vagrant reload


Schließlich überprüfen Sie die folgende Liste für mögliche Lösungen für das SSH-Timeout Problem:

  • Make sure your firewall or antivirus is not blocking the program (which I doubt will happen often)
  • Give your vagrant machine some time for timeouts to happen. If you dont have a very fast PC/Mac, the VM will take while to boot into an SSH ready state, so timeouts will happen.
  • Therefore, first try to let vagrant timeout COMPLETELY before concluding that there is a fault.
  • If vagrant times out completely then increase the timeout limit in the vagrant file to a few min and try again.
  • If that still doesnt work, then try to clean boot your vagrant machine through the VirtualBox interface and enable the GUI of the machine beforehand. If the GUI doesn't show anything happening (ie. just blackscreen, no text) while it is booting, then your vagrant machine has got problems.
  • Destroy the entire machine through the VB interface and reinstall.
  • Delete the ubuntu image files in the Vagrant Images folder in the user folder and redownload and install.
  • Do you even have an intel processor that supports 64bit hardware virtualisation? Google it. If you do, make sure there is no setting in your Bios disabling this feature.
  • Disable hyper-v feature if you are running windows 7 or 8. Google how to disable.
  • Make sure you are running through an SSH enabled client. Use Git bash. Download: http://git-scm.com/downloads
  • Install a 32bit version of ubuntu like trusty32 or precise32. Just change the version in the vagrant file and reinstall vagrant in new directory.
  • Make sure you are using the latest vagrant and virtualbox versions.
  • Last resorts: Format your computer, reinstall windows and buy an intel core isomething processor.

Quelle: GitHub Beitrag von @dezinerdudes


Siehe auch: SSH Timeout - Cant connect via ssh no matter what

+0

Vielen Dank für die große Resonanz. Ich habe die Frage mit der 'vagrant ssh-config' Kommandoausgabe aktualisiert. Ich überprüfte die SSH-Protokolle und nichts, dann habe ich die VM mit dem Debug-Schlüssel ausgeführt und wow! riesige Ausgabe, nicht sehr nützlich. Der Vagrant-Status während des Fehlers besagt, dass VM ausgeführt wird. Die andere Hilfe ist für Ubuntu und ich bin auf einem Mac. Ich habe einige von ihnen versucht, aber immer noch das Problem. –

+0

@PabloEzequielLeone Die Ports stimmen nicht überein: 2222! = 2204, Sie sollten untersuchen, woher der falsche Port stammt. Überschreibst du etwas, das in '~/.ssh/config' mit Vagabunden zusammenhängt oder etwas? – kenorb

+0

Ich habe den Port geändert, damit sie übereinstimmen, aber immer noch das Problem. Ich habe auch den Login mit Anmeldeinformationen ohne Glück festgelegt. Ich untersuche Docker, Vagrant hat nie richtig für mich gearbeitet! –