2

我一直在尝试从Hashicorp 的 Vagrant Box Catalog安装各种 Vagrant Box,但似乎没有一个兼容:

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

我尝试了多种在线共享的解决方法,但访客添加不匹配或没有可用的。

插件和手动添加来宾添加也不起作用。

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

4

1 回答 1

1

通过在 VirtualBox 中手动将 Guest Additions VBoxGuestAdditions.iso文件挂载为 CD-ROM 解决了该问题。

尽管如此,Vagrant 盒子可能无法通过 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. 流浪版本:2.2.10
  2. 虚拟机版本:6.0.24 r139119
于 2020-08-25T07:49:27.487 回答