Linux Vagrant Box 与 VirtualBox 版本 6 兼容

Linux Vagrant Box compatible with VirtualBox version 6

我一直在尝试从 Hashicorp's Vagrant Box Catalog 安装各种 Vagrant Boxes,但 none 似乎兼容:

  1. Vagrant 版本:2.2.9
  2. VirtualBox 版本:6.0.x6.1.x
  3. 主持人:Mac Catalina

我已经尝试了多种在线共享的变通办法,要么来宾添加不匹配,要么有 none 可用。

访客添加的插件和手动添加也不起作用。

除了共享文件夹同步外,一切似乎都正常。寻找解决方法来修复共享文件夹同步或与 VirtualBox 来宾添加兼容的标准 Linux Vagrant Box。

此问题已由 VirtualBox 中的 manually mounting the Guest Additions VBoxGuestAdditions.iso 文件修复为 CD-ROM。

尽管如此,Vagrant box 可能无法通过 VirtualBox 提供程序同步共享文件夹,而是使用 rsync 来实现。

这可以通过更新 Vagrantfile 来解决,方法是在配置中将提供商类型显式设置为 VirtualBox

config.vm.synced_folder ".", "/vagrant", type: "virtualbox"

在此之后 vagrant reload 和共享文件夹同步应该会按预期工作。

$ vagrant reload
==> default: Attempting graceful shutdown of VM...
==> default: Clearing any previously set forwarded ports...
Vagrant is currently configured to create VirtualBox synced folders with
the `SharedFoldersEnableSymlinksCreate` option enabled. If the Vagrant
guest is not trusted, you may want to disable this option. For more
information on this option, please refer to the VirtualBox manual:

  https://www.virtualbox.org/manual/ch04.html#sharedfolders

This option can be disabled globally with an environment variable:

  VAGRANT_DISABLE_VBOXSYMLINKCREATE=1

or on a per folder basis within the Vagrantfile:

  config.vm.synced_folder '/host/path', '/guest/path', SharedFoldersEnableSymlinksCreate: false
==> 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: 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: Machine booted and ready!
==> default: Checking for guest additions in VM...
==> default: Mounting shared folders...
    default: /vagrant => /Users/hemanik/vm/
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: flag to force provisioning. Provisioners marked to run always will still run.

不确定它是否能够找到来宾添加项default: Checking for guest additions in VM...,或者之前对来宾添加项的调整是否生效但共享文件夹同步按预期工作。

只是为了更新,重新安装了Vagrant,当前工作版本如下:

  1. Vagrant 版本:2.2.10
  2. VirtualBox 版本:6.0.24 r139119