Vagrant PuPHPet 不能与开箱即用的 Samba (smb) 一起工作

Vagrant PuPHPet not working with Samba (smb) out of the box

所以我有几天试图弄清楚这个问题。 每次我将 sync_type 设置为 smb vagrant up 失败时,都尝试 puphpet.com 中的每个 OS。错误输出:

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`,dir_mode=0775,file_mode=0664,sec=ntlm,credentials=/etc/smb_creds_24f79a72536bca2b335860f233950314 ///24f79a72536bca2b335860f233950314 /var/www
mount -t cifs -o uid=`id -u www-data`,gid=`id -g www-data`,dir_mode=0775,file_mode=0664,sec=ntlm,credentials=/etc/smb_creds_24f79a72536bca2b335860f233950314 ///24f79a72536bca2b335860f233950314 /var/www

The error output from the last command was:

mount: wrong fs type, bad option, bad superblock on ///24f79a72536bca2b335860f233950314,
       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

在这个错误之后我 运行 vagrant provision 触发了另一个错误:

==> pup-machine1: [vagrant-hostsupdater] Checking for host entries
==> pup-machine1: [vagrant-hostsupdater]   found entry for: 192.168.56.110 testpup.dev
==> pup-machine1: Running provisioner: shell...
    pup-machine1: Running: inline script
==> pup-machine1: sed: can't read /vagrant/puphpet/shell/*.sh: No such file or directory
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

因此,当通过 puphpet.com 构建框时,将 sync_type 保留为 default 在第一次启动 vagrant ssh 到你的盒子和 运行 sudo yum install cifs-utils for centos 之后 或 sudo apt-get install cifs-utils for ubuntu.

另一种方式,当构建你的盒子时,在系统包下指定 cifs-utils 然后 运行 默认为 sync_type,让它安装所有包,之后第一次启动,将 sync_type 更改为 smb 并重新加载。

要记住的是,你必须第一次 运行 使用默认值 sync_type 并让 vagrant 提供,安装所有包和配置。然后把sync_type改成smb重新加载,所以主要问题是缺少cifs-utils。另一个与此问题无关的是,如果您将 smb_host 留空,它也会失败。将其从 smb_host: ' ' 更改为 smb_host: (不要在 space 之后留空:)。更改必须在 config.yaml 文件中进行。