Vagrant up schlägt SSH auf einem Linux-Host fehl, funktioniert aber auf einem Windows-Host [geschlossen]

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Vagrant up schlägt SSH auf einem Linux-Host fehl, funktioniert aber auf einem Windows-Host [geschlossen]

by Guest » 20 Jan 2025, 17:57

Ich verwende dasselbe Vagrantfile auf zwei Maschinen: Windows 7 mit VirtualBox 6.1.50 und Linux Mint 22 mit VirtualBox 7.1.4. Vagrant 2.4.3 auf beiden. Auf dem Windows-Host ruft vagrant up die VM problemlos auf. Auf dem Linux-Host schlägt es jedoch fehl:

Code: Select all

Bringing machine 'ansible-test' up with 'virtualbox' provider...
==> ansible-test: Box 'ubuntu/jammy64' could not be found. Attempting to find and install...
ansible-test: Box Provider: virtualbox
ansible-test: Box Version: >= 0
==> ansible-test: Loading metadata for box 'ubuntu/jammy64'
ansible-test: URL: https://vagrantcloud.com/api/v2/vagrant/ubuntu/jammy64
==> ansible-test: Adding box 'ubuntu/jammy64' (v20241002.0.0) for provider: virtualbox
ansible-test: Downloading: https://vagrantcloud.com/ubuntu/boxes/jammy64/versions/20241002.0.0/providers/virtualbox/unknown/vagrant.box
==> ansible-test: Successfully added box 'ubuntu/jammy64' (v20241002.0.0) for 'virtualbox'!
==> ansible-test: Importing base box 'ubuntu/jammy64'...
==> ansible-test: Matching MAC address for NAT networking...
==> ansible-test: Checking if box 'ubuntu/jammy64' version '20241002.0.0' is up to date...
==> ansible-test: Setting the name of the VM: ansible-test
==> ansible-test: Clearing any previously set network interfaces...
==> ansible-test: Preparing network interfaces based on configuration...
ansible-test: Adapter 1: nat
ansible-test: Adapter 2: hostonly
==> ansible-test: Forwarding ports...
ansible-test: 22 (guest) => 2222 (host) (adapter 1)
==> ansible-test: Running 'pre-boot' VM customizations...
==> ansible-test: Booting VM...
==> ansible-test: Waiting for machine to boot. This may take a few minutes...
ansible-test: SSH address: 127.0.0.1:2222
ansible-test: SSH username: vagrant
ansible-test: SSH auth method: private key
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.
Nach „SSH-Authentifizierungsmethode: privater Schlüssel“ bleibt es lange hängen. Wenn ich während dieser Zeit die VM-Konsole öffne, kann ich sehen, dass die Nur-Host-NIC nicht verbunden ist und keine IP hat. ip a zeigt

Code: Select all

3: enp0s:
mtu 1500 qdisc noop state DOWN group default qlen 1000
Es gibt auch keine /etc/netplan/50-vagrant.yml-Datei, die bei der Ausführung auf dem Windows-Host erstellt wird (obwohl dies später im Prozess passieren könnte?).
Ich habe versucht, mit --debug zu arbeiten, kann dort jedoch kein Problem feststellen. Es scheint die Netzwerkkarte zu konfigurieren:

Code: Select all

 INFO network: Network slot 2. Type: hostonly.
INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "list", "bridgedifs"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG network: Normalized configuration: {:adapter_ip=>"192.168.20.1", :auto_config=>true, :ip=>"192.168.20.101", :mac=>nil, :name=>"vboxnet0", :netmask=>"255.255.255.0", :nic_type=>nil, :type=>:static, :adapter=>2}
INFO network: Searching for matching hostonly network: 192.168.20.101
INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "list", "hostonlyifs"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit.  Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
DEBUG network: Adapter configuration: {:adapter=>2, :hostonly=>"vboxnet0", :mac_address=>nil, :nic_type=>nil, :type=>:hostonly}
INFO network: Enabling adapters...
INFO interface: output: Preparing network interfaces based on configuration...
INFO interface: output: ==> ansible-test: Preparing network interfaces based on configuration...
INFO interface: detail: Adapter 1: nat
INFO interface: detail:     ansible-test: Adapter 1: nat
INFO interface: detail: Adapter 2: hostonly
INFO interface: detail:     ansible-test: Adapter 2: hostonly
INFO subprocess: Starting process: ["/usr/bin/VBoxManage", "modifyvm", "819b7338-c1c1-43fc-bf38-5e936b26612e", "--nic1", "nat", "--nic2", "hostonly", "--hostonlyadapter2", "vboxnet0", "--cableconnected2", "on"]
INFO subprocess: Command not in installer, restoring original environment...
DEBUG subprocess: Selecting on IO
DEBUG subprocess: Waiting for process to exit. Remaining to timeout: 32000
DEBUG subprocess: Exit status: 0
Vagrantfile:

Code: Select all

Vagrant.require_version ">= 2.0.4"

if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
vbox_adapter_name = "VirtualBox Host-Only Ethernet Adapter"
vboxmanage_path = "C:\\Program Files\\Oracle\\VirtualBox\\VBoxManage.exe"
unless File.exist?(vboxmanage_path)
vboxmanage_path = "C:\\Program Files\\VirtualBox\\VBoxManage.exe"
end
else
vbox_adapter_name = "vboxnet0"
vboxmanage_path = "VBoxManage" # Assume it's in the path on Linux
end

Vagrant.configure(2) do |config|
vms = ["ansible-test"]

vms.each_with_index do |name, i|
config.vm.define name do |node|
node.vm.hostname = name
start_ip = 101

node.vm.network "private_network", ip: "192.168.20.#{start_ip + i}", name: vbox_adapter_name
end
end

config.vm.box = "ubuntu/jammy64"

config.vm.provider "virtualbox" do |vb|
vb.name = "ansible-test"
vb.gui = false
vb.memory = "1024"
vb.cpus = 2
vb.customize ["modifyvm", :id, "--natnet1", "192.168.15.0/24"]
vb.customize ["modifyvm", :id, "--graphicscontroller", "vmsvga"]
end
end
Wie behebe ich das?

Top