![Vagrant up 无法在 Linux Guest 中挂载文件夹](https://linux22.com/image/1457218/Vagrant%20up%20%E6%97%A0%E6%B3%95%E5%9C%A8%20Linux%20Guest%20%E4%B8%AD%E6%8C%82%E8%BD%BD%E6%96%87%E4%BB%B6%E5%A4%B9.png)
我在使用 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
我遇到了同样的问题,并成功解决了它。
当我运行 时
ls /sbin/mount.*
,cifs
没有列出。我只看到、、、fuse
和。所以我运行以添加 CIFS支持lowntfs-3g
ntfs
ntfs-3g
vboxsf
sudo apt-get install cifs-utils
根据 Ubuntu wiki。接下来,
mount
命令失败,因为username=
参数存在但为空,并且缺少 SMB 主机名(///sharename
应为//host/sharename
)。PuPHPet GUI 表示可以将这些字段留空,并且它们将存储在config.yaml
as中''
。如果删除引号(例如smb_username:
)并运行vagrant reload
,SMB 工作正常。系统提示我输入 Windows 用户名和密码,并自动检测到我的 VirtualBox 主机的 IP 地址。
详细信息请参阅GitHub 问题。希望这两个问题能够在 PuPHPet 中得到修补。
答案2
我相信您应该打开 Vagrantfile 并删除“所有者”、“组”和“mount_options”设置,因为它们仅适用于 Linux 主机。
答案3
确保你已经安装了最新的 Virtual Box 版本,并且只需安装vbguest
插件
vagrant plugin install vagrant-vbguest