Vagrant 在 WSL 上崩溃

Vagrant 在 WSL 上崩溃

我正在尝试使用 vagrant 在我的 WSL 中运行一个简单的 VM。我在 WSL2 上使用 Ubuntu 22.04,vagrant 版本为 2.2.19。在我的 Windows(带有 VirtualBox 6.1.36)上,我有一个简单的目录,其中包含 VagrantFile:

# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
  config.vm.box = "ubuntu/bionic64"
  config.vm.provider "virtualbox" do |vb|
   vb.customize [ "modifyvm", :id, "--uartmode1", "disconnected" ]
  end
end

我已经设定了

$ export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS="1"
export PATH="$PATH:/mnt/c/Program Files/Oracle/VirtualBox"

当我尝试在 WSL 上运行 vagrant up 时,出现以下超时错误:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/bionic64'...

==> default: Checking if box 'ubuntu/bionic64' version '20220902.0.0' is up to date...
==> default: A newer version of the box 'ubuntu/bionic64' for provider 'virtualbox' is
==> default: available! You currently have version '20220902.0.0'. The latest is version
==> default: '20220916.0.0'. Run `vagrant box update` to update.
==> default: Setting the name of the VM: exmaple1_default_1663773206124_15632
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 172.21.80.1:2222
    default: SSH username: vagrant
    default: 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.

我被这个问题困扰了好几天,我已经尝试过了此链接这个 stackoverflow 问题但没有任何效果......

相关内容