vagrantvagrantfilepuphpetvagrant-provision

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


So I had this problem trying to figure out it couple of days. Tried every OS in puphpet.com every time I set sync_type to smb vagrant up failing. Error output:

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

After this error I run vagrant provision which triggered another error:

==> 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.

Solution

  • So when building box via puphpet.com leave sync_type to default and after first boot vagrant ssh to your box and run sudo yum install cifs-utils for centos or sudo apt-get install cifs-utils for ubuntu.

    Another way, when building your box specify cifs-utils under System Packages then run with default sync_type, let it install all packages, after first boot, change sync_type to smb and reload.

    Thing to remember, you must first time run with default sync_type and let vagrant do provision, install all packages and configure. Then change sync_type to smb and reload, so the main problem is missing cifs-utils. Another not related to this problem is that if you leave smb_host empty it will fail too. Change it from smb_host: ' ' to smb_host: (don't leave empty space after : ). Chnages mus be made in config.yaml file.