Vagrant up 无法在 Linux Guest 中挂载文件夹

Vagrant up 无法在 Linux Guest 中挂载文件夹

我在使用 Vagrant 共享文件夹时遇到了一些问题,我的基础系统是Windows 8.1 专业版。我的VirtualBox版本是5.0。

该盒子来自PuPH宠物

我不明白为什么我会遇到这个错误,是因为配置不正确吗?

这里是流浪起来

==> default: Attempting graceful shutdown of VM...
==> default: Checking if box 'puphpet/ubuntu1404-x64' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Preparing SMB shared folders...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
    default: Adapter 2: hostonly
==> default: Forwarding ports...
    default: 22 => 8057 (adapter 1)
    default: 22 => 2222 (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: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
    default: Warning: Connection timeout. Retrying...
==> default: Machine booted and ready!
GuestAdditions 5.0.0 running --- OK.
==> default: Checking for guest additions in VM...
==> default: Setting hostname...
==> default: Configuring and enabling network interfaces...
==> default: Mounting SMB shared folders...
    default: D:/Devs/Web => /var/www
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:

mount -t cifs -o uid=`id -u www-data`,gid=`getent group www-data | cut -d: -f3`,
sec=ntlm,username=,password=PASSWORDHIDDEN ///d2c8055a93aac26cbde4bbf14822ca4c /
var/www
mount -t cifs -o uid=`id -u www-data`,gid=`id -g www-data`,sec=ntlm,username=,pa
ssword=PASSWORDHIDDEN ///d2c8055a93aac26cbde4bbf14822ca4c /var/www

The error output from the last command was:

stdin: is not a tty
mount: wrong fs type, bad option, bad superblock on ///d2c8055a93aac26cbde4bbf14
822ca4c,
       missing codepage or helper program, or other error
       (for several filesystems (e.g. nfs, cifs) you might
       need a /sbin/mount.<type> helper program)
       In some cases useful info is found in syslog - try
       dmesg | tail  or so

在此之前,我遇到了常见的错误,提示 Guest Addition 版本与 Virtual Box 版本不匹配,但我安装了vb-客人现在看起来还不错。

现在看来 SMB 协议失败了,但我不知道原因。

答案1

我遇到了同样的问题,并成功解决了它。

  1. 当我运行 时ls /sbin/mount.*cifs没有列出。我只看到、、、fuse和。所以我运行以添加 CIFS支持lowntfs-3gntfsntfs-3gvboxsfsudo apt-get install cifs-utils根据 Ubuntu wiki

  2. 接下来,mount命令失败,因为username=参数存在但为空,并且缺少 SMB 主机名(///sharename应为//host/sharename)。PuPHPet GUI 表示可以将这些字段留空,并且它们将存储在config.yamlas中''。如果删除引号(例如smb_username:)并运行vagrant reload,SMB 工作正常。系统提示我输入 Windows 用户名和密码,并自动检测到我的 VirtualBox 主机的 IP 地址。

详细信息请参阅GitHub 问题。希望这两个问题能够在 PuPHPet 中得到修补。

答案2

我相信您应该打开 Vagrantfile 并删除“所有者”、“组”和“mount_options”设置,因为它们仅适用于 Linux 主机。

答案3

确保你已经安装了最新的 Virtual Box 版本,并且只需安装vbguest插件

vagrant plugin install vagrant-vbguest

相关内容