与VirtualBox版本6兼容的Linux Vagrant Box

问题描述

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

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

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

插件和手动添加来宾添加都无效。

除了共享文件夹同步外,其他所有东西似乎都可以正常工作。希望找到一种解决方法来修复共享文件夹同步或与VirtualBox来宾添加兼容的标准Linux Vagrant Box

解决方法

此问题已通过manually mounting the Guest Additions VBoxGuestAdditions.iso文件作为VirtualBox中的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. VirtualBox版本:6.0.24 r139119