Vagrant box Debian/Stretch64 无法实时同步

Vagrant box Debian/Stretch64 无法实时同步

我一直在尝试使用debian/stretch64来自 Vagrant 的盒子,但是它的实时同步不起作用。

这是我的代码Vagrantfile

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

HOSTNAME = "DebianStretch64"
VB_NAME = "DebianStretch64"

Vagrant.configure("2") do |config|
  config.vm.hostname = HOSTNAME
  config.vm.box = "debian/stretch64"
  config.vm.define VB_NAME

    config.vm.provider "virtualbox" do |vb|
        vb.name = VB_NAME
    end

end

当我在 Windows 10 上运行 vagrant up 时,我得到:

PS C:\Users\Home\code\vagrantfiles\debian_stretch64> vagrant up
Bringing machine 'DebianStretch64' up with 'virtualbox' provider...
==> DebianStretch64: Importing base box 'debian/stretch64'...
==> DebianStretch64: Matching MAC address for NAT networking...
==> DebianStretch64: Checking if box 'debian/stretch64' is up to date...
==> DebianStretch64: Setting the name of the VM: DebianStretch64
==> DebianStretch64: Fixed port collision for 22 => 2222. Now on port 2200.
==> DebianStretch64: Clearing any previously set network interfaces...
==> DebianStretch64: Preparing network interfaces based on configuration...
    DebianStretch64: Adapter 1: nat
==> DebianStretch64: Forwarding ports...
    DebianStretch64: 22 (guest) => 2200 (host) (adapter 1)
==> DebianStretch64: Running 'pre-boot' VM customizations...
==> DebianStretch64: Booting VM...
==> DebianStretch64: Waiting for machine to boot. This may take a few minutes...
    DebianStretch64: SSH address: 127.0.0.1:2200
    DebianStretch64: SSH username: vagrant
    DebianStretch64: SSH auth method: private key
    DebianStretch64:
    DebianStretch64: Vagrant insecure key detected. Vagrant will automatically replace
    DebianStretch64: this with a newly generated keypair for better security.
    DebianStretch64:
    DebianStretch64: Inserting generated public key within guest...
    DebianStretch64: Removing insecure key from the guest if it's present...
    DebianStretch64: Key inserted! Disconnecting and reconnecting using new SSH key...
==> DebianStretch64: Machine booted and ready!
==> DebianStretch64: Checking for guest additions in VM...
    DebianStretch64: No guest additions were detected on the base box for this VM! Guest
    DebianStretch64: additions are required for forwarded ports, shared folders, host only
    DebianStretch64: networking, and more. If SSH fails on this machine, please install
    DebianStretch64: the guest additions and repackage the box to continue.
    DebianStretch64:
    DebianStretch64: This is not an error message; everything may continue to work properly,
    DebianStretch64: in which case you may ignore this message.
==> DebianStretch64: Setting hostname...
==> DebianStretch64: Installing rsync to the VM...
==> DebianStretch64: Rsyncing folder: /cygdrive/c/Users/Home/code/vagrantfiles/debian_stretch64/ => /vagrant

==> DebianStretch64: Machine 'DebianStretch64' has a post `vagrant up` message. This is a message
==> DebianStretch64: from the creator of the Vagrantfile, and not from Vagrant itself:
==> DebianStretch64:
==> DebianStretch64: Vanilla Debian box. See https://app.vagrantup.com/debian for help and bug reports

在这个 vagrant 中,我在文件夹内创建了一个新文件 test.txt /vagrant

PS C:\Users\Home\code\vagrantfiles\debian_stretch64> vagrant ssh
Linux DebianStretch64 4.9.0-6-amd64 #1 SMP Debian 4.9.82-1+deb9u3 (2018-03-02) x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
vagrant@DebianStretch64:~$ cd /vagrant/
vagrant@DebianStretch64:/vagrant$ touch test.txt
vagrant@DebianStretch64:/vagrant$ ls
playbook.yaml  test.txt  Vagrantfile

test.txt但是,我无法在包含 的文件夹中找到该文件Vagrantfile。当我使用 时Ubuntu/Xenial64,我没有遇到此问题。有人知道如何解决吗?

问候,

答案1

如果你在使用 Debian Boxes 时需要 Virtualbox 共享文件夹功能,你需要使用debian/contrib-stretch64盒子

Virtualbox 共享文件夹在 debian/stretch64 上被禁用,因为这需要非开源包来添加特定的 virtualbox 位。

此处记录了这一点: https://app.vagrantup.com/debian

相关内容