Я использую один и тот же Vagrantfile на двух машинах: Windows 7 с VirtualBox 6.1.50 и Linux Mint 22 с VirtualBox 7.1.4. Vagrant 2.4.3 на обоих. На хосте Windows vagrant up отлично запускает виртуальную машину. Однако на хосте Linux это не удается:
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.
Он надолго зависает после «Метода аутентификации SSH: закрытый ключ». Если в это время открыть консоль виртуальной машины, я увижу, что сетевой адаптер только для хоста не подключен и не имеет IP-адреса. ip a показывает
3: enp0s:
mtu 1500 qdisc noop state DOWN group default qlen 1000
Также отсутствует файл /etc/netplan/50-vagrant.yml, который создается при запуске на хосте Windows (хотя это может произойти позже в процессе?).
p>
Я попробовал запустить с --debug и не увидел там никакой проблемы. Кажется, идет настройка сетевого адаптера:
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 на двух машинах: Windows 7 с VirtualBox 6.1.50 и Linux Mint 22 с VirtualBox 7.1.4. Vagrant 2.4.3 на обоих. На хосте Windows vagrant up отлично запускает виртуальную машину. Однако на хосте Linux это не удается: [code]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. [/code] Он надолго зависает после «Метода аутентификации SSH: закрытый ключ». Если в это время открыть консоль виртуальной машины, я увижу, что сетевой адаптер только для хоста не подключен и не имеет IP-адреса. ip a показывает [code]3: enp0s: mtu 1500 qdisc noop state DOWN group default qlen 1000 [/code] Также отсутствует файл /etc/netplan/50-vagrant.yml, который создается при запуске на хосте Windows (хотя это может произойти позже в процессе?). p> Я попробовал запустить с --debug и не увидел там никакой проблемы. Кажется, идет настройка сетевого адаптера: [code] 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 [/code] Vagrantfile: [code]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 [/code] Как это исправить?
Я установил Vagrant в свою систему Windows и подтвердил, что он доступен, проверив версию:
$ vagrant --version
Vagrant 2.3.4
Однако, когда я пытаюсь инициализируя и вызывая новую среду Vagrant с помощью VirtualBox, я столкнулся с ошибкой.
Вот что я...
У меня есть лабораторная установка, использующая vagrant для управления виртуальными серверами и использующая Oracle VM VirtualBox в качестве поставщика. Прекрасно работает для моих нужд и моих ~30 виртуальных серверов.
Я перешел с CentOS 8 на Rocky...
У меня правильно запущен xdebug на бродяге на моем локальном компьютере в Ubuntu. Он показывает оранжевую таблицу с информацией об ошибках. Моя тестовая страница — localhost:8030
Я запускаю приложение Flask на виртуальной машине Vagrant. Приложение настроено на прослушивание всех адресов (0.0.0.0), и я могу получить к нему доступ из виртуальной машины, используя Curl Однако я не могу получить к нему доступ из веб-браузера...